|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.i2p.crypto.ElGamalEngine
public class ElGamalEngine
Wrapper for ElGamal encryption/signature schemes. Does all of Elgamal now for data sizes of 223 bytes and less. The data to be encrypted is first prepended with a random nonzero byte, then the 32 bytes making up the SHA256 of the data, then the data itself. The random byte and the SHA256 hash is stripped on decrypt so the original data is returned.
Constructor Summary | |
---|---|
ElGamalEngine(I2PAppContext context)
The ElGamal engine should only be constructed and accessed through the application context. |
Method Summary | |
---|---|
byte[] |
decrypt(byte[] encrypted,
PrivateKey privateKey)
Decrypt the data |
byte[] |
encrypt(byte[] data,
PublicKey publicKey)
encrypt the data to the public key |
static void |
main(java.lang.String[] args)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ElGamalEngine(I2PAppContext context)
Method Detail |
---|
public byte[] encrypt(byte[] data, PublicKey publicKey)
publicKey
- public key encrypt todata
- data to encrypt
public byte[] decrypt(byte[] encrypted, PrivateKey privateKey)
encrypted
- encrypted dataprivateKey
- private key to decrypt with
public static void main(java.lang.String[] args)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |