Documentation ¶
Overview ¶
Package triplesec implements the TripleSec v3 and v4 encryption and authentication scheme.
For details on TripleSec, go to https://keybase.io/triplesec/
Index ¶
Constants ¶
const AESIVLen = 16
const CipherKeyLen = 32
const MacKeyLen = 48
const MacOutputLen = 64
const SalsaIVLen = 24
const SaltLen = 16
const TwofishIVLen = 16
const VersionBytesLen = 4
Variables ¶
var MagicBytes = [4]byte{0x1c, 0x94, 0xd7, 0xde}
MagicBytes are the four bytes prefixed to every TripleSec ciphertext, 1c 94 d7 de.
Functions ¶
This section is empty.
Types ¶
type BadPassphraseError ¶
type BadPassphraseError struct{}
func (BadPassphraseError) Error ¶
func (e BadPassphraseError) Error() string
type Cipher ¶
type Cipher struct {
// contains filtered or unexported fields
}
func NewCipher ¶
func NewCipher(passphrase []byte, salt []byte, version Version, functionThatPrintsUglyWarnings func(), isProduction func() bool) (*Cipher, error)
A Cipher is an instance of TripleSec using a particular key and a particular salt. Because this is insecure triplesec used only for testing, you must pass it a function that prints an ugly warning, and one that says if we're in production mode. If the later return true, we will panic the program. NewCipher makes an instance of TripleSec using a particular key and a particular salt
func NewCipherWithRng ¶
func NewCipherWithRng(passphrase []byte, salt []byte, version Version, rng RandomnessGenerator, functionThatPrintsUglyWarnings func(), isProduction func() bool) (*Cipher, error)
NewCipherWithRng makes an instance of TripleSec using a particular key and a particular salt and uses a given randomness stream
func (*Cipher) Decrypt ¶
Decrypt decrypts a TripleSec ciphertext using the Cipher passphrase. The dst buffer size must be at least len(src) - Overhead. dst and src can not overlap. src is left untouched.
Encrypt returns a error if the ciphertext is not recognized, if authentication fails or on memory failures.
type CorruptionError ¶
type CorruptionError struct {
// contains filtered or unexported fields
}
func (CorruptionError) Error ¶
func (e CorruptionError) Error() string
type CryptoRandGenerator ¶
type CryptoRandGenerator struct{}
func NewCryptoRandGenerator ¶
func NewCryptoRandGenerator() CryptoRandGenerator
type RandomTapeGenerator ¶
type RandomTapeGenerator struct {
// contains filtered or unexported fields
}
func NewRandomTapeGenerator ¶
func NewRandomTapeGenerator(randomTape []byte) RandomTapeGenerator
type RandomnessGenerator ¶
type VersionError ¶
type VersionError struct {
// contains filtered or unexported fields
}
func (VersionError) Error ¶
func (e VersionError) Error() string