Пример #1
0
 public void CopyTo(CipherContext ct)
 {
     ct.derive_key = derive_key;
     ct.pass       = pass;
     ct.pass_sz    = pass_sz;
     if (key != null)
     {
         ct.key = new byte[key.Length];
         key.CopyTo(ct.key, 0);
     }
     ct.key_sz = key_sz;
     if (iv != null)
     {
         ct.iv = new byte[iv.Length];
         iv.CopyTo(ct.iv, 0);
     }
     ct.iv_sz     = iv_sz;
     ct.encryptor = encryptor;
     ct.decryptor = decryptor;
 }
Пример #2
0
        public CipherContext Copy()
        {
            var c = new CipherContext();

            c.derive_key = derive_key;
            c.pass       = pass;
            c.pass_sz    = pass_sz;
            if (key != null)
            {
                c.key = new byte[key.Length];
                key.CopyTo(c.key, 0);
            }
            c.key_sz = key_sz;
            if (iv != null)
            {
                c.iv = new byte[iv.Length];
                iv.CopyTo(c.iv, 0);
            }
            c.iv_sz     = iv_sz;
            c.encryptor = encryptor;
            c.decryptor = decryptor;
            return(c);
        }