Hi guys,

I`m working on  RSA sign functionality for my application:  RSA signature
should be generated on device using Blackberry (Certicom) API and verified
on PC using OpenSSL.

 

Code of Sign function is listed below:

 
public static void SignP1(long hashType, CK_ATTRIBUTE CKA_MODULUS,
                        CK_ATTRIBUTE PUBLIC_EXPONENT, CK_ATTRIBUTE
PRIVATE_EXPONENT,
                        CK_ATTRIBUTE CKA_PRIME_1, CK_ATTRIBUTE CKA_PRIME_2,
                        CK_ATTRIBUTE CKA_EXPONENT_1, CK_ATTRIBUTE
CKA_EXPONENT_2,
                        CK_ATTRIBUTE CKA_COEFFICIENT, byte[] inputData,
                        CK_ULONG inputDataLen, byte[] outputData, CK_ULONG
outputDataLen)
                        throws Exception {
 
                       int modulusBitLength =
CKA_MODULUS.getByteArray().length*8;
         
                        RSAPrivateKey privKey = new RSAPrivateKey(new
RSACryptoSystem(modulusBitLength),
                                        PUBLIC_EXPONENT.getByteArray(),
                                        PRIVATE_EXPONENT.getByteArray(),
                                        CKA_MODULUS.getByteArray(),
CKA_PRIME_1.getByteArray(),
                                        CKA_PRIME_2.getByteArray(),
CKA_EXPONENT_1.getByteArray(),
                                        CKA_EXPONENT_2.getByteArray(),
                                        CKA_COEFFICIENT.getByteArray());

                        PKCS1SignatureSigner signer = new
PKCS1SignatureSigner(key,
                                new SHA1Digest() , useASN1);

                        signer.update(inputData, 0, (int)
inputDataLen.longVal);                       
                        signer.sign(outputData, 0);

                        outputDataLen.longVal = signer.getLength();
                
}



Generated signature passed a verification on Blackberry side, but fails on
PC side, when I try to verify it with OpenSSL. Input/output parameters on
both sides are same, digest of data on device is equal to digest of data on
PC.

 

 I'd really appreciate any suggestions.
-- 
View this message in context: 
http://old.nabble.com/RSA-signing%3A-Bouncy-castle-%3C-%3E-Blackberry-%28Certicom%29-API-interoperability-problem-tp32581975p32581975.html
Sent from the OpenSSL - Dev mailing list archive at Nabble.com.
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
Development Mailing List                       [email protected]
Automated List Manager                           [email protected]

Reply via email to