.TH "KDESasl" kde3 "11 Jun 2005" "Version Version 3.4.1" "kio Library" \" -*- nroff -*-
.ad l
.nh
.SH NAME
KDESasl \- This library can create responses for SASL authentication for a given challenge and a given secret.  

.PP
.SH SYNOPSIS
.br
.PP
\fC#include <kdesasl.h>\fP
.PP
.SS "Public Member Functions"

.in +1c
.ti -1c
.RI "\fBKDESasl\fP (const \fBKURL\fP &aUrl)"
.br
.ti -1c
.RI "\fBKDESasl\fP (const \fBQString\fP &aUser, const \fBQString\fP &aPass, const \fBQString\fP &aProtocol)"
.br
.ti -1c
.RI "virtual \fBQCString\fP \fBchooseMethod\fP (const \fBQStrIList\fP aMethods)"
.br
.ti -1c
.RI "virtual void \fBsetMethod\fP (const \fBQCString\fP &aMethod)"
.br
.ti -1c
.RI "\fBQCString\fP \fBmethod\fP () const "
.br
.ti -1c
.RI "bool \fBdialogComplete\fP (int numCalls) const "
.br
.ti -1c
.RI "bool \fBisClearTextMethod\fP () const "
.br
.ti -1c
.RI "\fBQCString\fP \fBgetResponse\fP (const \fBQByteArray\fP &aChallenge=\fBQByteArray\fP(), bool aBase64=true)"
.br
.ti -1c
.RI "\fBQByteArray\fP \fBgetBinaryResponse\fP (const \fBQByteArray\fP &aChallenge=\fBQByteArray\fP(), bool aBase64=true)"
.br
.ti -1c
.RI "bool \fBclientStarts\fP () const "
.br
.in -1c
.SS "Protected Member Functions"

.in +1c
.ti -1c
.RI "virtual \fBQByteArray\fP \fBgetPlainResponse\fP ()"
.br
.ti -1c
.RI "virtual \fBQByteArray\fP \fBgetLoginResponse\fP ()"
.br
.ti -1c
.RI "virtual \fBQByteArray\fP \fBgetCramMd5Response\fP (const \fBQByteArray\fP &aChallenge)"
.br
.ti -1c
.RI "virtual \fBQByteArray\fP \fBgetDigestMd5Response\fP (const \fBQByteArray\fP &aChallenge)"
.br
.in -1c
.SH "Detailed Description"
.PP 
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.
.PP
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.
.PP
Currently PLAIN (RFC 2595), LOGIN (not really a SASL mechanism, but used like that in IMAP and SMTP), CRAM-MD5 (RFC 2195) and DIGEST-MD5 (RFC 2831) authentication are supported. PLAIN and LOGIN transmit the credentials in the clear (apart from a possible base64 encoding).
.PP
For \fBKDE\fP 3.2, the API has been extended to allow transparent use of all currently supported SASL mechanisms. Example: 
.PP
.nf
 KDESasl sasl( myUser, myPass, myProtocol );
 if ( !sasl.chooseMethod( myMechanismsSupportedByServer ) )
   return false; // couldn't agree on a method

 int numResponses = 0;
 if ( sasl.clientStarts() ) { // check whether we're supposed to start the dialog
   ++numResponses;
   mySendAuthCommand( sasl.method(), sasl.getResponse() );
 } else {
   mySendAuthCommand( sasl.method() );
 }
 for ( ; !sasl.dialogComplete( numResponses ) ; ++numResponses ) {
   QByteArray challenge = myRecvChallenge();
   mySendResponse( sasl.getResponse( challenge ) );
 }
 return myCheckSuccess();

.fi
.PP
.PP
\fBAuthor:\fP
.RS 4
Michael Häckel <haeckel@kde.org> 
.RE
.PP
\fBVersion:\fP
.RS 4
\fBId\fP.RS 4
\fBkdesasl.h\fP 370277 2004-12-13 01:41:12Z mueller 
.RE
.PP
.RE
.PP

.PP
Definition at line 72 of file kdesasl.h.
.SH "Constructor & Destructor Documentation"
.PP 
.SS "KDESasl::KDESasl (const \fBKURL\fP & aUrl)"
.PP
Construct a sasl object and initialize it with the username and password passed via the url. 
.PP
Definition at line 30 of file kdesasl.cpp.
.SS "KDESasl::KDESasl (const \fBQString\fP & aUser, const \fBQString\fP & aPass, const \fBQString\fP & aProtocol)"
.PP
This is a conveniece function and differs from the above function only by what arguments it accepts. 
.PP
Definition at line 38 of file kdesasl.cpp.
.SH "Member Function Documentation"
.PP 
.SS "\fBQCString\fP KDESasl::chooseMethod (const \fBQStrIList\fP aMethods)\fC [virtual]\fP"
.PP
\fBReturns:\fP
.RS 4
the most secure method from the given methods and use it for further operations. 
.RE
.PP

.PP
Definition at line 50 of file kdesasl.cpp.
.SS "void KDESasl::setMethod (const \fBQCString\fP & aMethod)\fC [virtual]\fP"
.PP
Explicitely set the SASL method used. 
.PP
Definition at line 60 of file kdesasl.cpp.
.PP
References QCString::upper().
.SS "\fBQCString\fP KDESasl::method () const"
.PP
\fBReturns:\fP
.RS 4
the SASL method used. 
.RE
.PP
\fBSince:\fP
.RS 4
3.2 
.RE
.PP

.PP
Definition at line 267 of file kdesasl.cpp.
.PP
Referenced by clientStarts(), dialogComplete(), and isClearTextMethod().
.SS "bool KDESasl::dialogComplete (int numCalls) const"
.PP
\fBParameters:\fP
.RS 4
\fInumCalls\fP number of times \fBgetResponse()\fP has been called. 
.RE
.PP
\fBReturns:\fP
.RS 4
whether the challenge/response dialog has completed
.RE
.PP
\fBSince:\fP
.RS 4
3.2 
.RE
.PP

.PP
Definition at line 275 of file kdesasl.cpp.
.PP
References method().
.SS "bool KDESasl::isClearTextMethod () const"
.PP
\fBReturns:\fP
.RS 4
whether the currently selected mechanism results in cleartext passwords being sent over the network and thus should be used only under TLS/SSL cover or for legacy servers.
.RE
.PP
\fBSince:\fP
.RS 4
3.2 
.RE
.PP

.PP
Definition at line 283 of file kdesasl.cpp.
.PP
References method().
.SS "\fBQCString\fP KDESasl::getResponse (const \fBQByteArray\fP & aChallenge = \fC\fBQByteArray\fP()\fP, bool aBase64 = \fCtrue\fP)"
.PP
Creates a response using the formerly chosen SASL method. 
.PP
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. 
.PP
\fBParameters:\fP
.RS 4
\fIaChallenge\fP is the challenge sent to create a response for 
.br
\fIaBase64\fP specifies, whether the authentication protocol uses base64 encoding. The challenge is decoded from base64 and the response is encoded base64 if set to true. 
.RE
.PP

.PP
Definition at line 261 of file kdesasl.cpp.
.PP
References getBinaryResponse().
.SS "\fBQByteArray\fP KDESasl::getBinaryResponse (const \fBQByteArray\fP & aChallenge = \fC\fBQByteArray\fP()\fP, bool aBase64 = \fCtrue\fP)"
.PP
Create a response as above but place it in a \fBQByteArray\fP. 
.PP
Definition at line 242 of file kdesasl.cpp.
.PP
References KCodecs::base64Decode(), KCodecs::base64Encode(), getCramMd5Response(), getDigestMd5Response(), getLoginResponse(), and getPlainResponse().
.PP
Referenced by getResponse().
.SS "bool KDESasl::clientStarts () const"
.PP
Returns true if the client is supposed to initiate the challenge-respinse dialog with an initial response (which most protocols can transfer alongside the authentication command as an optional second parameter). 
.PP
This method relieves the sasl user from knowing details about the mechanism. If true, use \fBgetResponse()\fP with a null challenge.
.PP
\fBSince:\fP
.RS 4
3.2 
.RE
.PP

.PP
Definition at line 271 of file kdesasl.cpp.
.PP
References method().
.SS "\fBQByteArray\fP KDESasl::getPlainResponse ()\fC [protected, virtual]\fP"
.PP
PLAIN authentication as described in RFC 2595. 
.PP
Definition at line 65 of file kdesasl.cpp.
.PP
References QCString::length(), and QString::utf8().
.PP
Referenced by getBinaryResponse().
.SS "\fBQByteArray\fP KDESasl::getLoginResponse ()\fC [protected, virtual]\fP"
.PP
LOGIN authentication. 
.PP
Definition at line 83 of file kdesasl.cpp.
.PP
References QString::utf8().
.PP
Referenced by getBinaryResponse().
.SS "\fBQByteArray\fP KDESasl::getCramMd5Response (const \fBQByteArray\fP & aChallenge)\fC [protected, virtual]\fP"
.PP
CRAM-MD5 authentication as described in RFC 2195. 
.PP
Definition at line 91 of file kdesasl.cpp.
.PP
References KMD5::hexDigest(), QString::length(), KMD5::rawDigest(), KMD5::update(), and QString::utf8().
.PP
Referenced by getBinaryResponse().
.SS "\fBQByteArray\fP KDESasl::getDigestMd5Response (const \fBQByteArray\fP & aChallenge)\fC [protected, virtual]\fP"
.PP
DIGEST-MD5 authentication as described in RFC 2831. 
.PP
Definition at line 124 of file kdesasl.cpp.
.PP
References KCodecs::base64Encode(), KMD5::hexDigest(), QCString::isEmpty(), QString::latin1(), QCString::length(), KMD5::rawDigest(), KMD5::reset(), QCString::setNum(), KMD5::update(), and QString::utf8().
.PP
Referenced by getBinaryResponse().

.SH "Author"
.PP 
Generated automatically by Doxygen for kio Library from the source code.
