Esempio n. 1
0
        public void setOutputSecurityCodec(byte[] key, bool compress)
        {
            if (Trace.isInfoEnabled())
            {
                Trace.info(manager + " " + this + " setOutputSecurityCodec key = " + (key == null ? "" : Helper.toHexString(key)) + " compress = " + compress);
            }
            Codec codec = new BufferedSink(new NetTaskCodecSink(this));

            if (null != key)
            {
                codec = new Encrypt(codec, key);
            }
            if (compress)
            {
                codec = new RFC2118Encode(codec);
            }
            output.Dispose();
            output = codec;
        }
Esempio n. 2
0
 public void SetInputSecurityCodec(byte[] key, bool compress)
 {
     lock (this)
     {
         Codec chain = inputCodecBuffer;
         if (compress)
         {
             chain = new Decompress(chain);
         }
         if (null != key)
         {
             chain = new Decrypt(chain, key);
         }
         inputCodecChain?.Dispose();
         inputCodecChain = chain;
         IsInputSecurity = true;
     }
 }
Esempio n. 3
0
 public void SetOutputSecurityCodec(byte[] key, bool compress)
 {
     lock (this)
     {
         Codec chain = outputCodecBuffer;
         if (null != key)
         {
             chain = new Encrypt(chain, key);
         }
         if (compress)
         {
             chain = new Compress(chain);
         }
         outputCodecChain?.Dispose();
         outputCodecChain = chain;
         IsOutputSecurity = true;
     }
 }
Esempio n. 4
0
 public void Dispose()
 {
     sink.Dispose();
 }
Esempio n. 5
0
 public void Dispose()
 {
     cipher.Dispose();
     sink.Dispose();
 }