Documentation ¶
Overview ¶
Package common provides encryption methods common across encryption types
Index ¶
- func GetChecksumHash(b, key []byte, usage uint32, etype etype.EType) ([]byte, error)
- func GetHash(pt, key []byte, usage []byte, etype etype.EType) ([]byte, error)
- func GetIntegrityHash(b, key []byte, usage uint32, etype etype.EType) ([]byte, error)
- func GetUsageKc(un uint32) []byte
- func GetUsageKe(un uint32) []byte
- func GetUsageKi(un uint32) []byte
- func IterationsToS2Kparams(i uint32) string
- func PKCS7Pad(b []byte, m int) ([]byte, error)
- func PKCS7Unpad(b []byte, m int) ([]byte, error)
- func VerifyChecksum(key, chksum, msg []byte, usage uint32, etype etype.EType) bool
- func ZeroPad(b []byte, m int) ([]byte, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetChecksumHash ¶
GetChecksumHash returns a keyed checksum hash of the bytes provided.
func GetIntegrityHash ¶
GetIntegrityHash returns a keyed integrity hash of the bytes provided.
func GetUsageKc ¶
GetUsageKc returns the checksum key usage value for the usage number un.
RFC 3961: The "well-known constant" used for the DK function is the key usage number, expressed as four octets in big-endian order, followed by one octet indicated below.
Kc = DK(base-key, usage | 0x99);
func GetUsageKe ¶
GetUsageKe returns the encryption key usage value for the usage number un
RFC 3961: The "well-known constant" used for the DK function is the key usage number, expressed as four octets in big-endian order, followed by one octet indicated below.
Ke = DK(base-key, usage | 0xAA);
func GetUsageKi ¶
GetUsageKi returns the integrity key usage value for the usage number un
RFC 3961: The "well-known constant" used for the DK function is the key usage number, expressed as four octets in big-endian order, followed by one octet indicated below.
Ki = DK(base-key, usage | 0x55);
func IterationsToS2Kparams ¶
IterationsToS2Kparams converts the number of iterations as an integer to a string representation.
func PKCS7Unpad ¶
PKCS7Unpad removes RFC 2315 padding from byes where message size is m.
func VerifyChecksum ¶
VerifyChecksum compares the checksum of the msg bytes is the same as the checksum provided.
Types ¶
This section is empty.