0

I have a webservice in java using Spring that needs to generate a RSA Key Pair and send the PUBLIC KEY via this WS, so that a ANDROID and a iOS app can read and encrypt a STRING using this public key.

On every WS request, it must to generate a new Key Pair.

I've try to use the KeyPair class in Java an only the ANDROID app has recognized the public key.

How can I do that? Can someone help me with this?

vhbsouza
  • 407
  • 2
  • 5
  • 15

2 Answers2

0

Upon further study, I found that iOS's secKeyWrapper can only accept key's data in ASN.1 DER format. Any attempts to pass data in any other format would definitely fail on iOS.

Solved the problem by dumping the RSA keys in PEM format and used the approach from following link to read PEM and convert to ASN.1 DER format and passed the same to SecKeyWrapper!

Alternate approach: Problem could have also be solved by using OpenSSL libraries for iOS (refer Generate Public Key From Modulus & Exponent on iOS using OpenSSL) and create RSA objects with input modulus & exponent (base64encoded) data for the public key shared from any other platform.

Community
  • 1
  • 1
Mohith P
  • 585
  • 5
  • 14
0

Preferences -> SSH2 -> Key Management -> select RSA -> move ur mouse point over the bank space until public key generated -> Click on Save private key(Both public and private key will be saved in C://Users/User Name/.ssh/id_rsa.pub key), thats all....

Naveen Shriyan
  • 1,266
  • 1
  • 9
  • 15