Beispiel #1
0
        private static ICryptoTransform GetCryptoTransform(bool fEncrypt)
        {
            InterlockedStack st = (fEncrypt ? s_oEncryptorStack : s_oDecryptorStack);
            ICryptoTransform ct = (st.Pop() as ICryptoTransform);

            if (null == ct)
            {
                ct = NewCryptTransform(fEncrypt);
            }
            return(ct);
        }
Beispiel #2
0
        private static void ConfigureEncryptionObject()
        {
            lock (s_initLock) {
                if (null == s_oDes)
                {
                    s_oEncryptorStack = new InterlockedStack();
                    s_oDecryptorStack = new InterlockedStack();
                    s_oHashAlgoStack  = new InterlockedStack();

                    DESCryptoServiceProvider des = new DESCryptoServiceProvider();
                    des.GenerateKey();
                    des.GenerateIV();
                    s_oDes = des;
                }
            }
        }
Beispiel #3
0
        private static void ReturnCryptoTransform(bool fEncrypt, ICryptoTransform ct)
        {
            InterlockedStack st = (fEncrypt ? s_oEncryptorStack : s_oDecryptorStack);

            st.Push(ct);
        }