package aes
import "crypto/internal/fips140/aes"
Index ¶
- Constants
- func EncryptBlockInternal(c *Block, dst, src []byte)
- func EncryptionKeySchedule(c *Block) []uint32
- func RoundToBlock(c *CTR)
- type Block
- func New(key []byte) (*Block, error)
- func (c *Block) BlockSize() int
- func (c *Block) Decrypt(dst, src []byte)
- func (c *Block) Encrypt(dst, src []byte)
- type CBCDecrypter
- func NewCBCDecrypter(b *Block, iv [BlockSize]byte) *CBCDecrypter
- func (c *CBCDecrypter) BlockSize() int
- func (c *CBCDecrypter) CryptBlocks(dst, src []byte)
- func (x *CBCDecrypter) SetIV(iv []byte)
- type CBCEncrypter
- func NewCBCEncrypter(b *Block, iv [BlockSize]byte) *CBCEncrypter
- func (c *CBCEncrypter) BlockSize() int
- func (c *CBCEncrypter) CryptBlocks(dst, src []byte)
- func (x *CBCEncrypter) SetIV(iv []byte)
- type CTR
- func NewCTR(b *Block, iv []byte) *CTR
- func (c *CTR) XORKeyStream(dst, src []byte)
- func (c *CTR) XORKeyStreamAt(dst, src []byte, offset uint64)
- type KeySizeError
Constants ¶
const BlockSize = 16
BlockSize is the AES block size in bytes.
Functions ¶
func EncryptBlockInternal ¶
EncryptBlockInternal applies the AES encryption function to one block.
It is an internal function meant only for the gcm package.
func EncryptionKeySchedule ¶
EncryptionKeySchedule is used from the GCM implementation to access the precomputed AES key schedule, to pass to the assembly implementation.
func RoundToBlock ¶
func RoundToBlock(c *CTR)
RoundToBlock is used by CTR_DRBG, which discards the rightmost unused bits at each request. It rounds the offset up to the next block boundary.
Types ¶
type Block ¶
type Block struct {
// contains filtered or unexported fields
}
A Block is an instance of AES using a particular key. It is safe for concurrent use.
func New ¶
New creates and returns a new [cipher.Block] implementation. The key argument should be the AES key, either 16, 24, or 32 bytes to select AES-128, AES-192, or AES-256.
func (*Block) BlockSize ¶
func (*Block) Decrypt ¶
func (*Block) Encrypt ¶
type CBCDecrypter ¶
type CBCDecrypter struct {
// contains filtered or unexported fields
}
func NewCBCDecrypter ¶
func NewCBCDecrypter(b *Block, iv [BlockSize]byte) *CBCDecrypter
NewCBCDecrypter returns a [cipher.BlockMode] which decrypts in cipher block chaining mode, using the given Block.
func (*CBCDecrypter) BlockSize ¶
func (c *CBCDecrypter) BlockSize() int
func (*CBCDecrypter) CryptBlocks ¶
func (c *CBCDecrypter) CryptBlocks(dst, src []byte)
func (*CBCDecrypter) SetIV ¶
func (x *CBCDecrypter) SetIV(iv []byte)
type CBCEncrypter ¶
type CBCEncrypter struct {
// contains filtered or unexported fields
}
func NewCBCEncrypter ¶
func NewCBCEncrypter(b *Block, iv [BlockSize]byte) *CBCEncrypter
NewCBCEncrypter returns a [cipher.BlockMode] which encrypts in cipher block chaining mode, using the given Block.
func (*CBCEncrypter) BlockSize ¶
func (c *CBCEncrypter) BlockSize() int
func (*CBCEncrypter) CryptBlocks ¶
func (c *CBCEncrypter) CryptBlocks(dst, src []byte)
func (*CBCEncrypter) SetIV ¶
func (x *CBCEncrypter) SetIV(iv []byte)
type CTR ¶
type CTR struct {
// contains filtered or unexported fields
}
func NewCTR ¶
func (*CTR) XORKeyStream ¶
func (*CTR) XORKeyStreamAt ¶
XORKeyStreamAt behaves like XORKeyStream but keeps no state, and instead seeks into the keystream by the given bytes offset from the start (ignoring any XORKetStream calls). This allows for random access into the keystream, up to 16 EiB from the start.
type KeySizeError ¶
type KeySizeError int
func (KeySizeError) Error ¶
func (k KeySizeError) Error() string
Source Files ¶
aes.go aes_asm.go aes_generic.go cast.go cbc.go cbc_noasm.go const.go ctr.go ctr_asm.go
Directories ¶
- Version
- v1.24.0 (latest)
- Published
- Feb 10, 2025
- Platform
- linux/amd64
- Imports
- 12 packages
- Last checked
- 12 minutes ago –
Tools for package owners.