btw, when i try to get the error code by
printf("Error code: %d", ERR_get_error());
i get Error code: 67567722
thanks- adrian
On Mon, Oct 13, 2008 at 11:21 AM, adrian golding <[EMAIL PROTECTED]>wrote:
> hi, i tried to verify a signature but it fails giving an error code of -1.
> can anyone tell me where i might had gone wrong?
> i used the RSA_public_decrypt which i think should be the correct function
> to use.
> pValidationData.rgbValidationData has been signed previously using the
> private key.
> i'm suspecting it could be some problem with lengths of the variables.
>
> publicKey = RSA_new();
>
> RSAModulus = BN_new();
> BN_bin2bn(prgbAttribData, pulAttribDataSize, RSAModulus);
> publicKey->n = RSAModulus;
>
> RSAExponent = BN_new();
> BN_hex2bn(&RSAExponent, "010001");
> publicKey->e = RSAExponent;
>
> outputPlaintext = (unsigned char *)OPENSSL_malloc((unsigned
> int)pValidationData.ulValidationDataLength);
>
> // RSA_size(publicKey) returns 256
> // pValidationData.ulValidationDataLength is 256 too
>
> result = RSA_public_decrypt(pValidationData.ulValidationDataLength,
> pValidationData.rgbValidationData, outputPlaintext, publicKey,
> RSA_PKCS1_PADDING);
>
> if (result == -1) {
> printf("RSA public dncrypt error!\n");
> ERR_get_error();
> }
>
> I know this isn't a lot of information why it failed, how do i find out
> more about what went wrong?
>
> thanks - adrian
>