package crypto
import (
"crypto/aes"
"crypto/hmac"
"crypto/sha1"
"hash"
"github.com/jcmturner/gokrb5/v8/crypto/common"
"github.com/jcmturner/gokrb5/v8/crypto/rfc3961"
"github.com/jcmturner/gokrb5/v8/crypto/rfc3962"
"github.com/jcmturner/gokrb5/v8/iana/chksumtype"
"github.com/jcmturner/gokrb5/v8/iana/etypeID"
)
type Aes256CtsHmacSha96 struct {
}
func (e Aes256CtsHmacSha96 ) GetETypeID () int32 {
return etypeID .AES256_CTS_HMAC_SHA1_96
}
func (e Aes256CtsHmacSha96 ) GetHashID () int32 {
return chksumtype .HMAC_SHA1_96_AES256
}
func (e Aes256CtsHmacSha96 ) GetKeyByteSize () int {
return 256 / 8
}
func (e Aes256CtsHmacSha96 ) GetKeySeedBitLength () int {
return e .GetKeyByteSize () * 8
}
func (e Aes256CtsHmacSha96 ) GetHashFunc () func () hash .Hash {
return sha1 .New
}
func (e Aes256CtsHmacSha96 ) GetMessageBlockByteSize () int {
return 1
}
func (e Aes256CtsHmacSha96 ) GetDefaultStringToKeyParams () string {
return "00001000"
}
func (e Aes256CtsHmacSha96 ) GetConfounderByteSize () int {
return aes .BlockSize
}
func (e Aes256CtsHmacSha96 ) GetHMACBitLength () int {
return 96
}
func (e Aes256CtsHmacSha96 ) GetCypherBlockBitLength () int {
return aes .BlockSize * 8
}
func (e Aes256CtsHmacSha96 ) StringToKey (secret string , salt string , s2kparams string ) ([]byte , error ) {
return rfc3962 .StringToKey (secret , salt , s2kparams , e )
}
func (e Aes256CtsHmacSha96 ) RandomToKey (b []byte ) []byte {
return rfc3961 .RandomToKey (b )
}
func (e Aes256CtsHmacSha96 ) EncryptData (key , data []byte ) ([]byte , []byte , error ) {
return rfc3962 .EncryptData (key , data , e )
}
func (e Aes256CtsHmacSha96 ) EncryptMessage (key , message []byte , usage uint32 ) ([]byte , []byte , error ) {
return rfc3962 .EncryptMessage (key , message , usage , e )
}
func (e Aes256CtsHmacSha96 ) DecryptData (key , data []byte ) ([]byte , error ) {
return rfc3962 .DecryptData (key , data , e )
}
func (e Aes256CtsHmacSha96 ) DecryptMessage (key , ciphertext []byte , usage uint32 ) ([]byte , error ) {
return rfc3962 .DecryptMessage (key , ciphertext , usage , e )
}
func (e Aes256CtsHmacSha96 ) DeriveKey (protocolKey , usage []byte ) ([]byte , error ) {
return rfc3961 .DeriveKey (protocolKey , usage , e )
}
func (e Aes256CtsHmacSha96 ) DeriveRandom (protocolKey , usage []byte ) ([]byte , error ) {
return rfc3961 .DeriveRandom (protocolKey , usage , e )
}
func (e Aes256CtsHmacSha96 ) VerifyIntegrity (protocolKey , ct , pt []byte , usage uint32 ) bool {
return rfc3961 .VerifyIntegrity (protocolKey , ct , pt , usage , e )
}
func (e Aes256CtsHmacSha96 ) GetChecksumHash (protocolKey , data []byte , usage uint32 ) ([]byte , error ) {
return common .GetHash (data , protocolKey , common .GetUsageKc (usage ), e )
}
func (e Aes256CtsHmacSha96 ) VerifyChecksum (protocolKey , data , chksum []byte , usage uint32 ) bool {
c , err := e .GetChecksumHash (protocolKey , data , usage )
if err != nil {
return false
}
return hmac .Equal (chksum , c )
}
The pages are generated with Golds v0.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 .