import "v.io/x/ref/lib/security/internal"
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") )
CopyKeyFile copies a keyfile, it wqill fail if it can't overwrite an existing file.
CryptoKeyFromSSHKey returns one of *ecdsa.PublicKey or ed25519.PublicKey from the the supplied ssh PublicKey.
loadPEMPrivateKey loads a key from 'r'. returns ErrBadPassphrase for incorrect Passphrase. If the key held in 'r' is unencrypted, 'passphrase' will be ignored.
LoadPEMPublicKey loads a public key in PEM PKIX format.
LoadPEMPublicKeyFile loads a public key file in PEM PKIX format.
LoadSSHPublicKey loads a public key in SSH authorized hosts format.
LoadSSHPublicKeyFile loads a public key file in SSH authorized hosts format.
ParseECDSAKey creates an ecdsa.PublicKey from an ssh ECDSA key.
ParseED25519Key creates an ed25519.PublicKey from an ssh ED25519 key.
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(key interface{}, privateKeyFile, publicKeyFile string, passphrase []byte) error
WritePEMKeyPair writes a key pair in pem format.
Path | Synopsis |
---|---|
lockedfile | Package lockedfile creates and manipulates files whose contents should only change atomically. |
lockedfile/filelock | Package filelock provides a platform-independent API for advisory file locking. |
lockedfile/testenv |
Package internal imports 13 packages (graph) and is imported by 8 packages. Updated 2020-10-24. Refresh now. Tools for package owners.