security

package
v0.2.0-alpha Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2021 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package security provides functions for handling objects related to Secure Communication with a card.

Index

Constants

View Source
const (
	// NotAuthenticated indicates that authentication status is neither AUTHENTICATED nor ANY_AUTHENTICATED.
	NotAuthenticated AuthenticationStatus = iota
	// Authenticated indicates authentication status AUTHENTICATED.
	Authenticated = iota
	// AnyAuthenticated indicates authentication status ANY_AUTHENTICATED.
	AnyAuthenticated = iota
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthenticationStatus

type AuthenticationStatus int

AuthenticationStatus is the current authentication status of a secure channel session.

type Level

type Level struct {
	AuthenticationStatus AuthenticationStatus
	CDEC                 bool // Command decryption.
	CMAC                 bool // Command Message Authentication Code.
	RMAC                 bool // Response Message Authentication Code.
	RENC                 bool // Response encryption.
}

Level provides secure messaging protection levels that are applied to protected messages, either for the whole session or for a specific command-response pair. The rules for handling Security Levels are defined individually for each Secure Channel Protocol.

func ParseLevel

func ParseLevel(b byte) (*Level, error)

ParseLevel parses the current security level and returns Level.

func (Level) Byte

func (level Level) Byte() byte

Byte encodes Level on a byte.

type SCP02Parameter

type SCP02Parameter struct {
	ThreeSCKeys                bool // true: 3 Secure Channel Keys, false: 1 Secure Channel base key
	CMACOnUnmodifiedAPDU       bool // true: C-MAC on unmodified APDU, false: C-MAC on modified APDU
	ExplicitInitiation         bool // true: Initiation mode explicit, false: Initiation mode implicit
	ICVMacOverAID              bool // true: ICV set to MAC over AID, false: ICV set to zero
	ICVEncryptionForCMAC       bool // true: ICV encryption for C-MAC session, false: No ICV encryption
	RMACSupported              bool // true: R-MAC support, false: No R-MAC support
	KnownPseudoRandomAlgorithm bool // true: Well-known pseudo-random algorithm (card challenge), false: Unspecified card challenge generation method
}

SCP02Parameter contains options encoded on the i-Parameter for SCP02.

func ParseSCP02Parameter

func ParseSCP02Parameter(i byte) *SCP02Parameter

ParseSCP02Parameter parses the i-Param for SCP02 and returns SCP02Parameter.

func (SCP02Parameter) Byte

func (param SCP02Parameter) Byte() byte

Byte encodes SCP02Parameter on a byte.

type SCP03Parameter

type SCP03Parameter struct {
	PseudoRandomCardChallenge bool // true:Pseudo-random card challenge, false: Random card challenge
	RMACSupport               bool // Response MAC.
	RENCSupport               bool // Response encryption.
}

SCP03Parameter contains options encoded on the i-Parameter for SCP03.

func ParseSCP03Parameter

func ParseSCP03Parameter(i byte) *SCP03Parameter

ParseSCP03Parameter parses the i-Param for SCP03 and returns SCP03Parameter.

func (SCP03Parameter) Byte

func (param SCP03Parameter) Byte() byte

Byte encodes SCP03Parameter on a byte.

type SCP10Parameter

type SCP10Parameter struct {
	KeyAgreement                    bool // true: Key Agreement, false: Key Transport
	SignatureWithoutMessageRecovery bool // true: Signature without message recovery, false: Signature with message recovery
}

SCP10Parameter contains options encoded on the i-Parameter for SCP10.

func ParseSCP10Parameter

func ParseSCP10Parameter(i byte) *SCP10Parameter

ParseSCP10Parameter parses the i-Param for SCP10 and returns SCP10Parameter.

func (SCP10Parameter) Byte

func (param SCP10Parameter) Byte() byte

Byte encodes SCP10Parameter on a byte.

type SCPParameter

type SCPParameter struct {
	ID     byte // ID of the SCP.
	Option byte // i-Param of the SCP.
}

SCPParameter is used for storing data about SCPs that might be unknown to the current implementation.

Jump to

Keyboard shortcuts

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