func GetEncryptedPrivateKeyAuthority(d Depot, passphrase []byte) (key *pkix.Key, err error) { b, err := d.Get(AuthPrivKeyTag()) if err != nil { return nil, err } return pkix.NewKeyFromEncryptedPrivateKeyPEM(b, passphrase) }
func GetEncryptedPrivateKeyHost(d Depot, name string, passphrase []byte) (key *pkix.Key, err error) { b, err := d.Get(HostPrivKeyTag(name)) if err != nil { return nil, err } return pkix.NewKeyFromEncryptedPrivateKeyPEM(b, passphrase) }
func decryptEncryptedKeyTarFile(file *TarFile, passphrase []byte) (*TarFile, error) { key, err := pkix.NewKeyFromEncryptedPrivateKeyPEM(file.Data, passphrase) if err != nil { return nil, err } file.Data, err = key.ExportPrivate() if err != nil { return nil, err } file.Header.Name += insecureSuffix file.Header.Size = int64(len(file.Data)) return file, nil }