package crypto

import (
	
	
	
	
	

	
	
	
	
	
)

// RC4HMAC implements Kerberos encryption type rc4-hmac
type RC4HMAC struct {
}

// GetETypeID returns the EType ID number.
func ( RC4HMAC) () int32 {
	return etypeID.RC4_HMAC
}

// GetHashID returns the checksum type ID number.
func ( RC4HMAC) () int32 {
	return chksumtype.KERB_CHECKSUM_HMAC_MD5
}

// GetKeyByteSize returns the number of bytes for key of this etype.
func ( RC4HMAC) () int {
	return 16
}

// 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 {
	return md5.New
}

// GetMessageBlockByteSize returns the block size for the etype's messages.
func ( RC4HMAC) () int {
	return 1
}

// 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 {
	return 8
}

// GetHMACBitLength returns the bit count size of the integrity hash.
func ( RC4HMAC) () int {
	return md5.Size * 8
}

// GetCypherBlockBitLength returns the bit count size of the cypher block.
func ( RC4HMAC) () int {
	return 8 // doesn't really apply
}

// StringToKey returns a key derived from the string provided.
func ( RC4HMAC) ( string,  string,  string) ([]byte, error) {
	return rfc4757.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) {
	return rfc4757.DecryptData(, , )
}

// DecryptMessage decrypts the message provided and verifies the integrity of the message.
func ( RC4HMAC) (,  []byte,  uint32) ([]byte, error) {
	return rfc4757.DecryptMessage(, , , false, )
}

// DeriveKey derives a key from the protocol key based on the usage value.
func ( RC4HMAC) (,  []byte) ([]byte, error) {
	return rfc4757.HMAC(, ), nil
}

// DeriveRandom generates data needed for key generation.
func ( RC4HMAC) (,  []byte) ([]byte, error) {
	return rfc3961.DeriveRandom(, , )
}

// VerifyIntegrity checks the integrity of the plaintext message.
func ( RC4HMAC) (, ,  []byte,  uint32) bool {
	return rfc4757.VerifyIntegrity(, , , )
}

// GetChecksumHash returns a keyed checksum hash of the bytes provided.
func ( RC4HMAC) (,  []byte,  uint32) ([]byte, error) {
	return rfc4757.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 {
		return false
	}
	return hmac.Equal(, )
}