agessh: reject small ssh-rsa keys

Fixes #266
This commit is contained in:
Filippo Valsorda
2021-05-24 03:45:43 +02:00
parent 3d5b49a348
commit fb293ef526

View File

@@ -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
}