Documentation ¶
Overview ¶
Package rfc3961 provides encryption and checksum methods as specified in RFC 3961
Index ¶
- func DES3DecryptData(key, data []byte, e etype.EType) ([]byte, error)
- func DES3DecryptMessage(key, ciphertext []byte, usage uint32, e etype.EType) ([]byte, error)
- func DES3EncryptData(key, data []byte, e etype.EType) ([]byte, []byte, error)
- func DES3EncryptMessage(key, message []byte, usage uint32, e etype.EType) ([]byte, []byte, error)
- func DES3RandomToKey(b []byte) []byte
- func DES3StringToKey(secret, salt string, e etype.EType) ([]byte, error)
- func DeriveKey(protocolKey, usage []byte, e etype.EType) ([]byte, error)
- func DeriveRandom(key, usage []byte, e etype.EType) ([]byte, error)
- func Nfold(m []byte, n int) []byte
- func PseudoRandom(key, b []byte, e etype.EType) ([]byte, error)
- func RandomToKey(b []byte) []byte
- func VerifyIntegrity(key, ct, pt []byte, usage uint32, etype etype.EType) bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DES3DecryptData ¶
DES3DecryptData decrypts the data provided using DES3 and methods specific to the etype provided.
func DES3DecryptMessage ¶
DES3DecryptMessage decrypts the message provided using DES3 and methods specific to the etype provided. The integrity of the message is also verified.
func DES3EncryptData ¶
DES3EncryptData encrypts the data provided using DES3 and methods specific to the etype provided.
func DES3EncryptMessage ¶
DES3EncryptMessage encrypts the message provided using DES3 and methods specific to the etype provided. The encrypted data is concatenated with its integrity hash to create an encrypted message.
func DES3RandomToKey ¶
DES3RandomToKey returns a key from the bytes provided according to the definition in RFC 3961 for DES3 etypes.
func DES3StringToKey ¶
DES3StringToKey returns a key derived from the string provided according to the definition in RFC 3961 for DES3 etypes.
func DeriveKey ¶
DeriveKey derives a key from the protocol key based on the usage and the etype's specific methods.
func DeriveRandom ¶
DeriveRandom implements the RFC 3961 defined function: DR(Key, Constant) = k-truncate(E(Key, Constant, initial-cipher-state)).
key: base key or protocol key. Likely to be a key from a keytab file.
usage: a constant.
n: block size in bits (not bytes) - note if you use something like aes.BlockSize this is in bytes.
k: key length / key seed length in bits. Eg. for AES256 this value is 256.
e: the encryption etype function to use.
func Nfold ¶
Nfold expands the key to ensure it is not smaller than one cipher block. Defined in RFC 3961.
m input bytes that will be "stretched" to the least common multiple of n bits and the bit length of m.
func PseudoRandom ¶
PseudoRandom function as defined in RFC 3961
func RandomToKey ¶
RandomToKey returns a key from the bytes provided according to the definition in RFC 3961.
Types ¶
This section is empty.