Add support for RSA private key to TLS utils.
Co-authored-by: Thomas Detoux <detoux@gmail.com>
This commit is contained in:
parent
cae9b96b00
commit
99dd0953c4
|
@ -173,6 +173,10 @@ func ParseSigner(pemValue string) (crypto.Signer, error) {
|
||||||
switch block.Type {
|
switch block.Type {
|
||||||
case "EC PRIVATE KEY":
|
case "EC PRIVATE KEY":
|
||||||
return x509.ParseECPrivateKey(block.Bytes)
|
return x509.ParseECPrivateKey(block.Bytes)
|
||||||
|
|
||||||
|
case "RSA PRIVATE KEY":
|
||||||
|
return x509.ParsePKCS1PrivateKey(block.Bytes)
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return nil, fmt.Errorf("unknown PEM block type for signing key: %s", block.Type)
|
return nil, fmt.Errorf("unknown PEM block type for signing key: %s", block.Type)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue