ParseRSAPrivateKey parses an RSA private key.
(data []byte)
| 78 | |
| 79 | // ParseRSAPrivateKey parses an RSA private key. |
| 80 | func 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. |
| 95 | func GenerateRSAPrivateKey() (PrivateKey, error) { |