AnsweredAssumed Answered

RSA CRYPTO LIBRARY

Question asked by Alvaro Vidaurreta on Feb 1, 2018
Latest reply on Feb 13, 2018 by Alvaro Vidaurreta

Hi.
I'm using an RSA cryptographic library and I have a big issue with the verification process.
ST crypto library for RSA has a "standard" module, message, key pairs and signatures in its main program.
I need to use my own key pairs and module to sing my message, but the program doesn't get these keys. (I check if the keys were wrong or not, and I am sure they are good)

 

If i check the status error, its set to 1004 ( #define AUTHENTICATION_FAILED     (int32_t) (1004)          /*!<  Authentication failed */)

 

My RSA especification are this :

const uint8_t T1_Modulus[] =
{ 0xAF, 0xEB, 0x5F, 0x07, 0x82, 0xDA, 0xCF, 0x72, 0xEF, 0x8A, 0x63, 0xE9, 0xA8, 0xA7, 0x66, 0xCA,
0x7B, 0xD2, 0xD4, 0xDB, 0xC3, 0xB0, 0x52, 0xCE, 0x57, 0x14, 0xAA, 0x24, 0xF6, 0x25, 0x14, 0x68,
0xEF, 0x36, 0xA5, 0xA6, 0x7E, 0xC6, 0xE8, 0xCF, 0x2F, 0xAB, 0x03, 0x7A, 0x65, 0x2D, 0xCA, 0xCA,
0xE6, 0x34, 0x8A, 0x41, 0x74, 0xFE, 0x2A, 0xE4, 0x4D,};

 

const uint8_t T1_pubExp[] =
{
0x01, 0x00, 0x01, 
};

 

const uint8_t T1_privExp[] =
{
0x1D, 0x09, 0x2B, 0x51, 0x31, 0x0E, 0xEE, 0x88, 0x98, 0xF2, 0xED, 0x94, 0xC6, 0x6A, 0x82, 0xF3,
0xCE, 0xC6, 0x38, 0xAD, 0xE1, 0x39, 0xBC, 0x21, 0x24, 0x8C, 0x5B, 0x9C, 0xB2, 0x87, 0x65, 0x76,
0xD1, 0x17, 0x73, 0x18, 0x8B, 0xB2, 0x2C, 0x5F, 0x15, 0x6F, 0x48, 0xC6, 0xBE, 0x03, 0xBD, 0xE3,
0x97, 0xF6, 0x2E, 0x0F, 0x37, 0xE3, 0x67, 0x14, 0x3D,
};

 

const uint8_t T1_message_1[] =
{
0xcd, 0xc8, 0x7d, 0xa2, 0x23, 0xd7, 0x86,
};

 

Signature=(program output)
{
0x8F, 0xB2, 0xC8, 0x0B, 0xD8, 0x99, 0x7F, 0x0E, 0xD7, 0xBA, 0xC5, 0xF0, 0xD2, 0x18, 0xD6, 0xF8,
0x99, 0x18, 0x2D, 0x7D, 0xC5, 0x0F, 0xF3, 0x98, 0x07, 0x32, 0x71, 0x09, 0xB4, 0xE6, 0x62, 0x39,
0x1A, 0x6D, 0x85, 0x68, 0xB0, 0xFC, 0x9D, 0x01, 0xEB, 0xF1, 0x56, 0xF2, 0x0C, 0xE6, 0x28, 0x9E,
0x9B, 0x26, 0x96, 0x6B, 0x16, 0xB5, 0xEE, 0x37, 0xE4,
};  

 

The signature is the output of RSA sign function.
The programs say that the verification failed, but that's not possible, because I choose these keys to sign the message, and do the verification later (if the keys are inverse, every time you run the program the verification must be correct).

 

Im using genRSA program(free program) to verify if my keys are inverse or not, and its says they are good.

 

I tried to change byte order for message and keys, thinking maybe its a structure problem:

{
MSB, ..., ...., ...., LSB,
};  

{
LSB, ..., ...., ...., MSB,
};  

And nothing.

I can't prove with small numbers (to deduce the signature solution by other ways, and reveal tracks about what kind of mistake is out there ) because you need a module bigger than 20 bytes (hash structure for the message).
Resuming, I need to know if the keys and the module need any previous condition to apply for the RSA program for verification and signature, because our keys doesn't work right now. And the following steps to implement our own RSA signature system with my key pairs, message and module operation.

 

(apology in advance for my spelling, English is not my primary language)

Thanks.

Outcomes