Пример #1
0
        /// <summary>
        /// Constructs a SASLInputStream from an InputStream and a SaslClient <br />
        /// Note: if the specified InputStream or SaslClient is null, a
        /// NullPointerException may be thrown later when they are used.
        /// </summary>
        /// <param name="inStream">the InputStream to be processed</param>
        /// <param name="saslClient">an initialized SaslClient object</param>
        public SaslInputStream(InputStream inStream, SaslClient saslClient)
        {
            this.inStream   = new DataInputStream(inStream);
            this.saslServer = null;
            this.saslClient = saslClient;
            string qop = (string)saslClient.GetNegotiatedProperty(Javax.Security.Sasl.Sasl.Qop
                                                                  );

            this.useWrap = qop != null && !Runtime.EqualsIgnoreCase("auth", qop);
        }
Пример #2
0
 /// <summary>
 /// After successful SASL negotation, returns the negotiated quality of
 /// protection.
 /// </summary>
 /// <returns>negotiated quality of protection</returns>
 public virtual string GetNegotiatedQop()
 {
     if (saslClient != null)
     {
         return((string)saslClient.GetNegotiatedProperty(Javax.Security.Sasl.Sasl.Qop));
     }
     else
     {
         return((string)saslServer.GetNegotiatedProperty(Javax.Security.Sasl.Sasl.Qop));
     }
 }
Пример #3
0
        /// <summary>
        /// Constructs a SASLOutputStream from an OutputStream and a SaslClient <br />
        /// Note: if the specified OutputStream or SaslClient is null, a
        /// NullPointerException may be thrown later when they are used.
        /// </summary>
        /// <param name="outStream">the OutputStream to be processed</param>
        /// <param name="saslClient">an initialized SaslClient object</param>
        public SaslOutputStream(OutputStream outStream, SaslClient saslClient)
        {
            this.saslServer = null;
            this.saslClient = saslClient;
            string qop = (string)saslClient.GetNegotiatedProperty(Javax.Security.Sasl.Sasl.Qop
                                                                  );

            this.useWrap = qop != null && !Runtime.EqualsIgnoreCase("auth", qop);
            if (useWrap)
            {
                this.outStream = new BufferedOutputStream(outStream, 64 * 1024);
            }
            else
            {
                this.outStream = outStream;
            }
        }