mirror of
https://github.com/pomerium/pomerium.git
synced 2025-07-25 04:28:35 +02:00
fix pem normalization when file has no trailing newline (#5645)
This commit is contained in:
parent
9631d9ff1c
commit
4988aea751
2 changed files with 11 additions and 0 deletions
|
@ -1,6 +1,7 @@
|
|||
package cryptutil_test
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"slices"
|
||||
"testing"
|
||||
|
||||
|
@ -23,6 +24,11 @@ func TestNormalizePEM(t *testing.T) {
|
|||
input: slices.Concat(rootCA.PublicPEM, intermediateCA.PublicPEM, cert.PublicPEM, cert.PrivateKeyPEM),
|
||||
expect: slices.Concat(cert.PublicPEM, cert.PrivateKeyPEM, intermediateCA.PublicPEM, rootCA.PublicPEM),
|
||||
},
|
||||
{
|
||||
// make sure we handle a file without a trailing newline
|
||||
input: slices.Concat(intermediateCA.PublicPEM, bytes.TrimRight(cert.PublicPEM, "\n")),
|
||||
expect: slices.Concat(cert.PublicPEM, intermediateCA.PublicPEM),
|
||||
},
|
||||
{
|
||||
input: slices.Concat(cert.PublicPEM, cert.PrivateKeyPEM, intermediateCA.PublicPEM, rootCA.PublicPEM),
|
||||
expect: slices.Concat(cert.PublicPEM, cert.PrivateKeyPEM, intermediateCA.PublicPEM, rootCA.PublicPEM),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue