Documentation ¶
Index ¶
- Constants
- Variables
- func CardScan(card *Card, line string) error
- func StartGpgAgent() (socketFilename string, err error)
- type Card
- func (card *Card) AddKey(subKey int) error
- func (card *Card) AuthenticationKey() *CardKey
- func (card *Card) CheckPIN(admin bool) error
- func (card *Card) EncryptionKey() *CardKey
- func (card *Card) FactoryReset() error
- func (card *Card) ResetPassword(admin bool) error
- func (card *Card) SetDisplayLanguage(lang string) error
- func (card *Card) SetDisplayName(name string) error
- func (card *Card) SetDisplaySex(sex CardSex) error
- func (card *Card) SetLoginData(loginData string) error
- func (card *Card) SetPIN(admin bool) error
- func (card *Card) SignatureKey() *CardKey
- type CardKey
- type CardSex
- type Conn
- func (conn *Conn) Close() error
- func (conn *Conn) CurrentCard() (*Card, error)
- func (conn *Conn) Key(keygrip string) (Key, error)
- func (conn *Conn) KeyGrips() (map[string]string, error)
- func (conn *Conn) Keys() ([]Key, error)
- func (conn *Conn) Raw(f ResponseFunc, format string, a ...interface{}) error
- func (conn *Conn) ReadKey(keygrip string) (crypto.PublicKey, error)
- func (conn *Conn) Version() (string, error)
- type Error
- type Key
- type KeyProtection
- type KeyType
- type ResponseFunc
Constants ¶
const ( CardSexUnspecified CardSex = 0 CardSexMale = 1 CardSexFemale = 2 CardSexNotApplicable = 9 )
These constants define the possible CardSex values.
const ( SignatureKey = iota EncryptionKey AuthenticationKey )
The IDs of the different subkeys
Variables ¶
var ( ErrUnknownFormat = errors.New("s-expression is in unknown format") ErrNotPublicKey = errors.New("s-expression is not a public key") ErrNotSignature = errors.New("s-expression is not a signature") )
These errors may be returned from the functions related to s-expression encoding and decoding.
Functions ¶
func StartGpgAgent ¶
Types ¶
type Card ¶
type Card struct { Reader string Serial string AppType string ExtCap string LoginData string DisplayName string DisplayLanguage string DisplaySex CardSex PubkeyURL string SignatureCounter int SignaturePINCached bool MaxPINLength [cardMaxKeyNumber]int PINRetryCounter [cardMaxKeyNumber]int Subkeys [cardMaxKeyNumber]*CardKey // contains filtered or unexported fields }
Card describes the information gpg-agent exposes about a card
func (*Card) AuthenticationKey ¶
AuthenticationKey returns the card authentication key (or nil if it's missing)
func (*Card) CheckPIN ¶
CheckPIN will check the requested password (potentially cached, might need unplugging for subsequent calls)
func (*Card) EncryptionKey ¶
EncryptionKey returns the card encryption key (or nil if it's missing)
func (*Card) FactoryReset ¶
FactoryReset will ensure the key is completely wiped out, see https://support.yubico.com/support/solutions/articles/15000006421-resetting-the-openpgp-applet-on-your-yubikey for more information
func (*Card) ResetPassword ¶
ResetPassword will unblock the requested password
func (*Card) SetDisplayLanguage ¶
SetDisplayLanguage sets the display language on the given smart card
func (*Card) SetDisplayName ¶
SetDisplayName sets the display name on the given smart card
func (*Card) SetDisplaySex ¶
SetDisplaySex sets the display sex on the given smart card
func (*Card) SetLoginData ¶
SetLoginData sets the login data on the given smart card
func (*Card) SignatureKey ¶
SignatureKey returns the card signature key (or nil if it's missing)
type Conn ¶
type Conn struct {
// contains filtered or unexported fields
}
Conn represents a single connection to a GPG agent.
func Dial ¶
Dial connects to the specified unix domain socket and checks if there is a live GPG agent on the other end. If filename is "", try to find the path the socket automatically by calling gpgconf --list-dirs (see findAgentSocket).
func (*Conn) CurrentCard ¶
CurrentCard returns the currently connected smartcard, including its subkeys
func (*Conn) KeyGrips ¶
KeyGrips returns a list of available keysgrips, indexed by CardID, by querying the card
func (*Conn) Raw ¶
func (conn *Conn) Raw(f ResponseFunc, format string, a ...interface{}) error
Raw executes a command and pipes its results to the specified ResponseFunc parameter.
type Key ¶
type Key struct { Keygrip string Type KeyType SerialNo string CardID string Cached bool Protection KeyProtection Fingerprint string TimeToLive string // contains filtered or unexported fields }
Key describes the information gpg-agent exposes about a key.
func (*Key) Decrypt ¶
func (key *Key) Decrypt(rand io.Reader, ciphertext []byte, opts crypto.DecrypterOpts) (plaintext []byte, err error)
Decrypt decrypts ciphertext with this key. If opts is nil or of type *PKCS1v15DecryptOptions then PKCS#1 v1.5 decryption is performed. Otherwise opts must have type *OAEPOptions and OAEP decryption is done.
This function is basically a copy of rsa.Decrypt().
func (*Key) Sign ¶
func (key *Key) Sign(rand io.Reader, msg []byte, opts crypto.SignerOpts) (signature []byte, err error)
Sign signs msg with this key, possibly using entropy from rand. If opts is a *PSSOptions then the PSS algorithm will be used, otherwise PKCS#1 v1.5 will be used.
This function is basically a copy of rsa.Sign().
type KeyProtection ¶
type KeyProtection int
KeyProtection describes the key project type.
const ( ProtByPassphrase KeyProtection = iota ProtByNothing ProtUnknown )
These constants define the possible KeyProtection values.
type ResponseFunc ¶
ResponseFunc defines the function handler for the Raw function.