etype.go 1.8 KB

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