16 lines
267 B
Go
16 lines
267 B
Go
package data
|
|
|
|
import(
|
|
"crypto/rsa"
|
|
"encoding/pem"
|
|
"crypto/x509"
|
|
)
|
|
|
|
func parsePrivateKey(pemBytes []byte) (*rsa.PrivateKey, error) {
|
|
block, _ := pem.Decode(pemBytes)
|
|
if block == nil {
|
|
return nil, ErrFailedPEM
|
|
}
|
|
return x509.ParsePKCS1PrivateKey(block.Bytes)
|
|
}
|