2018-09-27 13:29:07 +00:00
|
|
|
package globalplatform
|
|
|
|
|
2018-10-05 14:40:32 +00:00
|
|
|
// KeyProvider is a struct that contains encoding and MAC keys used to communicate with smartcards.
|
2018-09-27 13:29:07 +00:00
|
|
|
type KeyProvider struct {
|
|
|
|
enc []byte
|
|
|
|
mac []byte
|
|
|
|
}
|
|
|
|
|
2018-10-05 14:40:32 +00:00
|
|
|
// Enc returns the enc key data.
|
2018-09-27 13:29:07 +00:00
|
|
|
func (k *KeyProvider) Enc() []byte {
|
|
|
|
return k.enc
|
|
|
|
}
|
|
|
|
|
2018-10-05 14:40:32 +00:00
|
|
|
// Mac returns the MAC key data.
|
2018-09-27 13:29:07 +00:00
|
|
|
func (k *KeyProvider) Mac() []byte {
|
|
|
|
return k.mac
|
|
|
|
}
|
|
|
|
|
2018-10-05 14:40:32 +00:00
|
|
|
// NewKeyProvider returns a new KeyProvider with the specified ENC and MAC keys.
|
2018-09-27 13:29:07 +00:00
|
|
|
func NewKeyProvider(enc, mac []byte) *KeyProvider {
|
|
|
|
return &KeyProvider{
|
|
|
|
enc: enc,
|
|
|
|
mac: mac,
|
|
|
|
}
|
|
|
|
}
|