I'm not that good in OpenSSL. How do I create a RSA file if I only have a modulus and exponent. Programmatically I have set the 2 values with BN_bin2bn(), buit how do I save this to a file?
I just add a working and a non working example to this mail. Modulus: A1 65 EE 74 8F 23 5E A4 4C 85 05 3D 0F 60 D5 86 F9 3D B0 92 C4 94 02 C5 1E C3 4C F9 60 39 33 72 40 7B 02 A6 30 25 73 A4 6E 21 AD 95 89 DA 84 D8 BA 72 2A 3A 00 4D 17 BD B2 86 2E AC B6 CE DD 5D 6E E7 01 B4 15 3F D4 08 AA 06 B7 83 05 67 94 2C 41 71 03 CB C1 C2 74 68 75 DF 5C 9F 38 42 A5 98 4D A7 87 9E 02 0D 70 55 DA B5 91 B7 4F 72 32 08 DB 0B 44 62 AD 25 59 D5 6E E5 F7 44 44 B8 A8 3A 55 A9 BA DB BB 65 11 F6 39 A3 74 E1 64 0B AB 3E 0E 62 CB A5 C4 49 E1 B1 C8 D2 7D 3E E4 ED 0B A7 DF 2C 88 63 67 DF 30 CF 14 F2 FC 53 AD 4F 3D 2A 3A 21 E8 DF EB A7 13 58 A2 0B A7 D0 97 CC A2 EB 12 C3 21 41 FC 4A C7 71 A2 29 C3 EC BC 6A 7E 0F 02 D8 08 1D 09 94 2F 5F FC 94 6B 4F 40 A6 F3 9D 36 EF 7F 5E A9 D6 9C D2 8C 31 94 E9 F5 8F CB D4 C4 0D D6 F7 F6 CB 21 4C 04 E3 04 8B 46 58 A3 85 Exponent: 00 00 00 00 40 00 00 81 --------------------------------------Working: Ciphertext: 24 C0 AA 41 DE 72 BD 5D 32 BA 52 92 2A B5 3B 54 E8 64 75 35 25 1E F4 A4 FA 31 B0 17 A0 C6 8C E0 07 62 F7 FC 31 27 E6 32 EA BB 47 7B AF 7F D9 B2 42 5F 28 C6 92 A9 10 A9 12 03 D9 6D 7D 07 9D D9 22 B8 46 C2 A0 49 8D E0 7D CC 3E A1 6E C6 F9 28 0D EE 2A F0 57 B3 70 C0 EF 42 15 39 B4 D9 74 9B 87 31 02 C3 EF A4 07 79 69 DF 74 B1 D4 01 75 C9 2C 7D F0 D4 D0 A1 55 D5 97 C9 78 50 FF 30 82 3C 30 BC BC 74 78 E8 08 C6 11 64 00 8A E7 86 E2 FD 9C CF FA F7 91 C5 14 AF 58 AB CE 4C 34 D3 B0 2C 93 42 7B 1B 3A CA 05 E1 20 EE CF 41 B2 10 5D 41 0C F7 DE 41 D6 47 22 F3 7E 18 2D 7A BF B5 53 21 3A D0 F6 59 CD 10 E9 E7 4A AE 26 B9 85 5D F9 0C 03 A5 2E 58 C5 CE 01 0F AD 71 60 CF F1 86 08 B7 D5 D8 3C AB 6E 1E F1 00 8A D4 91 15 92 47 B3 5C 20 13 28 4E D6 5B 22 76 E2 D2 E9 B1 84 43 9B 0B --------------------------------Not working(modulus and exponent are like before): Ciphertext: 52 E7 7A 20 17 B8 27 FD 74 2D 43 FE 48 A9 56 71 04 A7 CB 5F E1 96 F4 47 49 32 73 74 85 70 3D A9 CA AD 33 6C 9F F0 85 44 94 A2 67 3F FE 1E FE C0 60 09 EC 5F BE CB C3 91 43 AF 87 A1 61 AB 29 CF 7F 91 23 74 D1 2E D3 D3 48 AF 79 AA 90 CF 5A 4D D9 BA AC 64 0D 51 47 60 5D D9 41 5F A4 B7 7A D1 D1 FC 83 74 5C 90 BB DD 5A FB 83 88 86 BD E6 75 D2 B1 7D D3 62 5E 6C D0 60 A2 02 A5 BC D7 B0 24 75 1E FB CA F2 3E 4F 62 39 EE E8 EB DF 73 5B B0 8C 21 E0 D8 15 0A 4D 32 DC 26 2A 56 17 61 28 EA 7C 68 88 9B D8 B1 40 CB 1C 03 D5 31 5A ED AD FF 22 C3 54 BB E4 98 9D AC 62 2A 91 9D 63 8D 20 52 BC 53 79 39 EA 23 C8 1A CE 9E CF 7D 76 27 F2 3E CD 2B 28 8C 7F BA 4F 34 DD CF EA AF FE 18 C6 86 A5 BE D8 AE 3B B6 4C 4B BE 52 7A C9 03 A3 75 4F 01 08 49 71 70 7C 1E FC F8 02 08 3D 7D 6B F1 Best regards Frank > -----Ursprüngliche Nachricht----- > Von: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] Im Auftrag von Dr. > Stephen Henson > Gesendet: Montag, 11. Februar 2008 15:15 > An: openssl-users@openssl.org > Betreff: Re: RSA_public_decrypt error > > On Mon, Feb 11, 2008, Wockenfu, Frank wrote: > > > Hi all, > > > > I have the following problem: > > > > I want to verify a signature that was created inside a > smartcard. The smartcard creates a digital signature with RSA > 2048 bit over a hash that was created using SHA-512 (OpenSSL). > > To verify the signature I call the OpenSSL-function > > > > RSA_public_decrypt > > > > with RSA_PKCS1_PADDING as padding. > > Most of the created signature are working fine with this > function, but > > I have some of them that cause the error 106 that has the following > > error reason > > > > RSA_R_BLOCK_TYPE_IS_NOT_01. > > > > All signatures are created at the same time with the same > card and program. All other signatures work fine. > > > > What could be the problem? > > I don't think that this is a problem with the card that > creates the signatures. > > Maybe there is some inconstistence in the hashvalue > generation or the initialisation of OpenSSL. Could this be a reason? > > > > Hope someone can help me. > > > > I'd suggest you put the values through the rsautl utility to > see if you get the same error. > > If you do try posting the public key and a few good and bad examples. > > Steve. > -- > Dr Stephen N. Henson. Email, S/MIME and PGP keys: see > homepage OpenSSL project core developer and freelance consultant. > Homepage: http://www.drh-consultancy.demon.co.uk > ______________________________________________________________________ > OpenSSL Project http://www.openssl.org > User Support Mailing List openssl-users@openssl.org > Automated List Manager [EMAIL PROTECTED] > ______________________________________________________________________ OpenSSL Project http://www.openssl.org User Support Mailing List openssl-users@openssl.org Automated List Manager [EMAIL PROTECTED]