src/utils/crypto_utils/src/crypto_lib.c
bool IsValidSignature(
    const char* alg,
    const uint8_t* expectedSignature,
    size_t sigLength,
    const uint8_t* blob,
    size_t blobLength,
    CryptoKeyHandle keyToSign)
{
    if (alg == NULL || expectedSignature == NULL || sigLength == 0 || blob == NULL || blobLength == 0)
    {
        return false;
    }
    bool result = false;

    Algorithm_Id algId = AlgorithmIdFromString(alg);

    switch (algId)
    {
    case Alg_RSA256:
        result = VerifyRS256Signature(expectedSignature, sigLength, blob, blobLength, keyToSign);
        break;

    default:
    case Alg_NotSupported:
        result = false;
    }

    return result;
}
/**
 * @brief Checks if the provided signature is valid using the associated algorithm and provided key.
 * @details the alg provided must be one of the currently supported ones.
 * @param alg the algorithm to use for signature verification
 * @param expectedSignature the expected signature to validate
 * @param blob buffer that contains the data for computing a signature to be checked against @p expectedSignature should be an array of bytes
 * @param blobLength the size of buffer @p blob
 * @param keyToSign key that should be used for generating the computed signature. May be NULL depending on the algorithm
 * @returns true if the signature is valid, false if it is invalid
 */
@brief Checks if the provided signature is valid using the associated algorithm and provided key.
@details the alg provided must be one of the currently supported ones.
@brief Checks if the provided signature is valid using the associated algorithm and provided key . @details the alg provided must be one of the currently supported ones .
bool IsValidSignature(
    const char* alg,
    const uint8_t* expectedSignature,
    size_t sigLength,
    const uint8_t* blob,
    size_t blobLength,
    CryptoKeyHandle keyToSign)
{
    if (alg == NULL || expectedSignature == NULL || sigLength == 0 || blob == NULL || blobLength == 0)
    {
        return false;
    }
    bool result = false;
    Algorithm_Id algId = AlgorithmIdFromString(alg);
    switch (algId)
    {
    case Alg_RSA256:
        result = VerifyRS256Signature(expectedSignature, sigLength, blob, blobLength, keyToSign);
        break;
    default:
    case Alg_NotSupported:
        result = false;
    }
    return result;
}
bool IsValidSignature ( const char * alg , const uint8_t * expectedSignature , size_t sigLength , const uint8_t * blob , size_t blobLength , CryptoKeyHandle keyToSign ) { if ( alg == NULL || expectedSignature == NULL || sigLength == 0 || blob == NULL || blobLength == 0 ) { return false ; } bool result = false ; Algorithm_Id algId = AlgorithmIdFromString ( alg ) ; switch ( algId ) { case Alg_RSA256 : result = VerifyRS256Signature ( expectedSignature , sigLength , blob , blobLength , keyToSign ) ; break ; default : case Alg_NotSupported : result = false ; } return result ; }
@brief Checks if the provided signature is valid using the associated algorithm and provided key.
@brief Checks if the provided signature is valid using the associated algorithm and provided key .