Documentation ¶
Overview ¶
Package openpgp implements the interface to the OpenPGP application on ISO Smart Card Operating Systems v3.4.1 See: https://gnupg.org/ftp/specs/OpenPGP-smart-card-application-3.4.1.pdf
Index ¶
- Constants
- Variables
- type Algorithm
- type AlgorithmAttributes
- type ApplicationIdentifier
- type ApplicationRelated
- type Card
- func (c *Card) CalculateSharedSecret(pk []byte) ([]byte, error)
- func (c *Card) ChangePassword(pwType byte, pwActual, pwNew string) error
- func (c *Card) Decipher(_ []byte) ([]byte, error)
- func (c *Card) Encipher(_ []byte) ([]byte, error)
- func (c *Card) FactoryReset() error
- func (c *Card) GenerateKeyPair() error
- func (c *Card) GetApplicationRelatedData() (ar ApplicationRelated, err error)
- func (c *Card) GetCardholder() (ch Cardholder, err error)
- func (c *Card) GetChallenge(cnt int) ([]byte, error)
- func (c *Card) GetSecuritySupportTemplate() (sst SecuritySupportTemplate, err error)
- func (c *Card) ManageSecurityEnvironment(crt byte, slot Slot) error
- func (c *Card) ResetRetryCounter(pw string) error
- func (c *Card) ResetRetryCounterWithResetCode(pw, rc string) error
- func (c *Card) Select() error
- func (c *Card) Sign(_ []byte) ([]byte, error)
- func (c *Card) VerifyPassword(pwType byte, pw string) (err error)
- type Cardholder
- type Error
- type ExtendedCapabilities
- type ExtendedLengthInfo
- type Fingerprint
- type GeneralFeatures
- type HistoricalBytes
- type KeyInfo
- type PasswordStatus
- type RID
- type SecuritySupportTemplate
- type Sex
- type Slot
- type UserInteractionFlag
Constants ¶
const ( PW1 byte = 0x81 PW2 byte = 0x82 PW3 byte = 0x83 )
const (
AppIDOpenPGP = 0x01
)
Variables ¶
var RidFSFE = [5]byte{0xD2, 0x76, 0x00, 0x01, 0x24}
Functions ¶
This section is empty.
Types ¶
type AlgorithmAttributes ¶
type AlgorithmAttributes struct { Algorithm // contains filtered or unexported fields }
func (*AlgorithmAttributes) Decode ¶
func (a *AlgorithmAttributes) Decode(b []byte) error
func (*AlgorithmAttributes) String ¶
func (a *AlgorithmAttributes) String() string
type ApplicationIdentifier ¶
type ApplicationIdentifier struct { RID RID Application byte Version [2]byte Serial [4]byte Manufacturer uint16 RFU [2]byte SerialGPG uint64 }
func (*ApplicationIdentifier) Decode ¶
func (aid *ApplicationIdentifier) Decode(b []byte) error
func (*ApplicationIdentifier) ManufacturerName ¶
func (aid *ApplicationIdentifier) ManufacturerName() string
type ApplicationRelated ¶
type ApplicationRelated struct { AID ApplicationIdentifier HistoricalBytes HistoricalBytes LengthInfo ExtendedLengthInfo Capabilities ExtendedCapabilities Features GeneralFeatures PasswordStatus PasswordStatus Keys [4]KeyInfo }
func (*ApplicationRelated) Decode ¶
func (ar *ApplicationRelated) Decode(b []byte) (err error)
type Card ¶
type Card struct {
// contains filtered or unexported fields
}
func (*Card) CalculateSharedSecret ¶
See: OpenPGP Smart Card Application - Section 7.2.11 PSO: DECIPHER
func (*Card) ChangePassword ¶
See: OpenPGP Smart Card Application - Section 7.2.3 CHANGE REFERENCE DATA
func (*Card) FactoryReset ¶
See: OpenPGP Smart Card Application - Section
func (*Card) GenerateKeyPair ¶
See: OpenPGP Smart Card Application - Section 7.2.14 GENERATE ASYMMETRIC KEY PAIR
func (*Card) GetApplicationRelatedData ¶
func (c *Card) GetApplicationRelatedData() (ar ApplicationRelated, err error)
func (*Card) GetCardholder ¶
func (c *Card) GetCardholder() (ch Cardholder, err error)
func (*Card) GetChallenge ¶
See: OpenPGP Smart Card Application - Section 7.2.15 GET CHALLENGE
func (*Card) GetSecuritySupportTemplate ¶
func (c *Card) GetSecuritySupportTemplate() (sst SecuritySupportTemplate, err error)
func (*Card) ManageSecurityEnvironment ¶
See: OpenPGP Smart Card Application - Section 7.2.18 MANAGE SECURITY ENVIRONMENT
func (*Card) ResetRetryCounter ¶
See: OpenPGP Smart Card Application - Section 7.2.4 RESET RETRY COUNTER
func (*Card) ResetRetryCounterWithResetCode ¶
See: OpenPGP Smart Card Application - Section 7.2.4 RESET RETRY COUNTER
type Cardholder ¶
func (*Cardholder) Decode ¶
func (ch *Cardholder) Decode(b []byte) (err error)
type ExtendedCapabilities ¶
type ExtendedCapabilities struct { SecureMessaging bool GetChallenge bool KeyImport bool PasswordStatusChangeable bool PrivateDO bool AlgAttrsChangeable bool EncDecAES bool KdfDO bool AlgSecureMessaging byte MaxLenChallenge uint16 MaxLenCardholderCert uint16 MaxLenSpecialDO uint16 Pin2BlockFormat byte CommandMSE byte }
func (*ExtendedCapabilities) Decode ¶
func (ec *ExtendedCapabilities) Decode(b []byte) error
type ExtendedLengthInfo ¶
func (*ExtendedLengthInfo) Decode ¶
func (li *ExtendedLengthInfo) Decode(b []byte) error
type Fingerprint ¶
type Fingerprint [20]byte
type GeneralFeatures ¶
type GeneralFeatures struct { Display bool Bio bool Button bool KeyPad bool LED bool Speaker bool Mic bool Touchscreen bool }
func (*GeneralFeatures) Decode ¶
func (f *GeneralFeatures) Decode(b []byte) error
type HistoricalBytes ¶
type HistoricalBytes struct { CategoryIndicator byte StatusIndicator []byte Caps struct { CmdChaining bool // Command chaining ExtLen bool // Extended Lc and Le fields ExtLenInfoinEFATR bool // Extended Length Information in EF.ATR/INFO LogicalChanNum bool } CardService struct { AppSelectionFullDF bool // Application Selection by full DF name (AID) AppSelectPartialDF bool // Application Selection by partial DF name EfDirDOsAvailable bool // DOs available in EF.DIR MF bool // Card with MF } }
func (*HistoricalBytes) Decode ¶
func (h *HistoricalBytes) Decode(b []byte) (err error)
type KeyInfo ¶
type KeyInfo struct { Reference byte Status byte AlgAttrs AlgorithmAttributes Fingerprint []byte FingerprintCA []byte GenerationTime time.Time UIF UserInteractionFlag }
type PasswordStatus ¶
type PasswordStatus struct { ValidityPW1 uint8 LengthPW1 uint8 LengthRC uint8 LengthPW3 uint8 AttemptsPW1 uint8 AttemptsRC uint8 AttemptsPW3 uint8 }
func (*PasswordStatus) Decode ¶
func (ps *PasswordStatus) Decode(b []byte) error
type SecuritySupportTemplate ¶
func (*SecuritySupportTemplate) Decode ¶
func (sst *SecuritySupportTemplate) Decode(b []byte) (err error)
type UserInteractionFlag ¶
func (*UserInteractionFlag) Decode ¶
func (uif *UserInteractionFlag) Decode(b []byte) error