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

Reply via email to