Cryptography: creating an RSA secret key using a module and metric

I am new to the cryptographic world. I need to generate the corresponding RSA private key from the data below.

Modulus B87BDAB530F8FDED78223D841C5D4E66A6CA86E1D690E829755F244B6FA64D0B8FFBB33AC46FE533568FD6A965EDE7AFFAED8B15476E7B70D637188B8E6B78FDAE17941E7A1304699405F94FD8E596A2BA1CA57D413E96F6E9A3F7585EEF156E8220E7C45DCB48C6CC667AC52E521444225DD6F5611CE8C14DF680C291CFDFE5 Modulus (Base 64) uHvatTD4/e14Ij2EHF1OZqbKhuHWkOgpdV8kS2+mTQuP+7M6xGlM1aP1qll7eev+u2LFUdue3DWNxiLjmt4a4XlB56EwRplAX5T9jllqK6HKV9QT6W9umj91he7xVugiDnxF3LSMbMZnrFLlIURCJd1vVhHOjBTfaAwpHP3+U= Private Exponent 84920445868EB73309CC593671879F8A66BB4D18472F54964E50F36CFE2B9C5BFDB8DB4014DF6FEE677AEFC0458E239B338FB60DB18A344C8EB38300EE744EB98B2606AC4781C4C9317B0289F41D7E92C927639E699D0E903B5160D9AEBFD70C1D6EBA539774459B95107E60941B22EECD54F7D0C8DE47DA7719C33FD4DB9155 Private Exponent (Base 64) hJIERYaOtzMJzFk2cYefima7TRhHL1SWTlDzbP4rnFv9uNtAFN9v7md678BFjiObM4+2DbGKNEyOs4MA7nROuYsmBqxHgcTJMXsCifQdfpLJJ2OeaZ0OkDtRYNmuv9cMHW66U5d0RZuVEH5glBsi7s1U99DI3kfadxnDP9TbkVU= Public Exponent 010001 Public Exponent (Base 64) AQAB 

I used the following code to generate RSAPrivateKey, but the key is incorrect.

 char *szModulus = "B87BDAB530F8FDED78223D841C5D4E66A6CA86E1D690E829755F244B6FA64D0B8FFBB33AC46FE533568FD6A965EDE7AFFAED8B15476E7B70D637188B8E6B78FDAE17941E7A1304699405F94FD8E596A2BA1CA57D413E96F6E9A3F7585EEF156E8220E7C45DCB48C6CC667AC52E521444225DD6F5611CE8C14DF680C291CFDFE5" ; char *szExp = "84920445868EB73309CC593671879F8A66BB4D18472F54964E50F36CFE2B9C5BFDB8DB4014DF6FEE677AEFC0458E239B338FB60DB18A344C8EB38300EE744EB98B2606AC4781C4C9317B0289F41D7E92C927639E699D0E903B5160D9AEBFD70C1D6EBA539774459B95107E60941B22EECD54F7D0C8DE47DA7719C33FD4DB9155" ; char *szPubExp = "010001" ; RSA* rsa = RSA_new(); int ret = BN_hex2bn(&rsa->n,szModulus) ; ret = BN_hex2bn(&rsa->d,szExp) ; ret = BN_hex2bn(&rsa->e,szPubExp) ; if (!PEM_write_RSAPrivateKey(fp, rsa, NULL, NULL, 0, 0, NULL)) { printf("\n PEM_write_PrivateKey failed \n") ; } /**/ 
+6
source share
1 answer

The module and the private exponent are a private key, at least in a simplified way.

When using RSA, it is usually customary to include several other parameters in the private key, for example, two (or more) simple module coefficients. These additional parameters do not provide more power (the module and private indicator are sufficient for calculating signatures and decrypting data), but they allow for faster implementation (3 times - 4 times).

Thus, perhaps we are talking about restoring simple module coefficients, given the above information. The general method is given in the Handbook of Applied Cryptography, chapter 8, section 8.2.2, paragraph (i) (“Attitude to factoring”), p. 287.

+3
source

Source: https://habr.com/ru/post/886219/


All Articles