package cryptoimport ()// RC4HMAC implements Kerberos encryption type rc4-hmactypeRC4HMACstruct {}// GetETypeID returns the EType ID number.func ( RC4HMAC) () int32 {returnetypeID.RC4_HMAC}// GetHashID returns the checksum type ID number.func ( RC4HMAC) () int32 {returnchksumtype.KERB_CHECKSUM_HMAC_MD5}// GetKeyByteSize returns the number of bytes for key of this etype.func ( RC4HMAC) () int {return16}// GetKeySeedBitLength returns the number of bits for the seed for key generation.func ( RC4HMAC) () int {return .GetKeyByteSize() * 8}// GetHashFunc returns the hash function for this etype.func ( RC4HMAC) () func() hash.Hash {returnmd5.New}// GetMessageBlockByteSize returns the block size for the etype's messages.func ( RC4HMAC) () int {return1}// GetDefaultStringToKeyParams returns the default key derivation parameters in string form.func ( RC4HMAC) () string {return""}// GetConfounderByteSize returns the byte count for confounder to be used during cryptographic operations.func ( RC4HMAC) () int {return8}// GetHMACBitLength returns the bit count size of the integrity hash.func ( RC4HMAC) () int {returnmd5.Size * 8}// GetCypherBlockBitLength returns the bit count size of the cypher block.func ( RC4HMAC) () int {return8// doesn't really apply}// StringToKey returns a key derived from the string provided.func ( RC4HMAC) ( string, string, string) ([]byte, error) {returnrfc4757.StringToKey()}// RandomToKey returns a key from the bytes provided.func ( RC4HMAC) ( []byte) []byte { := bytes.NewReader() := md4.New()io.Copy(, )return .Sum(nil)}// EncryptData encrypts the data provided.func ( RC4HMAC) (, []byte) ([]byte, []byte, error) { , := rfc4757.EncryptData(, , )return []byte{}, , }// EncryptMessage encrypts the message provided and concatenates it with the integrity hash to create an encrypted message.func ( RC4HMAC) (, []byte, uint32) ([]byte, []byte, error) { , := rfc4757.EncryptMessage(, , , false, )return []byte{}, , }// DecryptData decrypts the data provided.func ( RC4HMAC) (, []byte) ([]byte, error) {returnrfc4757.DecryptData(, , )}// DecryptMessage decrypts the message provided and verifies the integrity of the message.func ( RC4HMAC) (, []byte, uint32) ([]byte, error) {returnrfc4757.DecryptMessage(, , , false, )}// DeriveKey derives a key from the protocol key based on the usage value.func ( RC4HMAC) (, []byte) ([]byte, error) {returnrfc4757.HMAC(, ), nil}// DeriveRandom generates data needed for key generation.func ( RC4HMAC) (, []byte) ([]byte, error) {returnrfc3961.DeriveRandom(, , )}// VerifyIntegrity checks the integrity of the plaintext message.func ( RC4HMAC) (, , []byte, uint32) bool {returnrfc4757.VerifyIntegrity(, , , )}// GetChecksumHash returns a keyed checksum hash of the bytes provided.func ( RC4HMAC) (, []byte, uint32) ([]byte, error) {returnrfc4757.Checksum(, , )}// VerifyChecksum compares the checksum of the message bytes is the same as the checksum provided.func ( RC4HMAC) (, , []byte, uint32) bool { , := rfc4757.Checksum(, , )if != nil {returnfalse }returnhmac.Equal(, )}
The pages are generated with Goldsv0.6.7. (GOOS=linux GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu.
PR and bug reports are welcome and can be submitted to the issue list.
Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds.