Page 1 of 2
Throw CryptoException when signing
Posted: Thu Oct 27, 2016 11:07 pm
by mose05
When I used Signature to sign, it always threw CryptoException, reason value is 5. Does anyone have this experience? How can I solve this issue?
Thanks a lot.
Re: Throw CryptoException when signing
Posted: Fri Oct 28, 2016 3:55 am
by mabel
Tell us the Signature algorithm and padding type you used.
Re: Throw CryptoException when signing
Posted: Fri Oct 28, 2016 3:58 am
by mose05
mabel wrote:Tell us the Signature algorithm and filler type you used.
Signature algorithm: ALG_RSA_SHA_512_PKCS1
RSA key length: 512bits
Re: Throw CryptoException when signing
Posted: Fri Oct 28, 2016 4:54 am
by mabel
The Signature data length that pkcs1 padding algorithm needs should be less than (64-11) bytes.
However, SHA512 Hash result is just 512, which doesnot satisfy with Signature data length requirement. So it will throw exception.
Re: Throw CryptoException when signing
Posted: Fri Oct 28, 2016 5:08 am
by tomc2016
Don't use RSA512 to do the computations. Use RSA1024 or RSA2048 instead. The computation speed of RSA1024 and RSA2048 is also very fast.
Re: Throw CryptoException when signing
Posted: Fri Oct 28, 2016 5:12 am
by mose05
Thanks for all the help. I got it.
Re: Throw CryptoException when signing
Posted: Mon Oct 31, 2016 9:50 am
by tay00000
Just curious, which card are you using that will support Signature.ALG_RSA_SHA_512_PKCS1 ?
I am interested in getting one too.
Re: Throw CryptoException when signing
Posted: Mon Oct 31, 2016 10:42 pm
by UNKNwYSHSA
Same question.
Re: Throw CryptoException when signing
Posted: Mon Oct 31, 2016 11:26 pm
by mose05
tay00000 wrote:Just curious, which card are you using that will support Signature.ALG_RSA_SHA_512_PKCS1 ?
I am interested in getting one too.
My colleague gave it to me. I don't know the card model either. It's just a white blank card. Sorry.
Re: Throw CryptoException when signing
Posted: Mon Oct 31, 2016 11:28 pm
by mose05
UNKNwYSHSA wrote:Same question.
My colleague gave it to me. I don't know the card model either. It's just a white blank card. Sorry.