Skip to content

Commit

Permalink
agessh: reject small ssh-rsa keys
Browse files Browse the repository at this point in the history
Fixes #266
  • Loading branch information
FiloSottile committed May 24, 2021
1 parent 3d5b49a commit fb293ef
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions agessh/agessh.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ func NewRSARecipient(pk ssh.PublicKey) (*RSARecipient, error) {
} else {
return nil, errors.New("pk does not implement ssh.CryptoPublicKey")
}
if r.pubKey.Size() < 2048/8 {
return nil, errors.New("RSA key size is too small")
}
return r, nil
}

Expand Down

0 comments on commit fb293ef

Please sign in to comment.