简体   繁体   中英

EC ElGamal in Bouncy castle for Java

(this is purely for academic purposes)

I have got RSA and ElGamal implemented using bouncy castle, But I am not sure how to impliment EC ElGamal. section 4.4 in the bouncy castle spec says: "The org.bouncycastle.crypto.ec package contains implementations for a variety of EC cryptographic transforms such as EC ElGamal" However it doesn't go about explaining how to use it.

I have got as far as using the named curves in the key pair generation

ECNamedCurveTable.getParameterSpec("prime192v1")

But I don't know the algorithm reference eg "AES", "RSA" to put the initialisation calls

KeyPairGenerator kpg = KeyPairGenerator.getInstance(algorithm, provider);

Or if anything else needs to be changed when using ECC? I take it the message size limit in ECC is based on the curve size? the above example being 192-bits.

With ECElGamalEncryptor you can only encrypt a point on the curve. This is actually the same with textbook RSA (ie modular exponentiation) where you can only encrypt a big integer (less than the modulus).

You should be using a scheme such as ECIES to encrypt with Elliptic Curve cryptography. ECIES basically uses static Diffie-Hellman to encrypt messages.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM