make golangci-lint happy

This commit is contained in:
Jörg Thalheim 2020-07-19 23:30:28 +01:00
parent 16c3c3e39c
commit fd28d45f10
No known key found for this signature in database
GPG key ID: 003F2096411B5F92
3 changed files with 8 additions and 26 deletions

View file

@ -12,27 +12,6 @@ import (
"golang.org/x/crypto/ssh"
)
func parsePublicKey(publicKey []byte) (*rsa.PublicKey, error) {
key, _, _, _, err := ssh.ParseAuthorizedKey(publicKey)
if err != nil {
return nil, fmt.Errorf("failed to parse public ssh key: %s", err)
}
cryptoPublicKey, ok := key.(ssh.CryptoPublicKey)
if !ok {
return nil, fmt.Errorf("Unsupported public key algo: %s", key.Type())
}
rsaKey, ok := cryptoPublicKey.CryptoPublicKey().(*rsa.PublicKey)
if !ok {
return nil, fmt.Errorf("Unsupported public key algo: %s", key.Type())
}
return rsaKey, nil
}
func parsePrivateKey(sshPrivateKey []byte) (*rsa.PrivateKey, error) {
privateKey, err := ssh.ParseRawPrivateKey(sshPrivateKey)
if err != nil {