dukpt

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 9, 2020 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	REG3_MASK      uint64 = 0x1FFFFF
	SHIFT_REG_MASK uint64 = 0x100000
	REG8_MASK      uint64 = 0xFFFFFFFFFFE00000
	KEY_MASK              = []byte{0xC0, 0xC0, 0xC0, 0xC0, 0x00, 0x00, 0x00, 0x00, 0xC0, 0xC0, 0xC0, 0xC0, 0x00, 0x00, 0x00, 0x00}
	PEK_MASK              = []byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF}
)

Functions

func BuildTdesKey

func BuildTdesKey(key []byte) []byte

func CalculateKcv

func CalculateKcv(key []byte) ([]byte, error)

func DeriveIpekFromBdk

func DeriveIpekFromBdk(bdk []byte, ksn []byte) ([]byte, error)

func DerivePekFromBdk

func DerivePekFromBdk(bdk []byte, ksn []byte) ([]byte, error)

func DerivePekFromIpek

func DerivePekFromIpek(ipek []byte, ksn []byte) ([]byte, error)

func EncodeKsn

func EncodeKsn(result []byte, ksn Ksn)

This isn't official as there is no specification on how to build the KSI Aside from TC's 21 bits, the remaining 59 bits are opaque Here we assume the 10-5-5 scheme

func EncryptDecryptAes128Ecb

func EncryptDecryptAes128Ecb(data, key []byte, encrypt bool) []byte

EncryptDecryptAes128Ecb - ECB

func ExtractKsnWithoutCounter

func ExtractKsnWithoutCounter(ksn, cleared []byte)

Types

type Ksn

type Ksn struct {
	Ksi     []byte
	Trsm    []byte
	Counter int
}

func DecodeKsn

func DecodeKsn(ksn []byte) (result Ksn)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL