Exemplo n.º 1
0
        public void Encrypt()
        {
            var key        = RcFactory.GenerateKey("alexinea", Encoding.UTF8);
            var function   = RcFactory.Create(RcTypes.RC4, key);
            var cryptoVal0 = function.Encrypt("image");

            BaseConv.ToBase64(cryptoVal0.CipherData).ShouldBe("I2YRaZo=");
        }
Exemplo n.º 2
0
        public void Encrypt_ThreeRCX()
        {
            var key        = RcFactory.GenerateKey("alexinea", Encoding.UTF8);
            var function   = RcFactory.Create(RcTypes.ThreeRCX, key);
            var cryptoVal0 = function.Encrypt("ABCDDDDDDDDDDDDDDDDDDDDDD");

            BaseConv.ToBase64(cryptoVal0.CipherData).ShouldBe("JPTCrl2N6xae4GCEXfzUiSa9YrwSa80HDg==");
        }
Exemplo n.º 3
0
        public void Encrypt()
        {
            var key        = RcFactory.GenerateKey("alexinea", Encoding.UTF8);
            var function   = RcFactory.Create(RcTypes.RCX, key);
            var cryptoVal0 = function.Encrypt("ABCDDDDDDDDDDDDDDDDDDDDDD");

            BaseConv.ToBase64(cryptoVal0.CipherData).ShouldBe("C+YxcfWRWMVCIjbX21qXcG9OXq25jJTHmw==");
        }
Exemplo n.º 4
0
        public void Decrypt()
        {
            var key        = RcFactory.GenerateKey("alexinea", Encoding.UTF8);
            var function   = RcFactory.Create(RcTypes.RC4, key);
            var cryptoVal0 = function.Encrypt("image");

            var cryptoVal1 = function.Decrypt(cryptoVal0.CipherData);

            cryptoVal1.GetOriginalDataDescriptor().GetString().ShouldBe("image");

            var cryptoVal2 = function.Decrypt("I2YRaZo=", CipherTextTypes.Base64Text);

            cryptoVal2.GetOriginalDataDescriptor().GetString().ShouldBe("image");
        }
Exemplo n.º 5
0
        public void Decrypt_ThreeRCX()
        {
            var key        = RcFactory.GenerateKey("alexinea", Encoding.UTF8);
            var function   = RcFactory.Create(RcTypes.ThreeRCX, key);
            var cryptoVal0 = function.Encrypt("ABCDDDDDDDDDDDDDDDDDDDDDD");

            var cryptoVal1 = function.Decrypt(cryptoVal0.CipherData);

            cryptoVal1.GetOriginalDataDescriptor().GetString().ShouldBe("ABCDDDDDDDDDDDDDDDDDDDDDD");

            var cryptoVal2 = function.Decrypt("JPTCrl2N6xae4GCEXfzUiSa9YrwSa80HDg==", CipherTextTypes.Base64Text);

            cryptoVal2.GetOriginalDataDescriptor().GetString().ShouldBe("ABCDDDDDDDDDDDDDDDDDDDDDD");
        }
Exemplo n.º 6
0
        public void Decrypt()
        {
            var key        = RcFactory.GenerateKey("alexinea", Encoding.UTF8);
            var function   = RcFactory.Create(RcTypes.RCX, key);
            var cryptoVal0 = function.Encrypt("ABCDDDDDDDDDDDDDDDDDDDDDD");

            var cryptoVal1 = function.Decrypt(cryptoVal0.CipherData);

            cryptoVal1.GetOriginalDataDescriptor().GetString().ShouldBe("ABCDDDDDDDDDDDDDDDDDDDDDD");

            var cryptoVal2 = function.Decrypt("C+YxcfWRWMVCIjbX21qXcG9OXq25jJTHmw==", CipherTextTypes.Base64Text);

            cryptoVal2.GetOriginalDataDescriptor().GetString().ShouldBe("ABCDDDDDDDDDDDDDDDDDDDDDD");
        }