MCPcopy Create free account
hub / github.com/Scalingo/cli / isOpenSSHFormatEncrypted

Method isOpenSSHFormatEncrypted

crypto/sshkeys/private_key.go:53–63  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

51}
52
53func (p *PrivateKey) isOpenSSHFormatEncrypted() bool {
54 if p.Block.Type != "OPENSSH PRIVATE KEY" {
55 return false
56 }
57
58 _, err := ssh.ParseRawPrivateKey(pem.EncodeToMemory(p.Block))
59 if err != nil {
60 return strings.Contains(err.Error(), "this private key is passphrase protected")
61 }
62 return false
63}

Callers 1

isEncryptedMethod · 0.95

Calls 1

ErrorMethod · 0.80

Tested by

no test coverage detected