package elgamal

Import Path
	golang.org/x/crypto/openpgp/elgamal (on go.dev)

Dependency Relation
	imports 5 packages, and imported by one package

Involved Source Files Package elgamal implements ElGamal encryption, suitable for OpenPGP, as specified in "A Public-Key Cryptosystem and a Signature Scheme Based on Discrete Logarithms," IEEE Transactions on Information Theory, v. IT-31, n. 4, 1985, pp. 469-472. This form of ElGamal embeds PKCS#1 v1.5 padding, which may make it unsuitable for other protocols. RSA should be used in preference in any case.
Package-Level Type Names (total 2, both are exported)
/* sort exporteds by: | */
PrivateKey represents an ElGamal private key. PublicKey PublicKey PublicKey.G *big.Int PublicKey.P *big.Int PublicKey.Y *big.Int X *big.Int func Decrypt(priv *PrivateKey, c1, c2 *big.Int) (msg []byte, err error) func golang.org/x/crypto/openpgp/packet.NewElGamalPrivateKey(creationTime time.Time, priv *PrivateKey) *packet.PrivateKey
PublicKey represents an ElGamal public key. G *big.Int P *big.Int Y *big.Int func Encrypt(random io.Reader, pub *PublicKey, msg []byte) (c1, c2 *big.Int, err error) func golang.org/x/crypto/openpgp/packet.NewElGamalPublicKey(creationTime time.Time, pub *PublicKey) *packet.PublicKey
Package-Level Functions (total 3, in which 2 are exported)
Decrypt takes two integers, resulting from an ElGamal encryption, and returns the plaintext of the message. An error can result only if the ciphertext is invalid. Users should keep in mind that this is a padding oracle and thus, if exposed to an adaptive chosen ciphertext attack, can be used to break the cryptosystem. See ``Chosen Ciphertext Attacks Against Protocols Based on the RSA Encryption Standard PKCS #1'', Daniel Bleichenbacher, Advances in Cryptology (Crypto '98),
Encrypt encrypts the given message to the given public key. The result is a pair of integers. Errors can result from reading random, or because msg is too large to be encrypted to the public key.