remove deprecated encrypted private key conversion
This commit is contained in:
parent
5715d1528f
commit
6cc3c91d07
1 changed files with 0 additions and 8 deletions
|
@ -8,15 +8,7 @@ import (
|
||||||
|
|
||||||
func BytesToPrivateKey(priv []byte) (*rsa.PrivateKey, error) {
|
func BytesToPrivateKey(priv []byte) (*rsa.PrivateKey, error) {
|
||||||
block, _ := pem.Decode(priv)
|
block, _ := pem.Decode(priv)
|
||||||
enc := x509.IsEncryptedPEMBlock(block)
|
|
||||||
b := block.Bytes
|
b := block.Bytes
|
||||||
var err error
|
|
||||||
if enc {
|
|
||||||
b, err = x509.DecryptPEMBlock(block, nil)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
key, err := x509.ParsePKCS1PrivateKey(b)
|
key, err := x509.ParsePKCS1PrivateKey(b)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue