2016-04-22 02:59 AM
Hi
i have a problem with RSA signing. when i use RSA_PKCS1v15_Verify function from ST library, i get a error of rsa Invalid Key.is there any function that i can create a modulus?..2016-04-22 04:46 AM
Hi emb_begin,
Check if your RSA private key structure and parameters are valid.You can refer to the '''' it may be helpful for you.Regards2018-03-20 09:02 AM
2018-03-22 02:34 AM
Ok, I found my bug.
Openssl add an extra 0x00 in front of modulux and exponent to make them positive integers.
With
uint8_t privateExponent[] = {
0xd9, 0x1c, 0xec, 0xb7, 0x5d, 0x79, 0x52, 0xe2, 0x44, 0xd6, 0x6d, 0xa1, 0x92, 0x1a,
0xf0, 0x9d, 0xb3, 0x32, 0x98, 0x89, 0x53, 0x76, 0xbc, 0xac, 0xb3, 0x24, 0x1d, 0xc3, 0xda,
0x55, 0xe0, 0x42, 0xe2, 0x03, 0xc6, 0x4a, 0x2a, 0x29, 0xb2, 0x67, 0xdf, 0x82, 0x8d, 0xfb,
0x8d, 0x05, 0x95, 0xe4, 0x37, 0x9e, 0x0a, 0x02, 0x20, 0x06, 0xff, 0xae, 0x14, 0xa4, 0xe0,
0xbf, 0x35, 0x58, 0x4e, 0xc4, 0x4b, 0x92, 0x13, 0x02, 0xcd, 0x9a, 0xad, 0xa7, 0xf1, 0xec,
0xd5, 0x5b, 0xbf, 0xb8, 0x7c, 0x26, 0x50, 0x7d, 0x70, 0x30, 0x16, 0x6a, 0x18, 0xda, 0x79,
0xe8, 0x86, 0xdb, 0x93, 0x4e, 0x53, 0x34, 0x1a, 0x67, 0x35, 0xae, 0xe0, 0xb8, 0xc5, 0xe6,
0x34, 0x7b, 0x59, 0x62, 0x97, 0xb2, 0x6d, 0x38, 0x33, 0xab, 0xf4, 0xde, 0x4b, 0xc6, 0x88,
0x68, 0xaf, 0x61, 0x30, 0x94, 0x72, 0xa1, 0x2f, 0xc1 };
uint8_t modulus[] = {
0xda, 0x26, 0xca, 0xf4, 0xd9, 0xa5, 0x17, 0xeb, 0xa7, 0x00, 0x94, 0x2c, 0x01, 0x31,
0xf6, 0x6a, 0xff, 0xcd, 0x0d, 0xd7, 0xbd, 0x16, 0xc6, 0xce, 0xf5, 0x3c, 0xbd, 0xb2, 0x6b,
0xda, 0xc1, 0x59, 0xa6, 0x2f, 0x8c, 0x11, 0x19, 0x39, 0x81, 0x6d, 0xce, 0x50, 0x10, 0xc2,
0x77, 0x40, 0x01, 0xab, 0xd5, 0x42, 0x55, 0x35, 0xae, 0x3f, 0xcf, 0x39, 0xd3, 0x92, 0xfc,
0xf5, 0x64, 0x34, 0x3f, 0x97, 0xb2, 0x89, 0x91, 0xea, 0xf2, 0x9a, 0x8f, 0x80, 0x33, 0x1c,
0x13, 0x48, 0x14, 0xa7, 0xc8, 0x9e, 0x79, 0x98, 0xa2, 0x22, 0xdc, 0xe1, 0xb0, 0x2a, 0x56,
0xa3, 0xe0, 0xd3, 0xd4, 0x26, 0xd2, 0x25, 0xab, 0x54, 0x8a, 0x7a, 0x00, 0x8c, 0x26, 0x93,
0x55, 0x0d, 0xae, 0x67, 0xa2, 0x13, 0x93, 0x0d, 0xde, 0xae, 0x7c, 0x48, 0xc0, 0xc7, 0x79,
0x44, 0x71, 0xfa, 0x7f, 0x58, 0x76, 0x0c, 0xea, 0x81 };
Everything works good.