Documentation ¶
Index ¶
- Variables
- func CopyKeyFile(fromFile, toFile string) error
- func CryptoKeyFromSSHKey(pk ssh.PublicKey) (interface{}, error)
- func LoadPEMPrivateKey(r io.Reader, passphrase []byte) (interface{}, error)
- func LoadPEMPublicKey(r io.Reader) (interface{}, error)
- func LoadPEMPublicKeyFile(filename string) (interface{}, error)
- func LoadSSHPublicKey(r io.Reader) (ssh.PublicKey, string, error)
- func LoadSSHPublicKeyFile(filename string) (ssh.PublicKey, string, error)
- func ParseECDSAKey(key ssh.PublicKey) (*ecdsa.PublicKey, error)
- func ParseED25519Key(key ssh.PublicKey) (ed25519.PublicKey, error)
- func SavePEMKeyPair(private, public io.Writer, key interface{}, passphrase []byte) error
- func WritePEMKeyPair(key interface{}, privateKeyFile, publicKeyFile string, passphrase []byte) error
Constants ¶
This section is empty.
Variables ¶
var ( // ErrBadPassphrase is a possible return error from LoadPEMPrivateKey() ErrBadPassphrase = errors.New("passphrase incorrect for decrypting private key") // ErrPassphraseRequired is a possible return error from LoadPEMPrivateKey() ErrPassphraseRequired = errors.New("passphrase required for decrypting private key") )
Functions ¶
func CopyKeyFile ¶
CopyKeyFile copies a keyfile, it wqill fail if it can't overwrite an existing file.
func CryptoKeyFromSSHKey ¶
CryptoKeyFromSSHKey returns one of *ecdsa.PublicKey or ed25519.PublicKey from the the supplied ssh PublicKey.
func LoadPEMPrivateKey ¶
loadPEMPrivateKey loads a key from 'r'. returns ErrBadPassphrase for incorrect Passphrase. If the key held in 'r' is unencrypted, 'passphrase' will be ignored.
func LoadPEMPublicKey ¶
LoadPEMPublicKey loads a public key in PEM PKIX format.
func LoadPEMPublicKeyFile ¶
LoadPEMPublicKeyFile loads a public key file in PEM PKIX format.
func LoadSSHPublicKey ¶
LoadSSHPublicKey loads a public key in SSH authorized hosts format.
func LoadSSHPublicKeyFile ¶
LoadSSHPublicKeyFile loads a public key file in SSH authorized hosts format.
func ParseECDSAKey ¶
ParseECDSAKey creates an ecdsa.PublicKey from an ssh ECDSA key.
func ParseED25519Key ¶
ParseED25519Key creates an ed25519.PublicKey from an ssh ED25519 key.
func SavePEMKeyPair ¶
SavePEMKey marshals 'key', encrypts it using 'passphrase', and saves the bytes to 'w' in PEM format. If passphrase is nil, the key will not be encrypted.
For example, if key is an ECDSA private key, it will be marshaled in ASN.1, DER format, encrypted, and then written in a PEM block.
func WritePEMKeyPair ¶
func WritePEMKeyPair(key interface{}, privateKeyFile, publicKeyFile string, passphrase []byte) error
WritePEMKeyPair writes a key pair in pem format.
Types ¶
This section is empty.
Directories ¶
Path | Synopsis |
---|---|
Package lockedfile creates and manipulates files whose contents should only change atomically.
|
Package lockedfile creates and manipulates files whose contents should only change atomically. |
filelock
Package filelock provides a platform-independent API for advisory file locking.
|
Package filelock provides a platform-independent API for advisory file locking. |