Skip to content

Commit

Permalink
service/cloudfront/sign: fix dropped test errors (#4236)
Browse files Browse the repository at this point in the history
This fixes two dropped test errors in service/cloudfront/sign
  • Loading branch information
alrs committed Jan 27, 2022
1 parent 28b1fd2 commit 5bcaccb
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions service/cloudfront/sign/privkey_test.go
Expand Up @@ -22,6 +22,9 @@ func generatePEM(randReader io.Reader, password []byte) (buf *bytes.Buffer, err
var block *pem.Block
if password != nil {
block, err = x509.EncryptPEMBlock(randReader, "RSA PRIVATE KEY", derBytes, password, x509.PEMCipherAES128)
if err != nil {
return nil, err
}
} else {
block = &pem.Block{
Type: "RSA PRIVATE KEY",
Expand Down Expand Up @@ -79,6 +82,9 @@ func TestLoadEncryptedPEMPrivKey(t *testing.T) {

func TestLoadEncryptedPEMPrivKeyWrongPassword(t *testing.T) {
reader, err := generatePEM(newRandomReader(rand.New(rand.NewSource(1))), []byte("password"))
if err != nil {
t.Errorf("Unexpected generatePEM error: %s", err)
}
privKey, err := LoadEncryptedPEMPrivKey(reader, []byte("wrong password"))

if err == nil {
Expand Down

0 comments on commit 5bcaccb

Please sign in to comment.