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
16using rtc::Base64;
17
18namespace buzz {
19
20XmlElement *
21SaslMechanism::StartSaslAuth() {
22  return new XmlElement(QN_SASL_AUTH, true);
23}
24
25XmlElement *
26SaslMechanism::HandleSaslChallenge(const XmlElement * challenge) {
27  return new XmlElement(QN_SASL_ABORT, true);
28}
29
30void
31SaslMechanism::HandleSaslSuccess(const XmlElement * success) {
32}
33
34void
35SaslMechanism::HandleSaslFailure(const XmlElement * failure) {
36}
37
38std::string
39SaslMechanism::Base64Encode(const std::string & plain) {
40  return Base64::Encode(plain);
41}
42
43std::string
44SaslMechanism::Base64Decode(const std::string & encoded) {
45  return Base64::Decode(encoded, Base64::DO_LAX);
46}
47
48std::string
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