Documentation
¶
Index ¶
- Constants
- Variables
- func DeriveNativePhononPubKey(salt []byte) *model.NativePubKey
- func ParseIdentifyCardResponse(resp []byte) (cardPubKey *ecdsa.PublicKey, sig *util.ECDSASignature, err error)
- func ParsePairStep1Response(resp []byte) (salt []byte, cardCert cert.CardCertificate, pairingSig []byte, err error)
- func ParsePhononDescriptor(description []byte) (*model.Phonon, error)
- func ParseResponseWithErrCheck(cmd *Command, plainData []byte) (*apdu.Response, error)
- func QuickSecureConnection(readerIndex int, isStatic bool) (cs model.PhononCard, err error)
- func TLVDecodePublicPhononFields(phononTLV tlv.TLVCollection) (*model.Phonon, error)
- func TLVEncodePhononDescriptor(p *model.Phonon) ([]byte, error)
- type APDUDebugFormatter
- type CmdErrTable
- type Command
- func NewCommandCardPair(data []byte) *Command
- func NewCommandCardPair2(data []byte) *Command
- func NewCommandChangePIN(pin string) *Command
- func NewCommandCreatePhonon(curveType byte) *Command
- func NewCommandDestroyPhonon(data []byte) *Command
- func NewCommandFinalizeCardPair(data []byte) *Command
- func NewCommandGenerateInvoice() *Command
- func NewCommandGetAvailableMemory() *Command
- func NewCommandGetFriendlyName() *Command
- func NewCommandGetPhononPubKey(data []byte) *Command
- func NewCommandIdentifyCard(nonce []byte) *Command
- func NewCommandInit(data []byte) *Command
- func NewCommandInitCardPairing(data []byte) *Command
- func NewCommandInstallCert(data []byte) *Command
- func NewCommandListPhonons(p1 byte, p2 byte, data []byte) *Command
- func NewCommandMineNativePhonon(difficulty uint8) *Command
- func NewCommandMutualAuthenticate(data []byte) *Command
- func NewCommandOpenSecureChannel(index uint8, publicKey []byte) *Command
- func NewCommandPairStep1(salt []byte, pairingPubKey *ecdsa.PublicKey) *Command
- func NewCommandPairStep2(cryptogram [32]byte) *Command
- func NewCommandReceiveInvoice() *Command
- func NewCommandReceivePhonons(phononTransferPacket []byte) *Command
- func NewCommandSelectPhononApplet() *Command
- func NewCommandSendPhonons(data []byte, p2Length byte, extendedRequest bool) *Command
- func NewCommandSetDescriptor(data []byte) *Command
- func NewCommandSetFriendlyName(name string) *Command
- func NewCommandSetReceiveList(data []byte) *Command
- func NewCommandTransactionAck(data []byte) *Command
- func NewCommandUnpair(index uint8) *Command
- func NewCommandVerifyPIN(pin string) *Command
- type Invoice
- type MockCard
- func (c *MockCard) CardPair(initCardPairingData []byte) (cardPairingData []byte, err error)
- func (c *MockCard) CardPair2(cardPairData []byte) (cardPair2Data []byte, err error)
- func (c *MockCard) ChangePIN(pin string) error
- func (c *MockCard) CreatePhonon(curveType model.CurveType) (keyIndex uint16, pubKey model.PhononPubKey, err error)
- func (c *MockCard) DestroyPhonon(keyIndex uint16) (privKey *ecdsa.PrivateKey, err error)
- func (c *MockCard) FinalizeCardPair(cardPair2Data []byte) (err error)
- func (c *MockCard) GenerateInvoice() (invoiceData []byte, err error)
- func (c *MockCard) GetAvailableMemory() (int, int, int, error)
- func (c *MockCard) GetFriendlyName() (string, error)
- func (c *MockCard) GetPhononPubKey(keyIndex uint16, crv model.CurveType) (pubkey model.PhononPubKey, err error)
- func (c *MockCard) IdentifyCard(nonce []byte) (cardPubKey *ecdsa.PublicKey, cardSig *util.ECDSASignature, err error)
- func (c *MockCard) Init(pin string) error
- func (c *MockCard) InitCardPairing(receiverCert cert.CardCertificate) (initPairingData []byte, err error)
- func (c *MockCard) InstallCertificate(signKeyFunc func([]byte) ([]byte, error)) error
- func (c *MockCard) ListPhonons(currencyType model.CurrencyType, lessThanValue uint64, greaterThanValue uint64, ...) ([]*model.Phonon, error)
- func (c *MockCard) MineNativePhonon(difficulty uint8) (uint16, []byte, error)
- func (c *MockCard) OpenSecureChannel() error
- func (c *MockCard) OpenSecureConnection() error
- func (c *MockCard) Pair() (*cert.CardCertificate, error)
- func (c *MockCard) ReceiveInvoice(invoiceData []byte) (err error)
- func (c *MockCard) ReceivePhonons(transaction []byte) (err error)
- func (c *MockCard) Select() (instanceUID []byte, cardPubKey *ecdsa.PublicKey, cardInitialized bool, ...)
- func (c *MockCard) SendPhonons(keyIndices []uint16, extendedRequest bool) (transferPhononPackets []byte, err error)
- func (c *MockCard) SetDescriptor(phonon *model.Phonon) error
- func (c *MockCard) SetFriendlyName(name string) error
- func (c *MockCard) SetReceiveList(phononPubKeys []*ecdsa.PublicKey) error
- func (c *MockCard) TransactionAck(keyIndices []uint16) error
- func (c *MockCard) VerifyPIN(pin string) error
- type MockPhonon
- type PhononCommandSet
- func (cs *PhononCommandSet) CardPair(initPairingData []byte) (cardPairData []byte, err error)
- func (cs *PhononCommandSet) CardPair2(cardPairData []byte) (cardPair2Data []byte, err error)
- func (cs *PhononCommandSet) ChangePIN(pin string) error
- func (cs *PhononCommandSet) CreatePhonon(curveType model.CurveType) (keyIndex uint16, pubKey model.PhononPubKey, err error)
- func (cs *PhononCommandSet) DestroyPhonon(keyIndex uint16) (privKey *ecdsa.PrivateKey, err error)
- func (cs *PhononCommandSet) FinalizeCardPair(cardPair2Data []byte) (err error)
- func (cs *PhononCommandSet) GenerateInvoice() (invoiceData []byte, err error)
- func (cs *PhononCommandSet) GetAvailableMemory() (persistentMem int, onResetMem int, onDeselectMem int, err error)
- func (cs *PhononCommandSet) GetFriendlyName() (string, error)
- func (cs *PhononCommandSet) GetPhononPubKey(keyIndex uint16, crv model.CurveType) (pubKey model.PhononPubKey, err error)
- func (cs *PhononCommandSet) IdentifyCard(nonce []byte) (cardPubKey *ecdsa.PublicKey, cardSig *util.ECDSASignature, err error)
- func (cs *PhononCommandSet) Init(pin string) error
- func (cs *PhononCommandSet) InitCardPairing(receiverCert cert.CardCertificate) (initPairingData []byte, err error)
- func (cs *PhononCommandSet) InstallCertificate(signKeyFunc func([]byte) ([]byte, error)) (err error)
- func (cs *PhononCommandSet) ListPhonons(currencyType model.CurrencyType, lessThanValue uint64, greaterThanValue uint64, ...) ([]*model.Phonon, error)
- func (cs *PhononCommandSet) MineNativePhonon(difficulty uint8) (keyIndex uint16, hash []byte, err error)
- func (cs *PhononCommandSet) OpenBestConnection() (initialized bool, err error)
- func (cs *PhononCommandSet) OpenSecureChannel() error
- func (cs *PhononCommandSet) OpenSecureConnection() error
- func (cs *PhononCommandSet) Pair() (*cert.CardCertificate, error)
- func (cs *PhononCommandSet) ReceiveInvoice(invoiceData []byte) (err error)
- func (cs *PhononCommandSet) ReceivePhonons(phononTransfer []byte) error
- func (cs *PhononCommandSet) Select() (instanceUID []byte, cardPubKey *ecdsa.PublicKey, cardInitialized bool, ...)
- func (cs PhononCommandSet) Send(cmd *Command) (*apdu.Response, error)
- func (cs *PhononCommandSet) SendPhonons(keyIndices []uint16, extendedRequest bool) (transferPhononPackets []byte, err error)
- func (cs *PhononCommandSet) SetDescriptor(p *model.Phonon) error
- func (cs *PhononCommandSet) SetFriendlyName(name string) error
- func (cs *PhononCommandSet) SetReceiveList(phononPubKeys []*ecdsa.PublicKey) error
- func (cs *PhononCommandSet) TransactionAck(keyIndices []uint16) error
- func (cs *PhononCommandSet) Unpair(index uint8) error
- func (cs *PhononCommandSet) VerifyPIN(pin string) error
- type SecureChannel
- func (sc *SecureChannel) Decrypt(ciphertext []byte) (data []byte, err error)
- func (sc *SecureChannel) DecryptDirect(ciphertext []byte, iv []byte) (data []byte, err error)
- func (sc *SecureChannel) Encrypt(data []byte) (ciphertext []byte, err error)
- func (sc *SecureChannel) GenerateSecret(cardPubKeyData []byte) error
- func (sc *SecureChannel) GenerateStaticSecret(cardPubKeyData []byte) error
- func (sc *SecureChannel) Init(iv, encKey, macKey []byte)
- func (sc *SecureChannel) PublicKey() *ecdsa.PublicKey
- func (sc *SecureChannel) RawPublicKey() []byte
- func (sc *SecureChannel) Reset()
- func (sc *SecureChannel) Secret() []byte
- func (sc *SecureChannel) Send(cmd *Command) (resp *apdu.Response, err error)
- type SecureChannelPairingDetails
- type StaticPhononCommandSet
- func (cs *StaticPhononCommandSet) OpenSecureChannel() error
- func (cs *StaticPhononCommandSet) OpenSecureConnection() error
- func (cs *StaticPhononCommandSet) Pair() (*cert.CardCertificate, error)
- func (cs *StaticPhononCommandSet) Select() (instanceUID []byte, cardPubKey *ecdsa.PublicKey, cardInitialized bool, ...)
Constants ¶
const ( // instructions InsIdentifyCard = 0x14 InsLoadCert = 0x15 InsVerifyPIN = 0x20 InsChangePIN = 0x21 InsCreatePhonon = 0x30 InsSetDescriptor = 0x31 InsListPhonons = 0x32 InsGetPhononPubKey = 0x33 InsDestroyPhonon = 0x34 InsSendPhonons = 0x35 InsRecvPhonons = 0x36 InsSetRecvList = 0x37 InsTransactionAck = 0x38 InsInitCardPairing = 0x50 InsCardPair = 0x51 InsCardPair2 = 0x52 InsFinalizeCardPair = 0x53 InsGenerateInvoice = 0x54 InsGetFriendlyName = 0x56 InsSetFriendlyName = 0x57 InsReceiveInvoice = 0x55 InsGetAvailableMemory = 0x99 InsMineNativePhonon = 0x41 // tags TagSelectAppInfo = 0xA4 TagCardUID = 0x8F TagCardSecureChannelPubKey = 0x80 TagAppVersion = 0x02 TagPairingSlots = 0x03 TagAppCapability = 0x8D TagPhononKeyCollection = 0x40 TagKeyIndex = 0x41 TagPhononPubKey = 0x80 TagPhononPrivKey = 0x81 TagPhononFilter = 0x60 TagValueFilterLessThan = 0x84 TagValueFilterMoreThan = 0x85 TagPhononCollection = 0x52 TagPhononDescriptor = 0x50 TagPhononDenomBase = 0x83 TagPhononDenomExp = 0x86 TagCurrencyType = 0x82 TagCurveType = 0x87 TagSchemaVersion = 0x88 TagExtendedSchemaVersion = 0x89 TagPhononKeyIndexList = 0x42 TagTransferPhononPacket = 0x43 TagPhononPrivateDescription = 0x44 TagPhononPubKeyList = 0x7F TagCardCertificate = 0x90 TagECCPublicKey = 0x80 //TODO: resolve redundancy around 0x80 tag TagSalt = 0x91 TagAesIV = 0x92 TagECDSASig = 0x93 TagPairingIndex = 0x94 TagAESKey = 0x95 TagInvoiceID = 0x96 //extended tags TagChainID = 0x20 //ISO7816 Standard Responses SW_APPLET_SELECT_FAILED = 0x6999 SW_BYTES_REMAINING_00 = 0x6100 SW_CLA_NOT_SUPPORTED = 0x6E00 SW_COMMAND_CHAINING_NOT_SUPPORTED = 0x6884 SW_COMMAND_NOT_ALLOWED = 0x6986 SW_CONDITIONS_NOT_SATISFIED = 0x6985 SW_CORRECT_LENGTH_00 = 0x6C00 SW_DATA_INVALID = 0x6984 SW_FILE_FULL = 0x6A84 SW_FILE_INVALID = 0x6983 SW_FILE_NOT_FOUND = 0x6A82 SW_FUNC_NOT_SUPPORTED = 0x6A81 SW_INCORRECT_P1P2 = 0x6A86 SW_INS_NOT_SUPPORTED = 0x6D00 SW_LAST_COMMAND_EXPECTED = 0x6883 SW_LOGICAL_CHANNEL_NOT_SUPPORTED = 0x6881 SW_NO_ERROR = 0x9000 SW_RECORD_NOT_FOUND = 0x6A83 SW_SECURE_MESSAGING_NOT_SUPPORTED = 0x6882 SW_SECURITY_STATUS_NOT_SATISFIED = 0x6982 SW_UNKNOWN = 0x6F00 SW_WARNING_STATE_UNCHANGED = 0x6200 SW_WRONG_DATA = 0x6A80 SW_WRONG_LENGTH = 0x6700 SW_WRONG_P1P2 = 0x6B00 SW_MINING_FAILED = 0x9001 SW_PIN_VERIFY_FAILED = 0x63c )
const ( StatusSuccess = 0x9000 StatusPhononTableFull = 0x6A84 StatusKeyIndexInvalid = 0x6983 StatusOutOfMemory = 0x6F00 StatusPINNotEntered = 0x6985 )
const StandardSchemaSupportedVersions uint8 = 0
Variables ¶
var ( ErrMiningFailed = errors.New("native phonon mine attempt failed") ErrInvalidPhononIndex = errors.New("invalid phonon index") ErrDefault = errors.New("unspecified error for command") )
var ( ErrCardUninitialized = errors.New("card uninitialized") ErrPhononTableFull = errors.New("phonon table full") ErrKeyIndexInvalid = errors.New("key index out of valid range") ErrOutOfMemory = errors.New("card out of memory") ErrPINNotEntered = errors.New("valid PIN required") ErrUnknown = errors.New("unknown error") )
var ErrInvalidResponseMAC = errors.New("invalid response MAC")
Functions ¶
func DeriveNativePhononPubKey ¶
func DeriveNativePhononPubKey(salt []byte) *model.NativePubKey
Takes a 32 byte salt as input to generate and return a sha512 hash of it. This is the process for deriving a native phonon hash, which is stored as its pubKey in the phonon table
func ParsePairStep1Response ¶
func ParsePairStep1Response(resp []byte) (salt []byte, cardCert cert.CardCertificate, pairingSig []byte, err error)
Replacement for original parsing logic which did not retrieve full certificate
func QuickSecureConnection ¶
func QuickSecureConnection(readerIndex int, isStatic bool) (cs model.PhononCard, err error)
QuickSecureConnection is a convenience function which establishes a connection to the card attached to the readerIndex given and immediately attempts to open a secure channel with it. Equivalent to running SELECT, PAIR, OPEN_SECURE_CHANNEL. Does not handle the details of uninitialized cards
func TLVDecodePublicPhononFields ¶
func TLVDecodePublicPhononFields(phononTLV tlv.TLVCollection) (*model.Phonon, error)
Decodes the public phonon fields typically returned from a card Excludes PubKey and KeyIndex
func TLVEncodePhononDescriptor ¶
TLV Encodes the phonon standard schema used for setting it's descriptor. Must be extended with additional fields to suit the various commands that deal with phonons. Excludes fields KeyIndex, PubKey, and CurveType which are already known by the card at the time of creation Includes fields SchemaVersion, ExtendedSchemaVersion, CurrencyType, Denomination, and ExtendedTLVs
Types ¶
type APDUDebugFormatter ¶
type APDUDebugFormatter struct{}
type CmdErrTable ¶
type Command ¶
type Command struct { ApduCmd *apdu.Command PossibleErrs CmdErrTable }
func NewCommandCardPair ¶
func NewCommandCardPair2 ¶
func NewCommandChangePIN ¶
func NewCommandCreatePhonon ¶
func NewCommandDestroyPhonon ¶
func NewCommandGenerateInvoice ¶
func NewCommandGenerateInvoice() *Command
func NewCommandGetAvailableMemory ¶
func NewCommandGetAvailableMemory() *Command
func NewCommandGetFriendlyName ¶
func NewCommandGetFriendlyName() *Command
func NewCommandIdentifyCard ¶
NewCommandIdentifyCard takes a 32 byte nonce value and sends it along with the IDENTIFY_CARD APDU As a response it receives the card's public key and and a signature on the salt to prove posession of the private key
func NewCommandInit ¶
func NewCommandInstallCert ¶
func NewCommandPairStep1 ¶
func NewCommandPairStep2 ¶
func NewCommandReceiveInvoice ¶
func NewCommandReceiveInvoice() *Command
func NewCommandReceivePhonons ¶
Receives a TLV encoded Phonon Transfer Packet Payload in encrypted form and passes it on directly to a card
func NewCommandSelectPhononApplet ¶
func NewCommandSelectPhononApplet() *Command
func NewCommandSendPhonons ¶
func NewCommandSetDescriptor ¶
func NewCommandUnpair ¶
func NewCommandVerifyPIN ¶
type MockCard ¶
type MockCard struct { Phonons []*MockPhonon IdentityPubKey *ecdsa.PublicKey IdentityCert cert.CardCertificate // contains filtered or unexported fields }
func (*MockCard) CreatePhonon ¶
func (*MockCard) DestroyPhonon ¶
func (c *MockCard) DestroyPhonon(keyIndex uint16) (privKey *ecdsa.PrivateKey, err error)
func (*MockCard) FinalizeCardPair ¶
func (*MockCard) GenerateInvoice ¶
func (*MockCard) GetAvailableMemory ¶
func (*MockCard) GetFriendlyName ¶
func (*MockCard) GetPhononPubKey ¶
func (*MockCard) IdentifyCard ¶
func (*MockCard) InitCardPairing ¶
func (c *MockCard) InitCardPairing(receiverCert cert.CardCertificate) (initPairingData []byte, err error)
func (*MockCard) InstallCertificate ¶
func (*MockCard) ListPhonons ¶
func (*MockCard) MineNativePhonon ¶
func (*MockCard) OpenSecureChannel ¶
func (*MockCard) OpenSecureConnection ¶
func (*MockCard) ReceiveInvoice ¶
func (*MockCard) ReceivePhonons ¶
func (*MockCard) SendPhonons ¶
func (*MockCard) SetFriendlyName ¶
func (*MockCard) SetReceiveList ¶
func (*MockCard) TransactionAck ¶
type MockPhonon ¶
type PhononCommandSet ¶
type PhononCommandSet struct { ApplicationInfo *types.ApplicationInfo PairingInfo *types.PairingInfo PhononCACert []byte // contains filtered or unexported fields }
func Connect ¶
func Connect(readerIndex int) (*PhononCommandSet, error)
func NewPhononCommandSet ¶
func NewPhononCommandSet(c types.Channel) *PhononCommandSet
func (*PhononCommandSet) CardPair ¶
func (cs *PhononCommandSet) CardPair(initPairingData []byte) (cardPairData []byte, err error)
CardPair takes the response from initCardPairing and passes it to the counterparty card for the next step of pairing
func (*PhononCommandSet) CardPair2 ¶
func (cs *PhononCommandSet) CardPair2(cardPairData []byte) (cardPair2Data []byte, err error)
func (*PhononCommandSet) ChangePIN ¶
func (cs *PhononCommandSet) ChangePIN(pin string) error
func (*PhononCommandSet) CreatePhonon ¶
func (cs *PhononCommandSet) CreatePhonon(curveType model.CurveType) (keyIndex uint16, pubKey model.PhononPubKey, err error)
func (*PhononCommandSet) DestroyPhonon ¶
func (cs *PhononCommandSet) DestroyPhonon(keyIndex uint16) (privKey *ecdsa.PrivateKey, err error)
func (*PhononCommandSet) FinalizeCardPair ¶
func (cs *PhononCommandSet) FinalizeCardPair(cardPair2Data []byte) (err error)
func (*PhononCommandSet) GenerateInvoice ¶
func (cs *PhononCommandSet) GenerateInvoice() (invoiceData []byte, err error)
func (*PhononCommandSet) GetAvailableMemory ¶
func (cs *PhononCommandSet) GetAvailableMemory() (persistentMem int, onResetMem int, onDeselectMem int, err error)
func (*PhononCommandSet) GetFriendlyName ¶
func (cs *PhononCommandSet) GetFriendlyName() (string, error)
func (*PhononCommandSet) GetPhononPubKey ¶
func (cs *PhononCommandSet) GetPhononPubKey(keyIndex uint16, crv model.CurveType) (pubKey model.PhononPubKey, err error)
func (*PhononCommandSet) IdentifyCard ¶
func (cs *PhononCommandSet) IdentifyCard(nonce []byte) (cardPubKey *ecdsa.PublicKey, cardSig *util.ECDSASignature, err error)
func (*PhononCommandSet) Init ¶
func (cs *PhononCommandSet) Init(pin string) error
func (*PhononCommandSet) InitCardPairing ¶
func (cs *PhononCommandSet) InitCardPairing(receiverCert cert.CardCertificate) (initPairingData []byte, err error)
InitCardPairing tells a card to initialized a pairing with another phonon card Data is passed transparently from card to card since no client processing is necessary
func (*PhononCommandSet) InstallCertificate ¶
func (cs *PhononCommandSet) InstallCertificate(signKeyFunc func([]byte) ([]byte, error)) (err error)
func (*PhononCommandSet) ListPhonons ¶
func (cs *PhononCommandSet) ListPhonons(currencyType model.CurrencyType, lessThanValue uint64, greaterThanValue uint64, continuation bool) ([]*model.Phonon, error)
ListPhonons takes a currency type and range bounds and returns a listing of the phonons currently stored on the card Set lessThanValue or greaterThanValue to 0 to ignore the parameter. Returned phonons omit the public key to reduce data transmission After processing, the list client should send GET_PHONON_PUB_KEY to retrieve the corresponding pubkeys if necessary.
func (*PhononCommandSet) MineNativePhonon ¶
func (cs *PhononCommandSet) MineNativePhonon(difficulty uint8) (keyIndex uint16, hash []byte, err error)
func (*PhononCommandSet) OpenBestConnection ¶
func (cs *PhononCommandSet) OpenBestConnection() (initialized bool, err error)
func (*PhononCommandSet) OpenSecureChannel ¶
func (cs *PhononCommandSet) OpenSecureChannel() error
func (*PhononCommandSet) OpenSecureConnection ¶
func (cs *PhononCommandSet) OpenSecureConnection() error
OpenSecureChannel is a convenience function to perform all of the necessary options to open a card to terminal secure channel in sequence. Runs SELECT, PAIR, OPEN_SECURE_CHANNEL
func (*PhononCommandSet) Pair ¶
func (cs *PhononCommandSet) Pair() (*cert.CardCertificate, error)
func (*PhononCommandSet) ReceiveInvoice ¶
func (cs *PhononCommandSet) ReceiveInvoice(invoiceData []byte) (err error)
func (*PhononCommandSet) ReceivePhonons ¶
func (cs *PhononCommandSet) ReceivePhonons(phononTransfer []byte) error
func (*PhononCommandSet) Select ¶
func (cs *PhononCommandSet) Select() (instanceUID []byte, cardPubKey *ecdsa.PublicKey, cardInitialized bool, err error)
Selects the phonon applet for further usage
func (PhononCommandSet) Send ¶
func (cs PhononCommandSet) Send(cmd *Command) (*apdu.Response, error)
func (*PhononCommandSet) SendPhonons ¶
func (cs *PhononCommandSet) SendPhonons(keyIndices []uint16, extendedRequest bool) (transferPhononPackets []byte, err error)
func (*PhononCommandSet) SetDescriptor ¶
func (cs *PhononCommandSet) SetDescriptor(p *model.Phonon) error
func (*PhononCommandSet) SetFriendlyName ¶
func (cs *PhononCommandSet) SetFriendlyName(name string) error
func (*PhononCommandSet) SetReceiveList ¶
func (cs *PhononCommandSet) SetReceiveList(phononPubKeys []*ecdsa.PublicKey) error
Implemented with support for single
func (*PhononCommandSet) TransactionAck ¶
func (cs *PhononCommandSet) TransactionAck(keyIndices []uint16) error
func (*PhononCommandSet) Unpair ¶
func (cs *PhononCommandSet) Unpair(index uint8) error
func (*PhononCommandSet) VerifyPIN ¶
func (cs *PhononCommandSet) VerifyPIN(pin string) error
type SecureChannel ¶
type SecureChannel struct {
// contains filtered or unexported fields
}
func NewSecureChannel ¶
func NewSecureChannel(c types.Channel) *SecureChannel
func (*SecureChannel) Decrypt ¶
func (sc *SecureChannel) Decrypt(ciphertext []byte) (data []byte, err error)
Decrypts the response to the last message Encrypted in this channel The init vector is automatically updated to match the iv the response should use after a Decrypt -> Encrypt cycle
func (*SecureChannel) DecryptDirect ¶
func (sc *SecureChannel) DecryptDirect(ciphertext []byte, iv []byte) (data []byte, err error)
DecryptDirect decrypts a message but does not track iv updates or authenticate the decryption with the MAC Useful for decrypting a message that was just encrypted by the same channel, rather than by a counterparty channel which is keeping the IV in sync. Could also be used to decrypt a message which provides the IV
func (*SecureChannel) Encrypt ¶
func (sc *SecureChannel) Encrypt(data []byte) (ciphertext []byte, err error)
Encrypt data and return ciphertext directly
func (*SecureChannel) GenerateSecret ¶
func (sc *SecureChannel) GenerateSecret(cardPubKeyData []byte) error
func (*SecureChannel) GenerateStaticSecret ¶
func (sc *SecureChannel) GenerateStaticSecret(cardPubKeyData []byte) error
func (*SecureChannel) Init ¶
func (sc *SecureChannel) Init(iv, encKey, macKey []byte)
func (*SecureChannel) PublicKey ¶
func (sc *SecureChannel) PublicKey() *ecdsa.PublicKey
func (*SecureChannel) RawPublicKey ¶
func (sc *SecureChannel) RawPublicKey() []byte
func (*SecureChannel) Reset ¶
func (sc *SecureChannel) Reset()
func (*SecureChannel) Secret ¶
func (sc *SecureChannel) Secret() []byte
type SecureChannelPairingDetails ¶
type SecureChannelPairingDetails struct {
// contains filtered or unexported fields
}
type StaticPhononCommandSet ¶
type StaticPhononCommandSet struct {
*PhononCommandSet
}
Insecure alternative implementation of phonon command set which uses static keys in the card to terminal pairing process in order to allow for debugging with the javacard simulator
func NewStaticPhononCommandSet ¶
func NewStaticPhononCommandSet(cs *PhononCommandSet) *StaticPhononCommandSet
func (*StaticPhononCommandSet) OpenSecureChannel ¶
func (cs *StaticPhononCommandSet) OpenSecureChannel() error
func (*StaticPhononCommandSet) OpenSecureConnection ¶
func (cs *StaticPhononCommandSet) OpenSecureConnection() error
OpenSecureChannel is a convenience function to perform all of the necessary options to open a card to terminal secure channel in sequence. Runs SELECT, PAIR, OPEN_SECURE_CHANNEL
func (*StaticPhononCommandSet) Pair ¶
func (cs *StaticPhononCommandSet) Pair() (*cert.CardCertificate, error)