parseSSHIdentityFromPrivateKeyCmdOutput returns an age.Identity from the given private key. Note that encrypted private keys are not supported.
(key []byte)
| 575 | // parseSSHIdentityFromPrivateKeyCmdOutput returns an age.Identity from the given |
| 576 | // private key. Note that encrypted private keys are not supported. |
| 577 | func parseSSHIdentityFromPrivateKeyCmdOutput(key []byte) (age.Identity, error) { |
| 578 | id, err := agessh.ParseIdentity(key) |
| 579 | if sshErr, ok := err.(*ssh.PassphraseMissingError); ok { |
| 580 | return nil, fmt.Errorf("the SSH key returned by running SOPS_AGE_SSH_PRIVATE_KEY_CMD is password protected, which is unsupported. (%q)", sshErr) |
| 581 | } |
| 582 | if err != nil { |
| 583 | return nil, fmt.Errorf("malformed SSH identity returned by running SOPS_AGE_SSH_PRIVATE_KEY_CMD: %q", err) |
| 584 | } |
| 585 | return id, nil |
| 586 | } |
no outgoing calls
no test coverage detected