mirror of
https://github.com/go-acme/lego
synced 2026-03-14 14:35:48 +01:00
tests: compare RSA priv keys ignoring precomputed (#2481)
This commit is contained in:
parent
51aaf75afb
commit
eb48c607ad
1 changed files with 4 additions and 2 deletions
|
|
@ -168,10 +168,12 @@ func TestParsePEMPrivateKey(t *testing.T) {
|
|||
|
||||
pemPrivateKey := PEMEncode(privateKey)
|
||||
|
||||
// Decoding a key should work and create an identical key to the original
|
||||
// Decoding a key should work and create an identical RSA key to the original,
|
||||
// ignoring precomputed values.
|
||||
decoded, err := ParsePEMPrivateKey(pemPrivateKey)
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, decoded, privateKey)
|
||||
decodedRsaPrivateKey := decoded.(*rsa.PrivateKey)
|
||||
require.True(t, decodedRsaPrivateKey.Equal(privateKey))
|
||||
|
||||
// Decoding a PEM block that doesn't contain a private key should error
|
||||
_, err = ParsePEMPrivateKey(pem.EncodeToMemory(&pem.Block{Type: "CERTIFICATE"}))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue