示例#1
0
        public void Test_ScramSHA256SASLMechanism_4()
        {
            ScramSHA256SASLMechanism mechanism = new ScramSHA256SASLMechanism("user", "pencil", "rOprNGfwEbeRWgbNEkqO", null);

            mechanism.getSelectSASLMechanismMessage();
            MessageParser2           parser    = new MessageParser2();
            string                   s         = "<challenge xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>cj1yT3ByTkdmd0ViZVJXZ2JORWtxTyVodllEcFdVYTJSYVRDQWZ1eEZJbGopaE5sRiRrMCxzPVcyMlphSjBTTlk3c29Fc1VFamI2Z1E9PSxpPTQwOTY=</challenge>";
            List <AbstractMessage>   msgs      = parser.parseMessages(ref s);
            ScramSHAChallengeMessage challenge = (ScramSHAChallengeMessage)msgs[0];
            AbstractMessage          resp      = mechanism.generateResponse(challenge);

            Assert.IsTrue(resp is ScramSHAChallengeSolutionMessage);
        }
示例#2
0
        public void Test_ScramSHA256SASLMechanism_5()
        {
            ScramSHA256SASLMechanism mechanism = new ScramSHA256SASLMechanism("user", "pencil", "rOprNGfwEbeRWgbNEkqO", null);

            mechanism.getSelectSASLMechanismMessage();
            MessageParser2                   parser    = new MessageParser2();
            string                           s         = "<challenge xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>cj1yT3ByTkdmd0ViZVJXZ2JORWtxTyVodllEcFdVYTJSYVRDQWZ1eEZJbGopaE5sRiRrMCxzPVcyMlphSjBTTlk3c29Fc1VFamI2Z1E9PSxpPTQwOTY=</challenge>";
            List <AbstractMessage>           msgs      = parser.parseMessages(ref s);
            ScramSHAChallengeMessage         challenge = (ScramSHAChallengeMessage)msgs[0];
            AbstractMessage                  resp      = mechanism.generateResponse(challenge);
            ScramSHAChallengeSolutionMessage respMsg   = (ScramSHAChallengeSolutionMessage)resp;

            Assert.IsTrue(string.Equals("Yz1iaXdzLHI9ck9wck5HZndFYmVSV2diTkVrcU8laHZZRHBXVWEyUmFUQ0FmdXhGSWxqKWhObEYkazAscD1kSHpiWmFwV0lrNGpVaE4rVXRlOXl0YWc5empmTUhnc3FtbWl6N0FuZFZRPQ==".ToLower(), respMsg.SOLUTION.ToLower()));
        }