Documentation ¶
Index ¶
- Variables
- func GenerateKey(keyPath string, passphrase []byte, opts *GenerateOptions) error
- func GenerateKeypair(passphrase []byte, opts *GenerateOptions) (*Private, *Public, error)
- func Sign(privatePath, messagePath, signaturePath string) error
- func Verify(publicPath, messagePath, signaturePath string) error
- type GenerateOptions
- type Private
- type Public
- type Signature
Constants ¶
This section is empty.
Variables ¶
View Source
var PassphrasePrompt = func(confirm bool) ([]byte, error) { fmt.Printf("Password: ") passphrase, err := terminal.ReadPassword(0) if err != nil { return nil, err } fmt.Println() if !confirm { return passphrase, nil } fmt.Printf("Confirm password: ") confirmPassphrase, err := terminal.ReadPassword(0) if err != nil { return nil, err } defer zero(&confirmPassphrase) fmt.Println() if !bytes.Equal(passphrase, confirmPassphrase) { return nil, errors.New("passphrases don't match") } return passphrase, nil }
PassphrasePrompt prompts the user for a passphrase. If confirm is true, the passphrase will be confirmed.
Functions ¶
func GenerateKey ¶
func GenerateKey(keyPath string, passphrase []byte, opts *GenerateOptions) error
GenerateKey generates a new signify keypair under keypath.sec and keypath.pub. If passphrase is provided, the private key is encrypted. If opts is nil, a set of sane defaults is provided.
func GenerateKeypair ¶
func GenerateKeypair(passphrase []byte, opts *GenerateOptions) (*Private, *Public, error)
GenerateKeypair returns a new private and public key.
Types ¶
type GenerateOptions ¶
type GenerateOptions struct {
Rounds int
}
GenerateOptions control the generation of private keys.
type Private ¶
type Private struct {
// contains filtered or unexported fields
}
Private is a signify private key.
func LoadPrivateKey ¶
LoadPrivateKey reads a signify private key from disk.
func (*Private) IsEncrypted ¶
IsEncrypted returns true if the key is passphrase-protected.
type Public ¶
type Public struct {
// contains filtered or unexported fields
}
Public is a Signify public key.
func LoadPublicKey ¶
LoadPublicKey reads a signify public key from disk.
Click to show internal directories.
Click to hide internal directories.