Skip to content

Commit eb48c60

Browse files
authored
tests: compare RSA priv keys ignoring precomputed (#2481)
1 parent 51aaf75 commit eb48c60

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

certcrypto/crypto_test.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,10 +168,12 @@ func TestParsePEMPrivateKey(t *testing.T) {
168168

169169
pemPrivateKey := PEMEncode(privateKey)
170170

171-
// Decoding a key should work and create an identical key to the original
171+
// Decoding a key should work and create an identical RSA key to the original,
172+
// ignoring precomputed values.
172173
decoded, err := ParsePEMPrivateKey(pemPrivateKey)
173174
require.NoError(t, err)
174-
assert.Equal(t, decoded, privateKey)
175+
decodedRsaPrivateKey := decoded.(*rsa.PrivateKey)
176+
require.True(t, decodedRsaPrivateKey.Equal(privateKey))
175177

176178
// Decoding a PEM block that doesn't contain a private key should error
177179
_, err = ParsePEMPrivateKey(pem.EncodeToMemory(&pem.Block{Type: "CERTIFICATE"}))

0 commit comments

Comments
 (0)