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