コード例 #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));
     }
 }
コード例 #2
0
        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));
            }
        }
コード例 #3
0
 private void RunSingleRC4EncryptionThread()
 {
     try
     {
         for (int i = 0; i < 100; i++)
         {
             var random = new Random();
             IEncryptor encryptor;
             IEncryptor decryptor;
             encryptor = new PolarSSLEncryptor("rc4-md5", "barfoo!", false, false);
             decryptor = new PolarSSLEncryptor("rc4-md5", "barfoo!", false, false);
             RunEncryptionRound(encryptor, decryptor);
         }
     }
     catch
     {
         encryptionFailed = true;
         throw;
     }
 }
コード例 #4
0
 private void RunSinglePolarSSLEncryptionThread()
 {
     try
     {
         for (int i = 0; i < 100; i++)
         {
             IEncryptor encryptor;
             IEncryptor decryptor;
             encryptor = new PolarSSLEncryptor("aes-256-cfb", "barfoo!", false, false);
             decryptor = new PolarSSLEncryptor("aes-256-cfb", "barfoo!", false, false);
             RunEncryptionRound(encryptor, decryptor);
         }
     }
     catch
     {
         encryptionFailed = true;
         throw;
     }
 }