Documentation
¶
Overview ¶
Package aead provides authenticated encryption with associated data
Index ¶
- type AEAD
- type AES256GCMImpl
- type AeadID
- type ChaCha20Poly1305Impl
- func (c *ChaCha20Poly1305Impl) KeySize() int
- func (c *ChaCha20Poly1305Impl) NonceSize() int
- func (c *ChaCha20Poly1305Impl) Open(dst, nonce, ciphertext, aad []byte) ([]byte, error)
- func (c *ChaCha20Poly1305Impl) Overhead() int
- func (c *ChaCha20Poly1305Impl) Seal(dst, nonce, plaintext, aad []byte) []byte
- type NonceGenerator
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AEAD ¶
type AEAD interface {
// Seal encrypts and authenticates plaintext
Seal(dst, nonce, plaintext, aad []byte) []byte
// Open decrypts and authenticates ciphertext
Open(dst, nonce, ciphertext, aad []byte) ([]byte, error)
// NonceSize returns the nonce size in bytes
NonceSize() int
// Overhead returns the authentication tag size
Overhead() int
// KeySize returns the key size in bytes
KeySize() int
}
AEAD interface for authenticated encryption
func NewAES256GCM ¶
NewAES256GCM creates a new AES-256-GCM instance
func NewChaCha20Poly1305 ¶
NewChaCha20Poly1305 creates a new ChaCha20-Poly1305 instance
type AES256GCMImpl ¶
type AES256GCMImpl struct {
// contains filtered or unexported fields
}
AES256GCMImpl implements AES-256-GCM
func (*AES256GCMImpl) KeySize ¶
func (a *AES256GCMImpl) KeySize() int
KeySize returns 256-bit key size
func (*AES256GCMImpl) NonceSize ¶
func (a *AES256GCMImpl) NonceSize() int
NonceSize returns 96-bit nonce size for GCM
func (*AES256GCMImpl) Open ¶
func (a *AES256GCMImpl) Open(dst, nonce, ciphertext, aad []byte) ([]byte, error)
Open decrypts and authenticates ciphertext
func (*AES256GCMImpl) Overhead ¶
func (a *AES256GCMImpl) Overhead() int
Overhead returns 128-bit tag size
func (*AES256GCMImpl) Seal ¶
func (a *AES256GCMImpl) Seal(dst, nonce, plaintext, aad []byte) []byte
Seal encrypts and authenticates plaintext
type ChaCha20Poly1305Impl ¶
type ChaCha20Poly1305Impl struct {
// contains filtered or unexported fields
}
ChaCha20Poly1305Impl implements ChaCha20-Poly1305
func (*ChaCha20Poly1305Impl) KeySize ¶
func (c *ChaCha20Poly1305Impl) KeySize() int
KeySize returns 256-bit key size
func (*ChaCha20Poly1305Impl) NonceSize ¶
func (c *ChaCha20Poly1305Impl) NonceSize() int
NonceSize returns 96-bit nonce size
func (*ChaCha20Poly1305Impl) Open ¶
func (c *ChaCha20Poly1305Impl) Open(dst, nonce, ciphertext, aad []byte) ([]byte, error)
Open decrypts and authenticates ciphertext
func (*ChaCha20Poly1305Impl) Overhead ¶
func (c *ChaCha20Poly1305Impl) Overhead() int
Overhead returns 128-bit tag size
func (*ChaCha20Poly1305Impl) Seal ¶
func (c *ChaCha20Poly1305Impl) Seal(dst, nonce, plaintext, aad []byte) []byte
Seal encrypts and authenticates plaintext
type NonceGenerator ¶
type NonceGenerator struct {
// contains filtered or unexported fields
}
NonceGenerator generates deterministic nonces for stream-based protocols
func NewNonceGenerator ¶
func NewNonceGenerator(streamID uint32) *NonceGenerator
NewNonceGenerator creates a new nonce generator
func (*NonceGenerator) GetSeqNo ¶
func (ng *NonceGenerator) GetSeqNo() uint64
GetSeqNo returns the current sequence number
func (*NonceGenerator) Next ¶
func (ng *NonceGenerator) Next() []byte
Next returns the next nonce and increments sequence number
func (*NonceGenerator) SetSeqNo ¶
func (ng *NonceGenerator) SetSeqNo(seqNo uint64)
SetSeqNo sets the sequence number (for resumption)