Skip to content

Commit

Permalink
pem encode
Browse files Browse the repository at this point in the history
  • Loading branch information
strantalis committed Aug 10, 2024
1 parent ff79764 commit 5f10293
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions tests/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,18 @@ func generateKasRSAKeyPair() ([]byte, []byte, error) {
},
)

pubKeyPEM, err := x509.MarshalPKIXPublicKey(&pubKey)
pk, err := x509.MarshalPKIXPublicKey(&pubKey)
if err != nil {
return nil, nil, err
}

pubKeyPEM := pem.EncodeToMemory(
&pem.Block{
Type: "PUBLIC KEY",
Bytes: pk,
},
)

return privKeyPEM, pubKeyPEM, nil
}

Expand All @@ -44,11 +51,16 @@ func generateKasECDHKeyPair() ([]byte, []byte, error) {
Bytes: privKey.Bytes(),
}

pubKeyPEM, err := x509.MarshalPKIXPublicKey(pubKey)
pk, err := x509.MarshalPKIXPublicKey(pubKey)
if err != nil {
return nil, nil, err
}

pubKeyPEM := pem.EncodeToMemory(&pem.Block{
Type: "PUBLIC KEY",
Bytes: pk,
})

return pem.EncodeToMemory(&privKeyPEM), pubKeyPEM, nil

}

0 comments on commit 5f10293

Please sign in to comment.