Esempio n. 1
0
        internal SSL(SSLMode mode)
        {
            if (mode == SSLMode.RSA || mode == SSLMode.Both)
            {
                rsa           = new RSACryptoServiceProvider();
                RSAPublicKey  = rsa.ToXmlString(false);
                RSAPrivateKey = rsa.ToXmlString(true);
                rsa.FromXmlString(RSAPrivateKey);
            }

            if (mode == SSLMode.AES || mode == SSLMode.Both)
            {
                aes           = new RijndaelManaged();
                aes.Mode      = CipherMode.ECB;
                aes.Padding   = PaddingMode.PKCS7;
                aes.KeySize   = 128;
                aes.BlockSize = 128;
            }
        }
Esempio n. 2
0
        internal SSL(SSLMode mode, string rsaPublickey)
        {
            if (mode == SSLMode.RSA || mode == SSLMode.Both)
            {
                rsa          = new RSACryptoServiceProvider();
                RSAPublicKey = rsaPublickey;
                rsa.FromXmlString(RSAPublicKey);
            }

            if (mode == SSLMode.AES || mode == SSLMode.Both)
            {
                aes = new RijndaelManaged()
                {
                    Mode      = CipherMode.ECB,
                    Padding   = PaddingMode.PKCS7,
                    KeySize   = 128,
                    BlockSize = 128
                };
            }
        }