src/utils/crypto_utils/src/crypto_lib.c
CryptoKeyHandle RSAKey_ObjFromB64Strings(const char* encodedN, const char* encodedE)
{
    CryptoKeyHandle result = NULL;
    BUFFER_HANDLE eBuff = NULL;

    BUFFER_HANDLE nBuff = Azure_Base64_Decode(encodedN);
    if (nBuff == NULL)
    {
        goto done;
    }

    eBuff = Azure_Base64_Decode(encodedE);
    if (eBuff == NULL)
    {
        goto done;
    }

    result =
        RSAKey_ObjFromBytes(BUFFER_u_char(nBuff), BUFFER_length(nBuff), BUFFER_u_char(eBuff), BUFFER_length(eBuff));

done:
    BUFFER_delete(nBuff);
    BUFFER_delete(eBuff);

    return result;
}
/**
 * @brief Makes an RSA key from pure strings.
 * @param N the modulus in string format
 * @param e the exponent in string format
 * @return NULL on failure and a pointer to a key on success
 */
@brief Makes an RSA key from pure strings.
@param N the modulus in string format
@param e the exponent in string format
@return NULL on failure and a pointer to a key on success
@brief Makes an RSA key from pure strings . @param N the modulus in string format @param e the exponent in string format @return NULL on failure and a pointer to a key on success
CryptoKeyHandle RSAKey_ObjFromB64Strings(const char* encodedN, const char* encodedE)
{
    CryptoKeyHandle result = NULL;
    BUFFER_HANDLE eBuff = NULL;
    BUFFER_HANDLE nBuff = Azure_Base64_Decode(encodedN);
    if (nBuff == NULL)
    {
        goto done;
    }
    eBuff = Azure_Base64_Decode(encodedE);
    if (eBuff == NULL)
    {
        goto done;
    }
    result =
        RSAKey_ObjFromBytes(BUFFER_u_char(nBuff), BUFFER_length(nBuff), BUFFER_u_char(eBuff), BUFFER_length(eBuff));
done:
    BUFFER_delete(nBuff);
    BUFFER_delete(eBuff);
    return result;
}
CryptoKeyHandle RSAKey_ObjFromB64Strings ( const char * encodedN , const char * encodedE ) { CryptoKeyHandle result = NULL ; BUFFER_HANDLE eBuff = NULL ; BUFFER_HANDLE nBuff = Azure_Base64_Decode ( encodedN ) ; if ( nBuff == NULL ) { goto done ; } eBuff = Azure_Base64_Decode ( encodedE ) ; if ( eBuff == NULL ) { goto done ; } result = RSAKey_ObjFromBytes ( BUFFER_u_char ( nBuff ) , BUFFER_length ( nBuff ) , BUFFER_u_char ( eBuff ) , BUFFER_length ( eBuff ) ) ; done : BUFFER_delete ( nBuff ) ; BUFFER_delete ( eBuff ) ; return result ; }
@brief Makes an RSA key from pure strings.
@brief Makes an RSA key from pure strings .