diff --git a/certtostore.go b/certtostore.go index 0a5a993..293ffa5 100644 --- a/certtostore.go +++ b/certtostore.go @@ -43,6 +43,17 @@ const ( RSA Algorithm = "RSA" ) +func (a Algorithm) Tox509() x509.PublicKeyAlgorithm { + switch a { + case EC: + return x509.ECDSA + case RSA: + return x509.RSA + default: + return 0 + } +} + // GenerateOpts holds parameters used to generate a private key. type GenerateOpts struct { // Algorithm to be used, either RSA or EC.