1 /* 2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. 3 * 4 * Use of this source code is governed by a BSD-style license 5 * that can be found in the LICENSE file in the root of the source 6 * tree. An additional intellectual property rights grant can be found 7 * in the file PATENTS. All contributing project authors may 8 * be found in the AUTHORS file in the root of the source tree. 9 */ 10 11 #include "webrtc/libjingle/xmllite/xmlelement.h" 12 #include "webrtc/libjingle/xmpp/constants.h" 13 #include "webrtc/libjingle/xmpp/saslmechanism.h" 14 #include "webrtc/base/base64.h" 15 16 using rtc::Base64; 17 18 namespace buzz { 19 20 XmlElement * StartSaslAuth()21SaslMechanism::StartSaslAuth() { 22 return new XmlElement(QN_SASL_AUTH, true); 23 } 24 25 XmlElement * HandleSaslChallenge(const XmlElement * challenge)26SaslMechanism::HandleSaslChallenge(const XmlElement * challenge) { 27 return new XmlElement(QN_SASL_ABORT, true); 28 } 29 30 void HandleSaslSuccess(const XmlElement * success)31SaslMechanism::HandleSaslSuccess(const XmlElement * success) { 32 } 33 34 void HandleSaslFailure(const XmlElement * failure)35SaslMechanism::HandleSaslFailure(const XmlElement * failure) { 36 } 37 38 std::string Base64Encode(const std::string & plain)39SaslMechanism::Base64Encode(const std::string & plain) { 40 return Base64::Encode(plain); 41 } 42 43 std::string Base64Decode(const std::string & encoded)44SaslMechanism::Base64Decode(const std::string & encoded) { 45 return Base64::Decode(encoded, Base64::DO_LAX); 46 } 47 48 std::string Base64EncodeFromArray(const char * plain,size_t length)49SaslMechanism::Base64EncodeFromArray(const char * plain, size_t length) { 50 std::string result; 51 Base64::EncodeFromArray(plain, length, &result); 52 return result; 53 } 54 55 } 56