Example #1
0
        static OpensslCipher()
        {
            string loadingFailure = null;

            try
            {
                if (!NativeCodeLoader.BuildSupportsOpenssl())
                {
                    loadingFailure = "build does not support openssl.";
                }
                else
                {
                    InitIDs();
                }
            }
            catch (Exception t)
            {
                loadingFailure = t.Message;
                Log.Debug("Failed to load OpenSSL Cipher.", t);
            }
            finally
            {
                loadingFailureReason = loadingFailure;
            }
        }
Example #2
0
 /// <exception cref="System.Exception"/>
 public virtual void TestOpensslAesCtrCryptoCodec()
 {
     GenericTestUtils.AssumeInNativeProfile();
     if (!NativeCodeLoader.BuildSupportsOpenssl())
     {
         Log.Warn("Skipping test since openSSL library not loaded");
         Assume.AssumeTrue(false);
     }
     Assert.Equal(null, OpensslCipher.GetLoadingFailureReason());
     CryptoCodecTest(conf, seed, 0, opensslCodecClass, opensslCodecClass, iv);
     CryptoCodecTest(conf, seed, count, opensslCodecClass, opensslCodecClass, iv);
     CryptoCodecTest(conf, seed, count, opensslCodecClass, jceCodecClass, iv);
     // Overflow test, IV: xx xx xx xx xx xx xx xx ff ff ff ff ff ff ff ff
     for (int i = 0; i < 8; i++)
     {
         iv[8 + i] = unchecked ((byte)unchecked ((int)(0xff)));
     }
     CryptoCodecTest(conf, seed, count, opensslCodecClass, opensslCodecClass, iv);
     CryptoCodecTest(conf, seed, count, opensslCodecClass, jceCodecClass, iv);
 }