MCPcopy Create free account
hub / github.com/belak/gitdir / ParseRSAPrivateKey

Function ParseRSAPrivateKey

models/private_key.go:80–92  ·  view source on GitHub ↗

ParseRSAPrivateKey parses an RSA private key.

(data []byte)

Source from the content-addressed store, hash-verified

78
79// ParseRSAPrivateKey parses an RSA private key.
80func ParseRSAPrivateKey(data []byte) (PrivateKey, error) {
81 privateKey, err := gossh.ParseRawPrivateKey(data)
82 if err != nil {
83 return nil, err
84 }
85
86 rsaKey, ok := privateKey.(*rsa.PrivateKey)
87 if !ok {
88 return nil, errors.New("not an RSA key")
89 }
90
91 return &rsaPrivateKey{rsaKey}, nil
92}
93
94// GenerateRSAPrivateKey generates a new RSA private key of size 4096.
95func GenerateRSAPrivateKey() (PrivateKey, error) {

Callers 1

loadAdminConfigMethod · 0.92

Calls

no outgoing calls

Tested by

no test coverage detected