Skip to content

Commit 8fa50d0

Browse files
committed
use pem block
1 parent 0291c5b commit 8fa50d0

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

functions/sign_string_rs256_pkcs8.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55
"crypto/rsa"
66
"crypto/sha256"
77
"encoding/base64"
8+
"encoding/pem"
89
"errors"
910
"fmt"
1011
"strings"
@@ -30,11 +31,11 @@ func SignStringRS256PKCS8(existingHeaders map[string]string, args []string) (str
3031
stringToSign := argsToStringToSign(existingHeaders, args[1:])
3132

3233
// Get the key in PEM format
33-
//pemBlock, _ := pem.Decode([]byte(key))
34+
pemBlock, _ := pem.Decode([]byte(key))
3435

3536
// Parse the key, decrypting it if necessary
3637
//decryptedKey, err := pkcs8.ParsePKCS8PrivateKey(pemBlock.Bytes, []byte(passphrase))
37-
decryptedKey, err := pkcs8.ParsePKCS8PrivateKey([]byte(key))
38+
decryptedKey, err := pkcs8.ParsePKCS8PrivateKey(pemBlock.Bytes)
3839

3940
if err != nil {
4041
return "", fmt.Errorf("error calling SignStringRS256PKCS8; unable to parse private key: %w", err)

0 commit comments

Comments
 (0)