From eb9f22a8fafa32f2316ef28dcb69438af8b5f09a Mon Sep 17 00:00:00 2001 From: Wade Simmons Date: Tue, 9 May 2023 14:05:55 -0400 Subject: [PATCH] fix mismerge of P256 and encrypted private keys (#869) The private key length is checked in a switch statement below these lines, these lines should have been removed. --- cert/cert.go | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/cert/cert.go b/cert/cert.go index c344292..8e5dbb9 100644 --- a/cert/cert.go +++ b/cert/cert.go @@ -407,14 +407,10 @@ func DecryptAndUnmarshalSigningPrivateKey(passphrase, b []byte) (Curve, []byte, return curve, nil, r, fmt.Errorf("unsupported encryption algorithm: %s", ned.EncryptionMetadata.EncryptionAlgorithm) } - if len(bytes) != ed25519.PrivateKeySize { - return curve, nil, r, fmt.Errorf("key was not 64 bytes, is invalid ed25519 private key") - } - switch curve { case Curve_CURVE25519: if len(bytes) != ed25519.PrivateKeySize { - return curve, nil, r, fmt.Errorf("key was not %d bytes, is invalid Ed25519 private key", ed25519.PrivateKeySize) + return curve, nil, r, fmt.Errorf("key was not %d bytes, is invalid ed25519 private key", ed25519.PrivateKeySize) } case Curve_P256: if len(bytes) != 32 {