59
|
1 |
/*
|
|
2 |
* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
|
3 |
* All rights reserved.
|
|
4 |
* This component and the accompanying materials are made available
|
|
5 |
* under the terms of "Eclipse Public License v1.0"
|
|
6 |
* which accompanies this distribution, and is available
|
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
8 |
*
|
|
9 |
* Initial Contributors:
|
|
10 |
* Nokia Corporation - initial contribution.
|
|
11 |
*
|
|
12 |
* Contributors:
|
|
13 |
*
|
|
14 |
* Description: Utility to perform GBA bootstrapping operation.
|
|
15 |
* GBA = Generic Bootstrapping Architecture
|
|
16 |
* Reference: 3GPP TS 33.220 (version 7.110 Release 7) at http://www.3gpp.org
|
|
17 |
*/
|
|
18 |
|
|
19 |
#ifndef GBAUTILITY_QT_H
|
|
20 |
#define GBAUTILITY_QT_H
|
|
21 |
|
|
22 |
#include <QObject>
|
|
23 |
#include <QString>
|
|
24 |
#include <QtCore/qdatetime.h>
|
|
25 |
#include <gbauilityexport.h>
|
|
26 |
|
|
27 |
const QString gUsim = "USIM";
|
|
28 |
const QString gSim = "SIM";
|
|
29 |
const QString gIsim = "ISIM"; // Currently not supported.
|
|
30 |
|
|
31 |
enum GbaBootstrapFlag {
|
|
32 |
// Default bootstrap: use the cached credentials if they have not expired.
|
|
33 |
DefaultBootstrap = 0,
|
|
34 |
// Do not use cached credentials, instead force bootstrapping with BSF.
|
|
35 |
ForceBootstrap
|
|
36 |
};
|
|
37 |
|
|
38 |
enum GbaRunType {
|
|
39 |
RunTypeNone = 0,
|
|
40 |
RunType2gGba, // 2G GBA: GBA-specific functions are carried out in the ME.
|
|
41 |
RunType3gGbaMe, // 3G GBA_ME: GBA-specific functions are carried out in the ME.
|
|
42 |
RunType3gGbaU // 3G GBA_U: GBA-specific functions are carried out in the UICC.
|
|
43 |
};
|
|
44 |
|
|
45 |
// Input data to GBA Bootstrapping operation.
|
|
46 |
typedef struct
|
|
47 |
{
|
|
48 |
// Input: FQDN (Fully Qualified Domain Name) of NAF
|
|
49 |
QString nafName;
|
|
50 |
// Input: DefaultBootstrap or ForceBootstrap
|
|
51 |
GbaBootstrapFlag bootstrapFlag;
|
|
52 |
// Input: label of UICC application that user wants to use, gUsim ("USIM") for example;
|
|
53 |
// default UICC application is used if the label is empty.
|
|
54 |
QString uiccLabel; // Currently not supported.
|
|
55 |
// Input: security protocol identifier appended to NAF Name for key derivation
|
|
56 |
QString protocolIdentifier;
|
|
57 |
// Input: identifier of preferred internet access point for bootstrap;
|
|
58 |
// set -1 to use the default access point.
|
|
59 |
qint32 accessPoint;
|
|
60 |
} GbaBootstrapInputData;
|
|
61 |
|
|
62 |
// Output data (credentials) from GBA Bootstrapping operation.
|
|
63 |
typedef struct
|
|
64 |
{
|
|
65 |
// Output: B-TID
|
|
66 |
QString bTid;
|
|
67 |
// Output: Ks_NAF
|
|
68 |
QByteArray ksNaf;
|
|
69 |
// Output: lifetime
|
|
70 |
QDateTime lifetime;
|
|
71 |
// Output: IMPI
|
|
72 |
QString impi; // Currently not supported.
|
|
73 |
// Output: GBA run-type
|
|
74 |
GbaRunType gbaRunType;
|
|
75 |
// Output: type of UICC application used
|
|
76 |
QString uiccLabel;
|
|
77 |
} GbaBootstrapOutputData;
|
|
78 |
|
|
79 |
|
|
80 |
class CGbaUtilityBody;
|
|
81 |
|
|
82 |
|
|
83 |
// API class for GBA Bootstrapping operation.
|
|
84 |
class QTGBADLL_EXPORT GbaUtility : public QObject
|
|
85 |
{
|
|
86 |
Q_OBJECT
|
|
87 |
|
|
88 |
public:
|
|
89 |
enum GbaErrorStatus {
|
|
90 |
GbaNoError = 0, // No error; operation is successful.
|
|
91 |
GbaErrorGeneral, // Error: general error.
|
|
92 |
GbaErrorArgument, // Error: wrong argument value in method call.
|
|
93 |
GbaErrorInUse, // Error: an outstanding bootstrap request is in place.
|
|
94 |
GbaErrorPermissionDenied, // Error: permission to execute the operation is denied, e.g.,
|
|
95 |
// due to application not having enough security capability.
|
|
96 |
GbaErrorNetworkConnection, // Error: error in network connection.
|
|
97 |
GbaErrorBootstrapFailed // Error: bootstrapping with BSF has failed.
|
|
98 |
};
|
|
99 |
|
|
100 |
GbaUtility(QObject *parent = 0);
|
|
101 |
|
|
102 |
virtual ~GbaUtility();
|
|
103 |
|
|
104 |
// Perform GBA Bootstrapping operation. This is an asynchronous method and the "bootstrapCompleted" signal
|
|
105 |
// will be sent with a success or failure indication when the operation is completed.
|
|
106 |
// Only one Bootstrapping operation can be performed at a time.
|
|
107 |
// On Symbian platform, application needs to have "ReadDeviceData" capability
|
|
108 |
// for this method call to be successful.
|
|
109 |
GbaErrorStatus bootstrap(const GbaBootstrapInputData *input, GbaBootstrapOutputData *output);
|
|
110 |
|
|
111 |
// Cancel the current Bootstrapping operation.
|
|
112 |
// The "bootstrapCompleted" signal will not be sent after cancellation.
|
|
113 |
void cancelBootstrap();
|
|
114 |
|
|
115 |
// Set BSF address. The BSF address set by this method will overwrite the one calculated from IMPI.
|
|
116 |
// On Symbian platform, application needs to have "WriteDeviceData" capability
|
|
117 |
// for this method call to be successful.
|
|
118 |
GbaErrorStatus setBsfAddress(const QString &bsfAddress);
|
|
119 |
|
|
120 |
signals:
|
|
121 |
// Signal to indicate that GBA Bootstrapping operation has completed.
|
|
122 |
// The parameter "status" indicates the success or failure of the operation.
|
|
123 |
// If it is successful, the output data (credentials) of the operation are returned in
|
|
124 |
// the "GbaBootstrapOutputData" structure that application passed in the previous "bootstrap" method call.
|
|
125 |
void bootstrapCompleted(GbaUtility::GbaErrorStatus status);
|
|
126 |
|
|
127 |
private:
|
|
128 |
CGbaUtilityBody *gbaUtilityBody;
|
|
129 |
|
|
130 |
private: // Friend class definitions
|
|
131 |
friend class CGbaUtilityBody;
|
|
132 |
};
|
|
133 |
|
|
134 |
#endif // GBAUTILITY_QT_H
|
|
135 |
// EOF
|