0

I have the following keypair created with SJCL.js on node.js

var keyPair = sjcl.ecc.elGamal.generateKeys(sjcl.ecc.curves.c384);

I understand that I need somehow elGamal in Android as well. I want to implement a chat feature whereby every text chat to be sent will be encrypted with the public key of the receiver.

How can I use these elGamal public keys to perform an encryption (and the private key to decrypt respectively) in Android? So far, I have just found support for RSA keys.

codebird456
  • 505
  • 8
  • 19
  • 1
    Install Bouncy Castle. Possibly you'll have to use the lightweight crypto API (i.e. use the Bouncy classes directly). – Maarten Bodewes Feb 01 '20 at 09:36
  • 1
    @MaartenBodewes: I don't think Bouncycastle supports elliptic curve ElGamal, only mod p ElGamal. – President James K. Polk Feb 01 '20 at 17:46
  • 1
    Oh, in that case I wonder how I did implement it. Probably using direct EC calculations, those are available for sure. – Maarten Bodewes Feb 01 '20 at 22:03
  • Thanks for your answers. I do not need to create the keys in Android as they are created on node.js server. However, I need to perform encrypt and decrypt operations of the provided strings. – codebird456 Feb 02 '20 at 06:08
  • After having done some studies, some curves are supported in bouncycastle. https://www.bouncycastle.org/wiki/pages/viewpage.action?pageId=362269#SupportedCurves(ECDSAandECGOST)-NIST(aliasesforSECcurves) – codebird456 Feb 02 '20 at 07:06

0 Answers0