Namespace: go.std.crypto.cipher
v1.0Contents
Summary
Provides a low-level interface to the crypto/cipher package.
Package cipher implements standard block cipher modes that can be wrapped
around low-level block cipher implementations.
See https://csrc.nist.gov/groups/ST/toolkit/BCM/current_modes.html
and NIST Special Publication 800-38A.
Index
- *StreamReader
- *StreamWriter
- AEAD
- Block
- BlockMode
- NewCBCDecrypter
- NewCBCEncrypter
- NewCFBDecrypter
- NewCFBEncrypter
- NewCTR
- NewGCM
- NewGCMWithNonceSize
- NewGCMWithTagSize
- NewOFB
- Stream
- StreamReader
- StreamWriter
- arrayOfAEAD
- arrayOfBlock
- arrayOfBlockMode
- arrayOfStream
- arrayOfStreamReader
- arrayOfStreamWriter
Legend
-
Constant
Variable
Function
Macro
Special form
Type
GoVar
Receiver/Method
Constants
Constants are variables with :const true in their metadata. Joker currently does not recognize them as special; as such, it allows redefining them or their values.-
(None.)
Variables
-
(None.)
Functions, Macros, and Special Forms
-
NewCBCDecrypter
Function v1.0(NewCBCDecrypter b iv)
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.
Go input arguments: (b Block, iv []byte)
Go returns: BlockMode
Joker input arguments: [^Block b, ^arrayOfByte iv]
Joker returns: ^BlockMode -
NewCBCEncrypter
Function v1.0(NewCBCEncrypter b iv)
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.
Go input arguments: (b Block, iv []byte)
Go returns: BlockMode
Joker input arguments: [^Block b, ^arrayOfByte iv]
Joker returns: ^BlockMode -
NewCFBDecrypter
Function v1.0(NewCFBDecrypter block iv)
NewCFBDecrypter 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.
Go input arguments: (block Block, iv []byte)
Go returns: Stream
Joker input arguments: [^Block block, ^arrayOfByte iv]
Joker returns: ^Stream -
NewCFBEncrypter
Function v1.0(NewCFBEncrypter block iv)
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.
Go input arguments: (block Block, iv []byte)
Go returns: Stream
Joker input arguments: [^Block block, ^arrayOfByte iv]
Joker returns: ^Stream -
NewCTR
Function v1.0(NewCTR block iv)
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.
Go input arguments: (block Block, iv []byte)
Go returns: Stream
Joker input arguments: [^Block block, ^arrayOfByte iv]
Joker returns: ^Stream -
NewGCM
Function v1.0(NewGCM cipher)
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.
Go input arguments: (cipher Block)
Go returns: (AEAD, error)
Joker input arguments: [^Block cipher]
Joker returns: [^AEAD, ^Error] -
NewGCMWithNonceSize
Function v1.0(NewGCMWithNonceSize cipher size)
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.
Go input arguments: (cipher Block, size int)
Go returns: (AEAD, error)
Joker input arguments: [^Block cipher, ^Int size]
Joker returns: [^AEAD, ^Error] -
NewGCMWithTagSize
Function v1.0(NewGCMWithTagSize cipher tagSize)
NewGCMWithTagSize returns the given 128-bit, block cipher wrapped in Galois
Counter Mode, which generates tags with the given length.
Tag sizes between 12 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.
Go input arguments: (cipher Block, tagSize int)
Go returns: (AEAD, error)
Joker input arguments: [^Block cipher, ^Int tagSize]
Joker returns: [^AEAD, ^Error] -
NewOFB
Function v1.0(NewOFB b iv)
NewOFB returns a Stream that encrypts or decrypts using the block cipher b
in output feedback mode. The initialization vector iv's length must be equal
to b's block size.
Go input arguments: (b Block, iv []byte)
Go returns: Stream
Joker input arguments: [^Block b, ^arrayOfByte iv]
Joker returns: ^Stream
Types
-
*StreamReader
Concrete Type v1.0StreamReader wraps a Stream into an io.Reader. It calls XORKeyStream
to process each slice of data which passes through.
-
*StreamWriter
Concrete Type v1.0StreamWriter wraps a Stream into an io.Writer. It calls XORKeyStream
to process each slice of data which passes through. If any Write call
returns short then the StreamWriter is out of sync and must be discarded.
A StreamWriter has no internal buffering; Close does not need
to be called to flush write data.
-
AEAD
Abstract Type v1.0AEAD is a cipher mode providing authenticated encryption with associated
data. For a description of the methodology, see
https://en.wikipedia.org/wiki/Authenticated_encryption.
-
NonceSize
Method for AEAD v1.0([])
-
Open
Method for AEAD v1.0([dst nonce ciphertext additionalData])
-
Overhead
Method for AEAD v1.0([])
-
Seal
Method for AEAD v1.0([dst nonce plaintext additionalData])
-
Block
Abstract Type v1.0A Block represents an implementation of block cipher
using a given key. It provides the capability to encrypt
or decrypt individual blocks. The mode implementations
extend that capability to streams of blocks.
-
BlockSize
Method for Block v1.0([])
-
Decrypt
Method for Block v1.0([dst src])
-
Encrypt
Method for Block v1.0([dst src])
-
BlockMode
Abstract Type v1.0A BlockMode represents a block cipher running in a block-based mode (CBC,
ECB etc).
-
BlockSize
Method for BlockMode v1.0([])
-
CryptBlocks
Method for BlockMode v1.0([dst src])
-
Stream
Abstract Type v1.0A Stream represents a stream cipher.
-
XORKeyStream
Method for Stream v1.0([dst src])
-
StreamReader
Concrete Type v1.0StreamReader wraps a Stream into an io.Reader. It calls XORKeyStream
to process each slice of data which passes through.
-
Read
Receiver for StreamReader v1.0([dst])
-
StreamWriter
Concrete Type v1.0StreamWriter wraps a Stream into an io.Writer. It calls XORKeyStream
to process each slice of data which passes through. If any Write call
returns short then the StreamWriter is out of sync and must be discarded.
A StreamWriter has no internal buffering; Close does not need
to be called to flush write data.
-
Close
Receiver for StreamWriter v1.0([])
Close closes the underlying Writer and returns its Close return value, if the Writer
is also an io.Closer. Otherwise it returns nil.
-
Write
Receiver for StreamWriter v1.0([src])
-
arrayOfAEAD
Concrete Type v1.0AEAD is a cipher mode providing authenticated encryption with associated
data. For a description of the methodology, see
https://en.wikipedia.org/wiki/Authenticated_encryption.
-
arrayOfBlock
Concrete Type v1.0A Block represents an implementation of block cipher
using a given key. It provides the capability to encrypt
or decrypt individual blocks. The mode implementations
extend that capability to streams of blocks.
-
arrayOfBlockMode
Concrete Type v1.0A BlockMode represents a block cipher running in a block-based mode (CBC,
ECB etc).
-
arrayOfStream
Concrete Type v1.0A Stream represents a stream cipher.
-
arrayOfStreamReader
Concrete Type v1.0StreamReader wraps a Stream into an io.Reader. It calls XORKeyStream
to process each slice of data which passes through.
-
arrayOfStreamWriter
Concrete Type v1.0StreamWriter wraps a Stream into an io.Writer. It calls XORKeyStream
to process each slice of data which passes through. If any Write call
returns short then the StreamWriter is out of sync and must be discarded.
A StreamWriter has no internal buffering; Close does not need
to be called to flush write data.