Documentation ¶
Index ¶
- func Decrypt(privKey *elgamal.PrivateKey, d []byte) ([]byte, error)
- func ElgamalGenerate(priv *elgamal.PrivateKey, rand io.Reader) (err error)
- func Encrypt(pubKey *elgamal.PublicKey, input []byte) ([]byte, error)
- func GenerateKeys() (*elgamal.PrivateKey, *elgamal.PublicKey, error)
- type Decrypter
- type ElgPrivateKey
- type ElgPublicKey
- type ElgamalEncryption
- type Encrypter
- type PrivateEncryptionKey
- type PublicEncryptionKey
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Decrypt ¶
func Decrypt(privKey *elgamal.PrivateKey, d []byte) ([]byte, error)
Decrypt decrypts byte slice with elgamal private key.
func ElgamalGenerate ¶
func ElgamalGenerate(priv *elgamal.PrivateKey, rand io.Reader) (err error)
ElgamalGenerate generate an elgamal key pair.
func GenerateKeys ¶
func GenerateKeys() (*elgamal.PrivateKey, *elgamal.PublicKey, error)
GenerateKeys returns elgamal private-public keys pair.
Types ¶
type Decrypter ¶
type Decrypter interface { // Decrypt decrypt a block of data. // return decrypted block or nil and error if error happens. Decrypt(data []byte) ([]byte, error) }
Decrypter decrypts data.
type ElgPrivateKey ¶
type ElgPrivateKey [256]byte
ElgPrivateKey is elgamal private key.
func (ElgPrivateKey) Len ¶
func (elg ElgPrivateKey) Len() int
Len returns elgamal private key length.
func (ElgPrivateKey) NewDecrypter ¶
func (elg ElgPrivateKey) NewDecrypter() (Decrypter, error)
NewDecrypter is decryptor constructor.
type ElgPublicKey ¶
type ElgPublicKey [256]byte
ElgPublicKey is elgamal public key.
func (ElgPublicKey) NewEncrypter ¶
func (elg ElgPublicKey) NewEncrypter() (Encrypter, error)
NewEncrypter is encryptor constructor.
type ElgamalEncryption ¶
type ElgamalEncryption struct {
// contains filtered or unexported fields
}
ElgamalEncryption is elgamal encryption struct.
func (*ElgamalEncryption) Encrypt ¶
func (elg *ElgamalEncryption) Encrypt(data []byte) ([]byte, error)
Encrypt encrypts input byte slice.
func (*ElgamalEncryption) EncryptPadding ¶
func (elg *ElgamalEncryption) EncryptPadding(data []byte, zeroPadding bool) ([]byte, error)
EncryptPadding encrypts input byte slice.
type Encrypter ¶
type Encrypter interface { // encrypt a block of data. // return encrypted block or nil and error if an error happened. Encrypt(data []byte) ([]byte, error) }
Encrypter encrypts data.
type PrivateEncryptionKey ¶
type PrivateEncryptionKey interface { // NewDecrypter create a new decryption object for this private key to decrypt data encrypted to our public key. // returns decrypter or nil and error if the private key is in a bad format. NewDecrypter() (Decrypter, error) }
PrivateEncryptionKey is interface for producing decrypter.
type PublicEncryptionKey ¶
type PublicEncryptionKey interface { // NewEncrypter returns a new encrypter to encrypt data to this public key. NewEncrypter() (Encrypter, error) // Len returns length of this public key in bytes. Len() int }
PublicEncryptionKey is interface for public encryption key.
Click to show internal directories.
Click to hide internal directories.