Is it possible to use ECDH key pairs (Public and private keys) for encryption and decryption like RSA key pairs in encryption and decryption. Say for example, if i have RSA key pairs then i could do below things,
// Encryption this.cipher.init(Cipher.ENCRYPT_MODE, this.publicKey); hexEncodedCipher = this.cipher.doFinal(value); // Decryption this.cipher.init(Cipher.DECRYPT_MODE, this.privateKey); hexEncodedCipher = this.cipher.doFinal(value);
So Is it possible to do the same thing for ECDH ? And is it correct way of doing things ?