mirror of
https://github.com/Mic92/sops-nix.git
synced 2026-01-10 15:42:39 +08:00
make golangci-lint happy
This commit is contained in:
parent
16c3c3e39c
commit
fd28d45f10
3 changed files with 8 additions and 26 deletions
|
|
@ -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 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue