Pragya Arya | 324337e | 2020-02-20 14:35:08 +0530 | [diff] [blame^] | 1 | // Package etype provides the Kerberos Encryption Type interface |
| 2 | package etype |
| 3 | |
| 4 | import "hash" |
| 5 | |
| 6 | // EType is the interface defining the Encryption Type. |
| 7 | type EType interface { |
| 8 | GetETypeID() int32 |
| 9 | GetHashID() int32 |
| 10 | GetKeyByteSize() int |
| 11 | GetKeySeedBitLength() int // key-generation seed length, k |
| 12 | GetDefaultStringToKeyParams() string // default string-to-key parameters (s2kparams) |
| 13 | StringToKey(string, salt, s2kparams string) ([]byte, error) // string-to-key (UTF-8 string, UTF-8 string, opaque)->(protocol-key) |
| 14 | RandomToKey(b []byte) []byte // random-to-key (bitstring[K])->(protocol-key) |
| 15 | GetHMACBitLength() int // HMAC output size, h |
| 16 | GetMessageBlockByteSize() int // message block size, m |
| 17 | EncryptData(key, data []byte) ([]byte, []byte, error) // E function - encrypt (specific-key, state, octet string)->(state, octet string) |
| 18 | EncryptMessage(key, message []byte, usage uint32) ([]byte, []byte, error) |
| 19 | DecryptData(key, data []byte) ([]byte, error) // D function |
| 20 | DecryptMessage(key, ciphertext []byte, usage uint32) ([]byte, error) |
| 21 | GetCypherBlockBitLength() int // cipher block size, c |
| 22 | GetConfounderByteSize() int // This is the same as the cipher block size but in bytes. |
| 23 | DeriveKey(protocolKey, usage []byte) ([]byte, error) // DK key-derivation (protocol-key, integer)->(specific-key) |
| 24 | DeriveRandom(protocolKey, usage []byte) ([]byte, error) // DR pseudo-random (protocol-key, octet-string)->(octet-string) |
| 25 | VerifyIntegrity(protocolKey, ct, pt []byte, usage uint32) bool |
| 26 | GetChecksumHash(protocolKey, data []byte, usage uint32) ([]byte, error) |
| 27 | VerifyChecksum(protocolKey, data, chksum []byte, usage uint32) bool |
| 28 | GetHashFunc() func() hash.Hash |
| 29 | } |