Documentation
¶
Index ¶
- Variables
- func AppendDESPadding(data []byte) []byte
- func DeriveKey(cardKey []byte, seq []byte, purpose []byte) ([]byte, error)
- func EncryptICV(macKey, icv []byte) ([]byte, error)
- func Mac3DES(key, data, iv []byte) ([]byte, error)
- func MacFull3DES(key, data, iv []byte) ([]byte, error)
- func VerifyCryptogram(encKey, hostChallenge, cardChallenge, cardCryptogram []byte) (bool, error)
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // DerivationPurposeEnc defines 2 bytes used when deriving a encoding key. DerivationPurposeEnc = []byte{0x01, 0x82} // DerivationPurposeMac defines 2 bytes used when deriving a mac key. DerivationPurposeMac = []byte{0x01, 0x01} // NullBytes8 defined a slice of 8 zero bytes mostrly used as IV in cryptographic functions. NullBytes8 = []byte{0, 0, 0, 0, 0, 0, 0, 0} )
Functions ¶
func AppendDESPadding ¶
AppendDESPadding appends an 0x80 bytes to data and other zero bytes to make the result length multiple of 8.
func DeriveKey ¶
DeriveKey derives a key from the current cardKey using the sequence number receive from the card and the purpose (ENC/MAC).
func EncryptICV ¶
EncryptICV encrypts an ICV with the specified macKey. The ICV is usually the mac of the previous command sent in the current session.
func MacFull3DES ¶
MacFull3DES generates a full triple DES mac.
func VerifyCryptogram ¶
VerifyCryptogram verifies the cryptogram sends from the card to ensure that card and client are using the same keys to communicate.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.