add more spacing
[personal-kdebase.git] / workspace / libs / solid / control / authentication.h
blob21a99a16df73c898a200b79da14fe23b57733bbb
1 /* This file is part of the KDE project
2 Copyright (C) 2006 Kevin Ottens <ervin@kde.org>
3 Copyright (C) 2007 Will Stephenson <wstephenson@kde.org>
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public
7 License version 2 as published by the Free Software Foundation.
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details.
14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to
16 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 Boston, MA 02110-1301, USA.
21 #ifndef SOLID_CONTROL_AUTHENTICATION_H
22 #define SOLID_CONTROL_AUTHENTICATION_H
24 #include <solid/control/ifaces/authentication.h>
26 namespace Solid
28 namespace Control
30 /**
31 * Base class for wireless authentication schemes. No need to instantiate this
33 class SOLIDCONTROL_EXPORT Authentication
35 public:
36 typedef QMap<QString, QString> SecretMap;
38 Authentication();
39 virtual ~Authentication();
41 /**
42 * All the authentication's secrets are stored in this map.
43 * These can be plaintext passwords, hashed passwords, certificate passphrases
45 void setSecrets(const SecretMap &);
46 /**
47 * retrieve the map containing secrets.
49 SecretMap secrets() const;
51 private:
52 class Private;
53 Private * const d;
56 /**
57 * This Authentication is a null authentication. Used for open networks
59 class SOLIDCONTROL_EXPORT AuthenticationNone : public Authentication
61 public:
62 AuthenticationNone();
63 virtual ~AuthenticationNone();
65 private:
66 class Private;
67 Private * const d;
70 /**
71 * WEP (Wired Equivalent Privacy) Authentication.
72 * Better than prayer for protecting your data, but not much.
74 class SOLIDCONTROL_EXPORT AuthenticationWep : public Authentication
76 public:
77 /**
78 * Wep password type. WepAscii and WepPassphrase are both hashed to WepHex using
79 * standard algorithms, but are easier to remember.
81 enum WepType { WepAscii, WepHex, WepPassphrase };
82 /**
83 * Authentication schemes
84 * Open System has no authentication, if you have the encryption key, you are able to use the network
85 * Shared Key means that the station must know a secret key to authenticate to the network.
86 * Not sure if the same key is used for both Auth and Encryption though.
88 enum WepMethod { WepOpenSystem, WepSharedKey };
90 AuthenticationWep();
91 virtual ~AuthenticationWep();
93 /**
94 * Set the auth scheme in use
96 void setMethod(WepMethod);
97 /**
98 * Get the auth scheme in use
100 WepMethod method() const;
102 * Set the password scheme in use
104 void setType(WepType);
106 * Get the password scheme in use
108 WepType type() const;
110 * Set the key length in bits
111 * Valid values are 40 or 64 (equivalent)
112 * 104 or 128
113 * 192
114 * 256
115 * other values (rare)
117 void setKeyLength(int);
119 * Get the key length, in bits
121 int keyLength() const;
123 private:
124 class Private;
125 Private * const d;
129 * AuthenticationWpa contains functionality shared by both Personal and Enterprise
130 * authentication flavors
132 class SOLIDCONTROL_EXPORT AuthenticationWpa : public Authentication
134 public:
136 * Possible Authentication schemes
138 enum WpaProtocol { WpaAuto, WpaTkip, WpaCcmpAes, // WPA Personal only
139 WpaEap /* WPA Enterprise only */ };
141 * WPA Versions
143 enum WpaVersion { Wpa1, Wpa2 };
146 * WPA key management schemes
148 enum WpaKeyManagement { WpaPsk, Wpa8021x };
150 AuthenticationWpa();
151 virtual ~AuthenticationWpa();
154 * Set the protocol in use
156 void setProtocol(WpaProtocol);
158 * Set the protocol in use
160 WpaProtocol protocol() const;
163 * Set the WPA version
165 void setVersion(WpaVersion);
167 * Get the WPA version
169 WpaVersion version() const;
172 * Set the key management scheme
174 void setKeyManagement(WpaKeyManagement);
177 * Get the key management scheme
179 WpaKeyManagement keyManagement() const;
181 private:
182 class Private;
183 Private * const d;
187 * WPA Personal authentication.
189 class SOLIDCONTROL_EXPORT AuthenticationWpaPersonal : public AuthenticationWpa
191 public:
192 AuthenticationWpaPersonal();
193 virtual ~AuthenticationWpaPersonal();
195 private:
196 class Private;
197 Private * const d;
201 * WPA Enterprise
203 class SOLIDCONTROL_EXPORT AuthenticationWpaEnterprise : public AuthenticationWpa
205 public:
207 * Subtypes of Enterprise Authentication Protocol
209 enum EapMethod { EapPeap, EapTls, EapTtls, EapMd5, EapMsChap, EapOtp, EapGtc };
210 AuthenticationWpaEnterprise();
211 virtual ~AuthenticationWpaEnterprise();
214 * TODO: check with thoenig what this means - probably identity off one of the certs
216 void setIdentity(const QString &);
218 * TODO: check with thoenig what this means - probably identity off one of the certs
220 QString identity() const;
223 * TODO: check with thoenig what this means - probably identity off one of the certs
225 void setAnonIdentity(const QString &);
227 * TODO: check with thoenig what this means - probably identity off one of the certs
229 QString anonIdentity() const;
232 * Set path to the client certificate
234 void setCertClient(const QString &);
236 * Get path to the client certificate
238 QString certClient() const;
240 * Set path to the certification authority certificate
242 void setCertCA(const QString &);
244 * Get path to the certification authority certificate
246 QString certCA() const;
249 * Set path to the private certificate
251 void setCertPrivate(const QString &);
253 * Get path to the private certificate
255 QString certPrivate() const;
257 * Set the EAP method
259 void setMethod(EapMethod);
261 * Get the EAP method
263 EapMethod method() const;
265 * Set the ID password key (helper method)
267 void setIdPasswordKey(const QString &);
269 * Set the ID password key (helper method)
271 QString idPasswordKey() const;
274 * Set the private certificate password key (helper method)
276 void setCertPrivatePasswordKey(const QString &);
278 * Get the private certificate password key (helper method)
280 QString certPrivatePasswordKey() const;
282 private:
283 class Private;
284 Private * const d;
288 * Utility class
289 * Contains a backend specific validator instance to validate authentication
290 * Can be used for example to authenticate user input as they type
292 class SOLIDCONTROL_EXPORT AuthenticationValidator
294 public:
295 AuthenticationValidator();
296 virtual ~AuthenticationValidator();
298 * Call this to check if an authentication is valid
299 * (All secrets present, passphrase length correct
301 bool validate(const Authentication *);
302 private:
303 class Private;
304 Private * const d;
309 #endif