Example #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;
        }
Example #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;
     }
 }
Example #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;
     }
 }
Example #4
0
 public void Dispose()
 {
     sink.Dispose();
 }
Example #5
0
 public void Dispose()
 {
     cipher.Dispose();
     sink.Dispose();
 }