Soy nuevo en el mundo criptográfico. Necesito generar una clave privada RSA correspondiente a partir de los datos proporcionados a continuación.Criptografía: Generación de claves privadas de RSA usando Módulo y exponente
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
Utilicé los siguientes para generar el RSAPrivateKey pero la clave no es correcta.
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") ;
}
/**/
Suena como tarea – Tobias