From e02edc50e49b70c7c01be866606c94c3a297e845 Mon Sep 17 00:00:00 2001 From: toshikihigaki Date: Fri, 26 Jul 2019 16:30:49 +0900 Subject: [PATCH] add parser --- ecdsa_utils.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ecdsa_utils.go b/ecdsa_utils.go index d19624b..db9f4be 100644 --- a/ecdsa_utils.go +++ b/ecdsa_utils.go @@ -25,7 +25,9 @@ func ParseECPrivateKeyFromPEM(key []byte) (*ecdsa.PrivateKey, error) { // Parse the key var parsedKey interface{} if parsedKey, err = x509.ParseECPrivateKey(block.Bytes); err != nil { - return nil, err + if parsedKey, err = x509.ParsePKCS8PrivateKey(block.Bytes); err != nil { + return nil, err + } } var pkey *ecdsa.PrivateKey