Add support for RSA private key to TLS utils.

Co-authored-by: Thomas Detoux <detoux@gmail.com>
This commit is contained in:
William 2020-04-08 21:46:31 -07:00 committed by jsosulska
parent cae9b96b00
commit 99dd0953c4
1 changed files with 4 additions and 0 deletions

View File

@ -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)
} }