Beispiel #1
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public override Tag Initialize()
        {
            base.Initialize();
            Logger.Debug(this, "Initializing SCRAM Processor");

            Logger.Debug(this, "Generating nonce");
            _nonce = NextInt64().ToString();
            Logger.DebugFormat(this, "Nonce: {0}", _nonce);
            Logger.Debug(this, "Building Initial Message");
            var msg = new StringBuilder();

            msg.Append("n,,n=");
            msg.Append(Id.User);
            msg.Append(",r=");
            msg.Append(_nonce);
            Logger.DebugFormat(this, "Message: {0}", msg.ToString());

            _clientFirst = msg.ToString().Substring(3);

            var tag = TagRegistry.GetTag <Auth>("auth", Namespaces.SASL);

            tag.Mechanism = Mechanism.GetMechanism(MechanismType.SCRAM);
            tag.Bytes     = _utf.GetBytes(msg.ToString());
            return(tag);
        }
Beispiel #2
0
        /// <summary>
        ///     Initialize the processor
        /// </summary>
        /// <returns>An auth tag to start the authentication process</returns>
        public override Tag Initialize(string id, string password)
        {
            base.Initialize(id, password);

            var tag = TagRegistry.GetTag <Auth>("auth", Namespaces.Sasl);

            tag.Mechanism = Mechanism.GetMechanism(MechanismType.DigestMd5);
            return(tag);
        }
Beispiel #3
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public override Tag Initialize()
        {
            base.Initialize();

            var tag = TagRegistry.GetTag <Auth>("auth", Namespaces.SASL);

            tag.Mechanism = Mechanism.GetMechanism(MechanismType.DigestMD5);
            return(tag);
        }
Beispiel #4
0
        /// <summary>
        /// </summary>
        /// <exception cref="NotImplementedException"></exception>
        public override Tag Initialize(String id, String password)
        {
            base.Initialize(id, password);

            var sb = new StringBuilder();

            sb.Append((char)0);
            sb.Append(Id.User);
            sb.Append((char)0);
            sb.Append(Password);

            var auth = TagRegistry.GetTag <Auth>("auth", Namespaces.Sasl);

            auth.Text      = Convert.ToBase64String(Encoding.UTF8.GetBytes(sb.ToString()));
            auth.Mechanism = Mechanism.GetMechanism(MechanismType.Plain);

            return(auth);
        }
Beispiel #5
0
        ///<summary>
        ///</summary>
        ///<exception cref="NotImplementedException"></exception>
        public override Tag Initialize()
        {
            Logger.Debug(this, "Initializing Plain Processor");
            Logger.DebugFormat(this, "ID User: {0}", UbietySettings.Id.User);

            var sb = new StringBuilder();

            sb.Append((char)0);
            sb.Append(UbietySettings.Id.User);
            sb.Append((char)0);
            sb.Append(UbietySettings.Password);

            var auth = TagRegistry.GetTag <Auth>("auth", Namespaces.SASL);

            auth.Text      = Convert.ToBase64String(Encoding.UTF8.GetBytes(sb.ToString()));
            auth.Mechanism = Mechanism.GetMechanism(MechanismType.Plain);

            return(auth);
        }
Beispiel #6
0
        /// <summary>
        /// </summary>
        /// <returns></returns>
        public override Tag Initialize(string id, string password)
        {
            base.Initialize(id, password);

            _nonce = NextInt64().ToString(CultureInfo.InvariantCulture);
            var msg = new StringBuilder();

            msg.Append("n,,n=");
            msg.Append(Id.User);
            msg.Append(",r=");
            msg.Append(_nonce);

            _clientFirst = msg.ToString().Substring(3);

            var tag = TagRegistry.GetTag <Auth>("auth", Namespaces.Sasl);

            tag.Mechanism = Mechanism.GetMechanism(MechanismType.Scram);
            tag.Bytes     = _utf.GetBytes(msg.ToString());
            return(tag);
        }