| # kio Library API Documentation
Overview | Class Hierarchy | Classes | Classes (annotated) | Members | Source Files

# KDESasl Class Reference

This library can create responses for SASL authentication for a given challenge and a given secret. More...

`#include <kdesasl.h>`

Collaboration diagram for KDESasl:

[legend]
List of all members.

## Public Member Functions
| KDESasl (const KURL &aUrl)
| Construct a sasl object and initialize it with the username and password passed via the url.
| KDESasl (const QString &aUser, const QString &aPass, const QString &aProtocol)
| This is a conveniece funtion and differs from the above function only by what arguments it accepts.
virtual QCString | chooseMethod (const QStrIList aMethods)
virtual void | setMethod (const QCString &aMethod)
| Explicitely set the SASL method used.
QCString | getResponse (const QByteArray &aChallenge, bool aBase64=TRUE)
| Creates a response using the formerly chosen SASL method.
QByteArray | getBinaryResponse (const QByteArray &aChallenge, bool aBase64)
| Create a response as above but place it in a QByteArray.
## Protected Member Functions
virtual QByteArray | getPlainResponse ()
| PLAIN authentication as described in RFC 2595.
virtual QByteArray | getLoginResponse ()
| LOGIN authentication.
virtual QByteArray | getCramMd5Response (const QByteArray &aChallenge)
| CRAM-MD5 authentication as described in RFC 2195.
virtual QByteArray | getDigestMd5Response (const QByteArray &aChallenge)
| DIGEST-MD5 authentication as described in RFC 2831.

## Detailed Description

This library can create responses for SASL authentication for a given challenge and a given secret.

This way of authentication is common for SMTP, POP3, IMAP and LDAP.

SASL is one way strong encryption and therefore useful for authentication, but not for secret information transfer. It is possibly to prove with SASL to know a shared secret like a password. It is not possible with SASL to transfer any other information in an encrypted way. For that purpose OpenPGP or SSL are useful.

Currently PLAIN (RFC 2595), LOGIN, CRAM-MD5 (RFC 2195) and DIGEST-MD5 (RFC 2831) authentication are supported. PLAIN and LOGIN do only use encoding and not encryption.

Author:
  Michael Häckel <haeckel@kde.org>

Version:
  Id
    kdesasl.h,v 1.7 2002/01/18 08:09:38 haeckel Exp

Definition at line 47 of file kdesasl.h.

## Constructor & Destructor Documentation

KDESasl::KDESasl | ( | const KURL & | aUrl | ) |

| Construct a sasl object and initialize it with the username and password passed via the url. Definition at line 26 of file kdesasl.cpp. References KURL::pass(), KURL::protocol(), and KURL::user().

KDESasl::KDESasl | ( | const QString & | aUser,
|  | const QString & | aPass,
|  | const QString & | aProtocol
| ) |

| This is a conveniece funtion and differs from the above function only by what arguments it accepts. Definition at line 34 of file kdesasl.cpp.

## Member Function Documentation

QCString KDESasl::chooseMethod | ( | const QStrIList | aMethods | ) | `[virtual]`

| Returns: the most secure method from the given methods and use it for further operations. Definition at line 46 of file kdesasl.cpp.

void KDESasl::setMethod | ( | const QCString & | aMethod | ) | `[virtual]`

| Explicitely set the SASL method used. Definition at line 56 of file kdesasl.cpp.

QCString KDESasl::getResponse | ( | const QByteArray & | aChallenge,
|  | bool | aBase64 = TRUE
| ) |

  | Creates a response using the formerly chosen SASL method. For LOGIN authentication you have to call this function twice. KDESasl realizes on its own, if you are calling it for the first or for the second time. Parameters:
  aChallenge | is the challenge sent to create a response for
  aBase64 | specifies, whether the authentication protocol uses base64 encoding. The challenge is decoded from base64 and the response is encoded base64 if set to TRUE.
Definition at line 251 of file kdesasl.cpp. References getBinaryResponse().

QByteArray KDESasl::getBinaryResponse | ( | const QByteArray & | aChallenge,
|  | bool | aBase64
| ) |

| Create a response as above but place it in a QByteArray. Definition at line 232 of file kdesasl.cpp. References KCodecs::base64Decode(), KCodecs::base64Encode(), getCramMd5Response(), getDigestMd5Response(), getLoginResponse(), and getPlainResponse(). Referenced by getResponse().

QByteArray KDESasl::getPlainResponse | ( |  | ) | `[protected, virtual]`

| PLAIN authentication as described in RFC 2595. Definition at line 61 of file kdesasl.cpp. References QCString::length(), and QString::utf8(). Referenced by getBinaryResponse().

QByteArray KDESasl::getLoginResponse | ( |  | ) | `[protected, virtual]`

| LOGIN authentication. Definition at line 73 of file kdesasl.cpp. References QString::utf8(). Referenced by getBinaryResponse().

QByteArray KDESasl::getCramMd5Response | ( | const QByteArray & | aChallenge | ) | `[protected, virtual]`

| CRAM-MD5 authentication as described in RFC 2195. Definition at line 81 of file kdesasl.cpp. References KMD5::hexDigest(), KMD5::rawDigest(), KMD5::update(), and QString::utf8(). Referenced by getBinaryResponse().

QByteArray KDESasl::getDigestMd5Response | ( | const QByteArray & | aChallenge | ) | `[protected, virtual]`

| DIGEST-MD5 authentication as described in RFC 2831. Definition at line 114 of file kdesasl.cpp. References KCodecs::base64Encode(), KMD5::hexDigest(), QCString::isEmpty(), QString::latin1(), QCString::length(), KMD5::rawDigest(), KMD5::reset(), QCString::setNum(), KMD5::update(), and QString::utf8(). Referenced by getBinaryResponse().

The documentation for this class was generated from the following files:

- kdesasl.h
- kdesasl.cpp

This file is part of the documentation for kdelibs Version 3.1.5.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Wed Jan 28 13:15:43 2004 by doxygen 1.3.4 written by Dimitri van Heesch, © 1997-2001