Documentation ¶
Index ¶
- type PrivateKey
- type PublicKey
- type PublicKeyAlgorithm
- type Pubring
- func (p *Pubring) Contains(fp string) bool
- func (p *Pubring) Export(id string) ([]byte, error)
- func (p *Pubring) Get(id string) *PublicKey
- func (p *Pubring) Import(buf []byte) error
- func (p *Pubring) KeyIDs() []string
- func (p *Pubring) Remove(id string) error
- func (p *Pubring) Save() error
- func (p *Pubring) Set(pk *PublicKey) error
- type Secring
- func (p *Secring) Contains(fp string) bool
- func (p *Secring) Export(id string, withPrivate bool) ([]byte, error)
- func (p *Secring) Get(id string) *PrivateKey
- func (p *Secring) Import(buf []byte) error
- func (p *Secring) KeyIDs() []string
- func (p *Secring) Remove(id string) error
- func (p *Secring) Save() error
- func (p *Secring) Set(pk *PrivateKey) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type PrivateKey ¶
type PrivateKey struct { PublicKey Encrypted bool EncryptedData []byte Nonce [nonceLength]byte // for private key encryption Salt []byte // for KDF // contains filtered or unexported fields }
PrivateKey is a private key part of a keypair
func GenerateKeypair ¶
func GenerateKeypair(passphrase string) (*PrivateKey, error)
GenerateKeypair generates a new keypair
func (*PrivateKey) Decrypt ¶
func (p *PrivateKey) Decrypt(passphrase string) error
Decrypt decrypts the private key
func (*PrivateKey) Encrypt ¶
func (p *PrivateKey) Encrypt(passphrase string) error
Encrypt encrypts the private key material with the given passphrase
func (*PrivateKey) PrivateKey ¶
func (p *PrivateKey) PrivateKey() [keyLength]byte
PrivateKey returns the decrypted private key material
type PublicKey ¶
type PublicKey struct { CreationTime time.Time PubKeyAlgo PublicKeyAlgorithm PublicKey [32]byte Identity *xcpb.Identity }
PublicKey is the public part of a keypair
func (PublicKey) Fingerprint ¶
Fingerprint calculates the unique ID of a public key
type PublicKeyAlgorithm ¶
type PublicKeyAlgorithm uint8
PublicKeyAlgorithm is a type of public key algorithm
const ( // PubKeyNaCl is a NaCl (Salt) based public key PubKeyNaCl PublicKeyAlgorithm = iota )
type Pubring ¶
Pubring is a public key ring
func LoadPubring ¶
LoadPubring loads an existing keyring from disk. If the file is not found an empty keyring is returned.
func NewPubring ¶
NewPubring initializes a new public key ring
type Secring ¶
Secring is private key ring
func LoadSecring ¶
LoadSecring loads an existing secring from disk. If the file is not found an empty keyring is returned