From 58c692a58728b46bcc32aee425412fc36cdc5a75 Mon Sep 17 00:00:00 2001 From: Stephen Fox Date: Tue, 5 Feb 2019 09:52:46 -0500 Subject: [PATCH] Get bits from private key rather than user input. --- helper/ssh/key_pair.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/helper/ssh/key_pair.go b/helper/ssh/key_pair.go index 600f258e4..c18d7b8ad 100644 --- a/helper/ssh/key_pair.go +++ b/helper/ssh/key_pair.go @@ -157,7 +157,7 @@ func (o *defaultKeyPairBuilder) newEcdsaKeyPair() (KeyPair, error) { return &defaultKeyPair{ kind: Ecdsa, - bits: o.bits, + bits: privateKey.Curve.Params().BitSize, name: o.name, privateKeyDerBytes: raw, publicKey: sshPublicKey, @@ -182,7 +182,7 @@ func (o *defaultKeyPairBuilder) newRsaKeyPair() (KeyPair, error) { return &defaultKeyPair{ kind: Rsa, - bits: o.bits, + bits: privateKey.N.BitLen(), name: o.name, privateKeyDerBytes: x509.MarshalPKCS1PrivateKey(privateKey), publicKey: sshPublicKey,