4
votes

I have encrypt my password in android(client side) with rsa. As we know its using public key to encrypt and private key to decrypt. i generate public key and private key like code below

KeyPairGenerator gen = KeyPairGenerator.getInstance(RSA);

    gen.initialize(1024, new SecureRandom());

    KeyPair keyPair = gen.generateKeyPair();

    uk = keyPair.getPublic();

    rk = keyPair.getPrivate();

im succes to encrypt and decrypt this in android with this key. but in server side, the person who handle decryption need my private key as result that generate. how i give that private key to person that handle server side to decrypt data with my private key.

thanks...

1

1 Answers

3
votes

if you want to send encrypted string to your server, your server needs to have the key pair. while sending message from client, use the server's public key and in the server side decrypt the received message using the private key.