瀏覽代碼

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.
Wade Simmons 2 年之前
父節點
當前提交
eb9f22a8fa
共有 1 個文件被更改,包括 1 次插入5 次删除
  1. 1 5
      cert/cert.go

+ 1 - 5
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)
 		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 {
 	switch curve {
 	case Curve_CURVE25519:
 	case Curve_CURVE25519:
 		if len(bytes) != ed25519.PrivateKeySize {
 		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:
 	case Curve_P256:
 		if len(bytes) != 32 {
 		if len(bytes) != 32 {