Documentation ¶
Index ¶
- Constants
- func GetSealedSize(plaintextLen int) int
- func NewDecodingReader(encKey SecretboxKey, verifyKey VerifyKey, nonce Nonce, innerReader io.Reader) io.Reader
- func NewEncodingReader(encKey SecretboxKey, signKey SignKey, nonce Nonce, innerReader io.Reader) io.Reader
- func NewError(errorType ErrorType, message string, args ...interface{}) error
- func OpenWhole(sealed []byte, encKey SecretboxKey, verifyKey VerifyKey, nonce Nonce) ([]byte, error)
- func SealWhole(plaintext []byte, encKey SecretboxKey, signKey SignKey, nonce Nonce) []byte
- type Decoder
- type Encoder
- type Error
- type ErrorType
- type Nonce
- type SecretboxKey
- type SecretboxNonce
- type SignKey
- type VerifyKey
Constants ¶
const DefaultPlaintextChunkLength = 1 << 20
const NonceSize = 16
const SecretboxKeySize = 32
const SecretboxNonceSize = 24
const SignaturePrefix = libkb.SignaturePrefixChatAttachment + "\x00"
Variables ¶
This section is empty.
Functions ¶
func GetSealedSize ¶
func NewDecodingReader ¶
func NewEncodingReader ¶
Types ¶
type Decoder ¶
type Decoder struct {
// contains filtered or unexported fields
}
func NewDecoder ¶
func NewDecoder(encKey SecretboxKey, verifyKey VerifyKey, nonce Nonce) *Decoder
func (*Decoder) ChangePlaintextChunkLenForTesting ¶
func (*Decoder) Finish ¶
Finish decodes any remaining bytes as a short (or empty) packet. This produces the final bytes of the plaintext, and implicitly checks for truncation. This should only be called once, and after that you can't use this decoder again.
func (*Decoder) Write ¶
Write ciphertext bytes into the decoder. If any packets are ready to open, open them and either return their plaintext bytes as output or any error that comes up. Callers must call Finish() when they're done, to decode the final short packet and check for truncation. If Write ever returns an error, subsequent calls to Write will always return the same error.
type Encoder ¶
type Encoder struct {
// contains filtered or unexported fields
}
func NewEncoder ¶
func NewEncoder(encKey SecretboxKey, signKey SignKey, nonce Nonce) *Encoder
func (*Encoder) ChangePlaintextChunkLenForTesting ¶
func (*Encoder) Finish ¶
Finish writes out any remaining buffered input bytes (possibly zero bytes) as a short chunk. This should only be called once, and after that you can't use this encoder again.
func (*Encoder) Write ¶
Write plaintext bytes into the encoder. If any output bytes are ready, return them. Callers must call Finish() when they're done, so that any remaining input bytes can be written out as a short (or empty) chunk. Otherwise you will both lose data and cause truncation errors on decoding.
type SecretboxKey ¶
type SecretboxKey *[SecretboxKeySize]byte
type SecretboxNonce ¶
type SecretboxNonce *[SecretboxNonceSize]byte
type SignKey ¶
type SignKey *[ed25519.PrivateKeySize]byte
type VerifyKey ¶
type VerifyKey *[ed25519.PublicKeySize]byte