Documentation
¶
Overview ¶
Package adpu is a generated GoMock package.
Package adpu is a generated GoMock package.
Index ¶
- Constants
- Variables
- func Marshal[T Marshaler](m T) ([]byte, error)
- func Send[RS Unmarshaler, RQ Marshaler](ctx context.Context, proto Protocol, cla, ins, p1, p2 uint8, data RQ, res RS) error
- func Unmarshal[T Unmarshaler](data []byte, target T) error
- type EmptyData
- type Marshaler
- type MockMarshaler
- type MockMarshalerMockRecorder
- type MockProtocol
- type MockProtocolMockRecorder
- type MockUnmarshaler
- type MockUnmarshalerMockRecorder
- type Protocol
- type Response
- type Unmarshaler
Constants ¶
const ( // ADPU header length for a block ADPU_BLOCK_HEADER_LENGTH uint16 = 5 FRAME_HEADER_TAG uint8 = 0x05 )
const ( SW_ACCESS_CONDITION_NOT_FULFILLED uint16 = 0x9804 SW_ALGORITHM_NOT_SUPPORTED uint16 = 0x9484 SW_CLA_NOT_SUPPORTED uint16 = 0x6e00 SW_CODE_BLOCKED uint16 = 0x9840 SW_CODE_NOT_INITIALIZED uint16 = 0x9802 SW_COMMAND_INCOMPATIBLE_FILE_STRUCTURE uint16 = 0x6981 SW_CONDITIONS_OF_USE_NOT_SATISFIED uint16 = 0x6985 SW_CONTRADICTION_INVALIDATION uint16 = 0x9810 SW_CONTRADICTION_SECRET_CODE_STATUS uint16 = 0x9808 SW_DEVICE_IN_RECOVERY_MODE uint16 = 0x662f SW_CUSTOM_IMAGE_EMPTY uint16 = 0x662e SW_FILE_ALREADY_EXISTS uint16 = 0x6a89 SW_FILE_NOT_FOUND uint16 = 0x9404 SW_GP_AUTH_FAILED uint16 = 0x6300 SW_HALTED uint16 = 0x6faa SW_INCONSISTENT_FILE uint16 = 0x9408 SW_INCORRECT_DATA uint16 = 0x6a80 SW_INCORRECT_LENGTH uint16 = 0x6700 SW_INCORRECT_P1_P2 uint16 = 0x6b00 SW_INS_NOT_SUPPORTED uint16 = 0x6d00 SW_DEVICE_NOT_ONBOARDED uint16 = 0x6d07 SW_DEVICE_NOT_ONBOARDED_2 uint16 = 0x6611 SW_INVALID_KCV uint16 = 0x9485 SW_INVALID_OFFSET uint16 = 0x9402 SW_LICENSING uint16 = 0x6f42 SW_LOCKED_DEVICE uint16 = 0x5515 SW_MAX_VALUE_REACHED uint16 = 0x9850 SW_MEMORY_PROBLEM uint16 = 0x9240 SW_MISSING_CRITICAL_PARAMETER uint16 = 0x6800 SW_NO_EF_SELECTED uint16 = 0x9400 SW_NOT_ENOUGH_MEMORY_SPACE uint16 = 0x6a84 SW_OK uint16 = 0x9000 SW_PIN_REMAINING_ATTEMPTS uint16 = 0x63c0 SW_REFERENCED_DATA_NOT_FOUND uint16 = 0x6a88 SW_SECURITY_STATUS_NOT_SATISFIED uint16 = 0x6982 SW_TECHNICAL_PROBLEM uint16 = 0x6f00 SW_UNKNOWN_APDU uint16 = 0x6d02 SW_USER_REFUSED_ON_DEVICE uint16 = 0x5501 SW_NOT_ENOUGH_SPACE uint16 = 0x5102 SW_APP_NOT_FOUND_OR_INVALID_CONTEXT uint16 = 0x5123 SW_INVALID_APP_NAME_LENGTH uint16 = 0x670a SW_GEN_AES_KEY_FAILED uint16 = 0x5419 SW_INTERNAL_CRYPTO_OPERATION_FAILED uint16 = 0x541a SW_INTERNAL_COMPUTE_AES_CMAC_FAILED uint16 = 0x541b SW_ENCRYPT_APP_STORAGE_FAILED uint16 = 0x541c SW_INVALID_BACKUP_STATE uint16 = 0x6642 SW_PIN_NOT_SET uint16 = 0x5502 SW_INVALID_BACKUP_LENGTH uint16 = 0x6733 SW_INVALID_RESTORE_STATE uint16 = 0x6643 SW_INVALID_CHUNK_LENGTH uint16 = 0x6734 SW_INVALID_BACKUP_HEADER uint16 = 0x684a SW_TRUSTCHAIN_WRONG_SEED uint16 = 0xb007 )
Variables ¶
var ( ErrSWNotOK = errors.New("SW not OK") ErrADPUPayloadTooLong = errors.New("ADPU data is too long") ErrIncompleteWrite = errors.New("incomplete block write") ErrIncompleteRead = errors.New("incomplete block read") ErrBlockChannelNotMatch = errors.New("block channel not match") ErrBlockTagNotMatch = errors.New("block tag not match") ErrBlockSequenceNotMatch = errors.New("block sequence not match") )
var (
SWMessage = map[uint16]string{
0x9804: "SW_ACCESS_CONDITION_NOT_FULFILLED",
0x9484: "SW_ALGORITHM_NOT_SUPPORTED",
0x6e00: "SW_CLA_NOT_SUPPORTED",
0x9840: "SW_CODE_BLOCKED",
0x9802: "SW_CODE_NOT_INITIALIZED",
0x6981: "SW_COMMAND_INCOMPATIBLE_FILE_STRUCTURE",
0x6985: "SW_CONDITIONS_OF_USE_NOT_SATISFIED",
0x9810: "SW_CONTRADICTION_INVALIDATION",
0x9808: "SW_CONTRADICTION_SECRET_CODE_STATUS",
0x662f: "SW_DEVICE_IN_RECOVERY_MODE",
0x662e: "SW_CUSTOM_IMAGE_EMPTY",
0x6a89: "SW_FILE_ALREADY_EXISTS",
0x9404: "SW_FILE_NOT_FOUND",
0x6300: "SW_GP_AUTH_FAILED",
0x6faa: "SW_HALTED",
0x9408: "SW_INCONSISTENT_FILE",
0x6a80: "SW_INCORRECT_DATA",
0x6700: "SW_INCORRECT_LENGTH",
0x6b00: "SW_INCORRECT_P1_P2",
0x6d00: "SW_INS_NOT_SUPPORTED",
0x6d07: "SW_DEVICE_NOT_ONBOARDED",
0x6611: "SW_DEVICE_NOT_ONBOARDED_2",
0x9485: "SW_INVALID_KCV",
0x9402: "SW_INVALID_OFFSET",
0x6f42: "SW_LICENSING",
0x5515: "SW_LOCKED_DEVICE",
0x9850: "SW_MAX_VALUE_REACHED",
0x9240: "SW_MEMORY_PROBLEM",
0x6800: "SW_MISSING_CRITICAL_PARAMETER",
0x9400: "SW_NO_EF_SELECTED",
0x6a84: "SW_NOT_ENOUGH_MEMORY_SPACE",
0x9000: "SW_OK",
0x63c0: "SW_PIN_REMAINING_ATTEMPTS",
0x6a88: "SW_REFERENCED_DATA_NOT_FOUND",
0x6982: "SW_SECURITY_STATUS_NOT_SATISFIED",
0x6f00: "SW_TECHNICAL_PROBLEM",
0x6d02: "SW_UNKNOWN_APDU",
0x5501: "SW_USER_REFUSED_ON_DEVICE",
0x5102: "SW_NOT_ENOUGH_SPACE",
0x5123: "SW_APP_NOT_FOUND_OR_INVALID_CONTEXT",
0x670a: "SW_INVALID_APP_NAME_LENGTH",
0x5419: "SW_GEN_AES_KEY_FAILED",
0x541a: "SW_INTERNAL_CRYPTO_OPERATION_FAILED",
0x541b: "SW_INTERNAL_COMPUTE_AES_CMAC_FAILED",
0x541c: "SW_ENCRYPT_APP_STORAGE_FAILED",
0x6642: "SW_INVALID_BACKUP_STATE",
0x5502: "SW_PIN_NOT_SET",
0x6733: "SW_INVALID_BACKUP_LENGTH",
0x6643: "SW_INVALID_RESTORE_STATE",
0x6734: "SW_INVALID_CHUNK_LENGTH",
0x684a: "SW_INVALID_BACKUP_HEADER",
0xb007: "SW_TRUSTCHAIN_WRONG_SEED",
}
)
Functions ¶
func Unmarshal ¶
func Unmarshal[T Unmarshaler](data []byte, target T) error
Types ¶
type EmptyData ¶
type EmptyData struct{}
func (*EmptyData) MarshalADPU ¶
func (*EmptyData) UnmarshalADPU ¶
type MockMarshaler ¶
type MockMarshaler struct {
// contains filtered or unexported fields
}
MockMarshaler is a mock of Marshaler interface.
func NewMockMarshaler ¶
func NewMockMarshaler(ctrl *gomock.Controller) *MockMarshaler
NewMockMarshaler creates a new mock instance.
func (*MockMarshaler) EXPECT ¶
func (m *MockMarshaler) EXPECT() *MockMarshalerMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockMarshaler) MarshalADPU ¶
func (m *MockMarshaler) MarshalADPU() ([]byte, error)
MarshalADPU mocks base method.
type MockMarshalerMockRecorder ¶
type MockMarshalerMockRecorder struct {
// contains filtered or unexported fields
}
MockMarshalerMockRecorder is the mock recorder for MockMarshaler.
func (*MockMarshalerMockRecorder) MarshalADPU ¶
func (mr *MockMarshalerMockRecorder) MarshalADPU() *gomock.Call
MarshalADPU indicates an expected call of MarshalADPU.
type MockProtocol ¶
type MockProtocol struct {
// contains filtered or unexported fields
}
MockProtocol is a mock of Protocol interface.
func NewMockProtocol ¶
func NewMockProtocol(ctrl *gomock.Controller) *MockProtocol
NewMockProtocol creates a new mock instance.
func (*MockProtocol) EXPECT ¶
func (m *MockProtocol) EXPECT() *MockProtocolMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
type MockProtocolMockRecorder ¶
type MockProtocolMockRecorder struct {
// contains filtered or unexported fields
}
MockProtocolMockRecorder is the mock recorder for MockProtocol.
type MockUnmarshaler ¶
type MockUnmarshaler struct {
// contains filtered or unexported fields
}
MockUnmarshaler is a mock of Unmarshaler interface.
func NewMockUnmarshaler ¶
func NewMockUnmarshaler(ctrl *gomock.Controller) *MockUnmarshaler
NewMockUnmarshaler creates a new mock instance.
func (*MockUnmarshaler) EXPECT ¶
func (m *MockUnmarshaler) EXPECT() *MockUnmarshalerMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockUnmarshaler) UnmarshalADPU ¶
func (m *MockUnmarshaler) UnmarshalADPU(data []byte) error
UnmarshalADPU mocks base method.
type MockUnmarshalerMockRecorder ¶
type MockUnmarshalerMockRecorder struct {
// contains filtered or unexported fields
}
MockUnmarshalerMockRecorder is the mock recorder for MockUnmarshaler.
func (*MockUnmarshalerMockRecorder) UnmarshalADPU ¶
func (mr *MockUnmarshalerMockRecorder) UnmarshalADPU(data any) *gomock.Call
UnmarshalADPU indicates an expected call of UnmarshalADPU.