On 27 October 2014 14:03, Gayathri Manoj <gayathri.an...@gmail.com> wrote:

> Hi All,
>
> How can I replace RSA_public_decrypt() with EVP_Verify*().
>
> I  wanted to replace the below api with EVP_verify*()
>
> RSA_public_decrypt(Len, SgnData, dBuffer,  rsa_pub_key, RSA_PKCS1_PADDING);
>
> I have tried with
>
> EVP_MD_CTX     md_ctx;
> unsigned char *decryptBuffer = NULL;
> EVP_PKEY *pubKey = NULL;
> PubKey = X509_get_pubkey(X509cert);
> decryptBuf = (uchar *) malloc(EVP_MD_size(EVP_sha1()));
>
> EVP_VerifyInit(&md_ctx, EVP_sha1());
> EVP_VerifyUpdate (&md_ctx, dBuffer, strlen(dBuffer)-1);
> errorCode = EVP_VerifyFinal(&md_ctx, SgnData, Len, PubKey);
>
> Getting errorCode as 0. ERR[bad signature]
>
> certificate's Signature Algorithm is SHA256withRSA
>
Why are you using EVP_sha1() while allocating decryptBuf and in
EVP_VerifyInit() if signature alg is SHA256-RSA?

>
> Please let me know how can I solve this issue.
>
> Thanks,
> Gayathri
>

Reply via email to