I'm looking to generate a rsa public key (pem) from both the modulus and exponent in Objective-C. This function can be done in Java by the following; PublicKey publicKey = KeyFactory.getInstance('RSA').generatePublic(new RSAPublicKeySpec(modulus, exponent)); Although I'm having some trouble writing this for the iOS platform.
Hello Neil,
I'm not sure I fully understand where you're stuck... Thus wrote Neil Dugan ([hidden email]): > I need to find the public keys modulus and exponent. > I have loaded a private/public key generated by the openssl executable > with the function PEM_read_bio_RSAPrivateKey() and using the function > PEM_write_RSA_PUBKEY() can print the private key. > How do I find out what the modulus and exponent of the public key is? > Preferably in hex. On the command line, you can simply use openssl rsa -in myKey.pem -noout -text and you get the hex numbers that are encoded (as ASN.1 sequence) in the .pem file. Private-Key: (2048 bit) modulus: xx:yy:zz:aa:..... ... publicExponent: 65537 (0x10001) ... Private and public key use the same modulus. If you need to do the same thing from your own program, the EVP_PKEY structure has a member rsa, which in turn contains fields for n (the modulus) and e (the public exponent). Hope this helps, Martin ______________________________________________________________________ OpenSSL Project http://www.openssl.org User Support Mailing List [hidden email] Automated List Manager [hidden email] Openssl Generate Public Key From Modulus And Exponent Worksheet
Was trying to generate a RSA public key with RSA modulus(n) and RSA public exponent(e). I have tried to use SCZ-BasicEncodingRules-iOS, but unfortunately SCZ-BasicEncodingRules-iOS has wrong decoding algorithm for iOS 8 and above. Openssl genrsa -des3 -out private.pem 1024 (Encrypts with a password-just remove '-des3' if you'd rather not have a password on the private key) openssl rsa in private.key -pubout -out public.pem (Generate public key) Abstract the common Modulus from the public key.
Chilkat • HOME • Android™ • Classic ASP • C • C++ • C# • Mono C# • .NET Core C# • C# UWP/WinRT • DataFlex • Delphi ActiveX • Delphi DLL • Visual FoxPro • Java • Lianja • MFC • Objective-C • Perl • PHP ActiveX • PHP Extension • PowerBuilder • PowerShell • PureBasic • CkPython • Chilkat2-Python • Ruby • SQL Server • Swift 2 • Swift 3/4 • Tcl • Unicode C • Unicode C++ • Visual Basic 6.0 • VB.NET • VB.NET UWP/WinRT • VBScript • Xojo Plugin • Node.js • Excel • Go
Openssl Generate Public Key From Modulus And Exponent Formula© 2000-2020 Chilkat Software, Inc. All Rights Reserved. Openssl Generate Public Key From Modulus And Exponent FunctionComments are closed.
|
AuthorWrite something about yourself. No need to be fancy, just an overview. Archives
November 2020
Categories |