Documentation
¶
Overview ¶
Package kipher implements standard block cipher modes that can be wrapped around low-level block cipher implementations.
See NIST SP 800-38A, NIST SP 800-38B, NIST SP 800-38D
Index ¶
- func NewCBCDecrypter(b cipher.Block, iv []byte) cipher.BlockMode
- func NewCBCEncrypter(b cipher.Block, iv []byte) cipher.BlockMode
- func NewCCM(b cipher.Block, nonceSize, tagSize int) (cipher.AEAD, error)
- func NewCFBDecrypter(block cipher.Block, iv []byte) cipher.Stream
- func NewCFBDecrypterWithBlockSize(block cipher.Block, iv []byte, cfbBlockByteSize int) cipher.Stream
- func NewCFBEncrypter(block cipher.Block, iv []byte) cipher.Stream
- func NewCFBEncrypterWithBlockSize(block cipher.Block, iv []byte, cfbBlockByteSize int) cipher.Stream
- func NewCTR(block cipher.Block, iv []byte) cipher.Stream
- func NewECBDecryptor(b cipher.Block) cipher.BlockMode
- func NewECBEncryptor(b cipher.Block) cipher.BlockMode
- func NewGCM(b cipher.Block) (cipher.AEAD, error)
- func NewGCMWithNonceSize(b cipher.Block, size int) (cipher.AEAD, error)
- func NewGCMWithSize(b cipher.Block, nonceSize, tagSize int) (cipher.AEAD, error)
- func NewGCMWithTagSize(b cipher.Block, tagSize int) (cipher.AEAD, error)
- func NewOFB(b cipher.Block, iv []byte) cipher.Stream
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewCBCDecrypter ¶
NewCBCDecrypter returns a BlockMode which decrypts in cipher block chaining mode, using the given Block. The length of iv must be the same as the Block's block size and must match the iv used to encrypt the data.
func NewCBCEncrypter ¶
NewCBCEncrypter returns a BlockMode which encrypts in cipher block chaining mode, using the given Block. The length of iv must be the same as the Block's block size.
func NewCFBDecrypter ¶
NewCFB8Decrypter returns a Stream which decrypts with cipher feedback mode, using the given Block. The iv must be the same length as the Block's block size.
func NewCFBEncrypter ¶
NewCFBEncrypter returns a Stream which encrypts with cipher feedback mode, using the given Block. The iv must be the same length as the Block's block size.
func NewCTR ¶
NewCTR returns a Stream which encrypts/decrypts using the given Block in counter mode. The length of iv must be the same as the Block's block size.
func NewGCM ¶
NewGCM returns the given 128-bit, block cipher wrapped in Galois Counter Mode with the standard nonce length.
In general, the GHASH operation performed by this implementation of GCM is not constant-time. An exception is when the underlying Block was created by aes.NewCipher on systems with hardware support for AES. See the crypto/aes package documentation for details.
func NewGCMWithNonceSize ¶
NewGCMWithNonceSize returns the given 128-bit, block cipher wrapped in Galois Counter Mode, which accepts nonces of the given length. The length must not be zero.
Only use this function if you require compatibility with an existing cryptosystem that uses non-standard nonce lengths. All other users should use NewGCM, which is faster and more resistant to misuse.
func NewGCMWithSize ¶
NewGCM returns the given 128-bit, block cipher wrapped in Galois Counter Mode with the standard nonce length.
In general, the GHASH operation performed by this implementation of GCM is not constant-time. An exception is when the underlying Block was created by aes.NewCipher on systems with hardware support for AES. See the crypto/aes package documentation for details.
if nonceSize = 0, nonceSize = 12 if tagSize = 0, tagSize = 16
func NewGCMWithTagSize ¶
NewGCMWithTagSize returns the given 128-bit, block cipher wrapped in Galois Counter Mode, which generates tags with the given length.
Tag sizes between 1 and 16 bytes are allowed.
Only use this function if you require compatibility with an existing cryptosystem that uses non-standard tag lengths. All other users should use NewGCM, which is more resistant to misuse.
Types ¶
This section is empty.