1
0
mirror of synced 2026-02-13 21:16:57 +00:00

Set min value for the --ssh-rsa-bits flag

Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
This commit is contained in:
Stefan Prodan
2023-08-21 19:39:19 +03:00
parent a9e09b856f
commit 2c76c70205
2 changed files with 6 additions and 3 deletions

View File

@@ -39,6 +39,9 @@ func (b *RSAKeyBits) Set(str string) error {
if err != nil {
return err
}
if bits < 1024 {
return fmt.Errorf("RSA key bit size must be at least 1024")
}
if bits == 0 || bits%8 != 0 {
return fmt.Errorf("RSA key bit size must be a multiples of 8")
}
@@ -51,5 +54,5 @@ func (b *RSAKeyBits) Type() string {
}
func (b *RSAKeyBits) Description() string {
return "SSH RSA public key bit size (multiplies of 8)"
return "SSH RSA public key bit size (multiplies of 8, min 1024)"
}