dukpt

package
v0.0.0-...-b452821 Latest Latest
Warning

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

Go to latest
Published: May 17, 2017 License: MIT Imports: 5 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 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 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