parseDSA parses an DSA key according to RFC 4253, section 6.6.
(in []byte)
| 137 | |
| 138 | // parseDSA parses an DSA key according to RFC 4253, section 6.6. |
| 139 | func parseDSA(in []byte) (*dsa.PublicKey, error) { |
| 140 | var w struct { |
| 141 | P, Q, G, Y *big.Int |
| 142 | Rest []byte `ssh:"rest"` |
| 143 | } |
| 144 | if err := ssh.Unmarshal(in, &w); err != nil { |
| 145 | return nil, errors.Wrap(err, "error unmarshaling public key") |
| 146 | } |
| 147 | |
| 148 | param := dsa.Parameters{ |
| 149 | P: w.P, |
| 150 | Q: w.Q, |
| 151 | G: w.G, |
| 152 | } |
| 153 | return &dsa.PublicKey{ |
| 154 | Parameters: param, |
| 155 | Y: w.Y, |
| 156 | }, nil |
| 157 | } |
| 158 | |
| 159 | // parseRSA parses an RSA key according to RFC 4253, section 6.6. |
| 160 | func parseRSA(in []byte) (*rsa.PublicKey, error) { |
no outgoing calls
no test coverage detected
searching dependent graphs…