Ejemplo n.º 1
0
        /// <summary>
        /// Initialize the serializer, consisting of the following stack:
        /// GZip -> Crypto -> MemoryStream
        /// </summary>
        /// <param name="key"></param>
        /// <param name="iv"></param>
        protected void InitializeSerializer(byte[] key, byte[] iv)
        {
            writeBuffer = new MemoryStream();
            EncryptTransformer et = new EncryptTransformer(EncryptionAlgorithm.Rijndael);

            et.IV = iv;
            ICryptoTransform ict = et.GetCryptoServiceProvider(key);

            encStream  = new CryptoStream(writeBuffer, ict, CryptoStreamMode.Write);
            comp       = new GZipStream(encStream, CompressionMode.Compress, true);                     // important to be set to true!
            serializer = new RawSerializer(comp);
        }
Ejemplo n.º 2
0
 public Encryptor(EncryptionAlgorithm algId)
 {
     transformer = new EncryptTransformer(algId);
 }
 public Encryptor(EncryptionAlgorithm algId)
 {
     transformer = new EncryptTransformer(algId);
 }