Esempio n. 1
0
 static EncryptorFactory()
 {
     _registeredEncryptors = new Dictionary <string, Type>();
     foreach (string method in PolarSSLEncryptor.SupportedCiphers())
     {
         _registeredEncryptors.Add(method, typeof(PolarSSLEncryptor));
     }
     foreach (string method in SodiumEncryptor.SupportedCiphers())
     {
         _registeredEncryptors.Add(method, typeof(SodiumEncryptor));
     }
 }
        static EncryptorFactory()
        {
            _registeredEncryptors     = new Dictionary <string, Type>();
            _registeredEncryptorNames = new List <string>();
            foreach (string method in NoneEncryptor.SupportedCiphers())
            {
                if (!_registeredEncryptorNames.Contains(method))
                {
                    _registeredEncryptorNames.Add(method);
                    _registeredEncryptors.Add(method, typeof(NoneEncryptor));
                }
            }

            {
                foreach (string method in MbedTLSEncryptor.SupportedCiphers())
                {
                    if (!_registeredEncryptorNames.Contains(method))
                    {
                        _registeredEncryptorNames.Add(method);
                        _registeredEncryptors.Add(method, typeof(MbedTLSEncryptor));
                    }
                }
            }
            if (LibcryptoEncryptor.isSupport())
            {
                LibcryptoEncryptor.InitAviable();
                foreach (string method in LibcryptoEncryptor.SupportedCiphers())
                {
                    if (!_registeredEncryptorNames.Contains(method))
                    {
                        _registeredEncryptorNames.Add(method);
                        _registeredEncryptors.Add(method, typeof(LibcryptoEncryptor));
                    }
                }
            }
            foreach (string method in SodiumEncryptor.SupportedCiphers())
            {
                if (!_registeredEncryptorNames.Contains(method))
                {
                    _registeredEncryptorNames.Add(method);
                    _registeredEncryptors.Add(method, typeof(SodiumEncryptor));
                }
            }
        }
        static EncryptorFactory()
        {
            var dllPath = "libsscrypto.dll";

            LoadLibrary(dllPath);

            _registeredEncryptors = new Dictionary <string, Type>();
            foreach (string method in TableEncryptor.SupportedCiphers())
            {
                _registeredEncryptors.Add(method, typeof(TableEncryptor));
            }
            foreach (string method in PolarSSLEncryptor.SupportedCiphers())
            {
                _registeredEncryptors.Add(method, typeof(PolarSSLEncryptor));
            }
            foreach (string method in SodiumEncryptor.SupportedCiphers())
            {
                _registeredEncryptors.Add(method, typeof(SodiumEncryptor));
            }
        }