예제 #1
0
 public static string GetPublicKeyFormat(RSAKeyType type, string publicKey)
 {
     return(type switch
     {
         RSAKeyType.Pkcs1 => GetPkcs1PublicKeyFormat(publicKey),
         RSAKeyType.Pkcs8 => GetPkcs8PublicKeyFormat(publicKey),
         _ => throw new Exception($"Public key type {type.ToString()} does not support pem formatting.")
     });
예제 #2
0
        public static string GetPrivateKeyFormat(RSAKeyType type, string privateKey)
        {
            switch (type)
            {
            case RSAKeyType.Pkcs1:
                return(GetPkcs1PrivateKeyFormat(privateKey));

            case RSAKeyType.Pkcs8:
                return(GetPkcs8PrivateKeyFormat(privateKey));

            default:
                throw new Exception($"Private key type {type.ToString()} does not support pem formatting.");
            }
        }