Skip to content

Commit

Permalink
fix mismerge of P256 and encrypted private keys (#869)
Browse files Browse the repository at this point in the history
The private key length is checked in a switch statement below these
lines, these lines should have been removed.
  • Loading branch information
wadey authored May 9, 2023
1 parent 54a8499 commit eb9f22a
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions cert/cert.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit eb9f22a

Please sign in to comment.