private IAsymmetricKey GetKey(byte[] keyContent, string algorithmId, AsymmetricKeyType keyType)
        {
            var cipherType = cipherTypeMapper.MapOidToCipherType(algorithmId);

            switch (cipherType)
            {
            case CipherType.Rsa:
                return(rsaKeyProvider.GetKey(keyContent, keyType));

            case CipherType.Dsa:
                return(dsaKeyProvider.GetKey(keyContent, keyType));

            case CipherType.Ec:
                return(ecKeyProvider.GetKey(keyContent, keyType));

            case CipherType.ElGamal:
                return(elGamalKeyProvider.GetKey(keyContent, keyType));

            default:
                throw new ArgumentException("Key type not supported or key is corrupted.");
            }
        }
예제 #2
0
 public CipherType ShouldMapCipherType(string oid)
 {
     return(cipherTypeMapper.MapOidToCipherType(oid));
 }