javaextensions/satsa/apdu/src.s60/cstspkcs15reader.h
branchRCL_3
changeset 19 04becd199f91
equal deleted inserted replaced
16:f5050f1da672 19:04becd199f91
       
     1 /*
       
     2 * Copyright (c) 2008 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:
       
    15  *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CSTSPKCS15READER_H
       
    20 #define CSTSPKCS15READER_H
       
    21 
       
    22 //  INCLUDES
       
    23 #include <e32base.h>
       
    24 #include "cstsselectfile.h"
       
    25 
       
    26 namespace java
       
    27 {
       
    28 namespace satsa
       
    29 {
       
    30 
       
    31 // FORWARD DECLARATIONS
       
    32 class CSTSAce;
       
    33 class CSTSAuthType;
       
    34 class CSTSAcie;
       
    35 class CSTSFileDataManager;
       
    36 
       
    37 // CLASS DECLARATION
       
    38 
       
    39 /**
       
    40  *  Handels the reading of PKCS15 structure from the card.
       
    41  *  Used for getting pin related information for PIN Ui's and
       
    42  *  access control related information like ACF reading.
       
    43  *
       
    44  *  @since 3.0
       
    45  */
       
    46 NONSHARABLE_CLASS(CSTSPKCS15Reader): public CBase
       
    47 {
       
    48 public:
       
    49     enum TConnectionState
       
    50     {
       
    51         ENotOpened,
       
    52         EChannelOpened,
       
    53         EPCKS15Opened,
       
    54         EClosed
       
    55     };
       
    56 public: // Constructors and destructor
       
    57 
       
    58     /**
       
    59      * Two-phased constructor.
       
    60      */
       
    61     static CSTSPKCS15Reader* NewL();
       
    62 
       
    63     /**
       
    64      * Destructor.
       
    65      */
       
    66     virtual ~CSTSPKCS15Reader();
       
    67 
       
    68 public: // New functions
       
    69 
       
    70     /**
       
    71      * Opens channel to smart card and selects PKCS15 application
       
    72      * @since 3.0
       
    73      */
       
    74     void OpenL();
       
    75 
       
    76     /**
       
    77      * Deselects PKCS15 application and closes used channel
       
    78      * @since 3.0
       
    79      */
       
    80     void Close();
       
    81 
       
    82     /**
       
    83      * Reads Access control file
       
    84      * @since 3.0
       
    85      * @param aAces Array of ACE objects where all information will be read
       
    86      */
       
    87     void ReadACFL(CArrayPtr< CSTSAce>* aAces);
       
    88 
       
    89     /**
       
    90      * Reads Pin related Authentication objects
       
    91      * @since 3.0
       
    92      * @param aAuthType AuthType object where all information will be read
       
    93      */
       
    94     void ReadAuthObjectsL(CArrayPtr< CSTSAuthType>* aAuthTypes,
       
    95                           const CArrayPtr< CSTSAce>& aAces);
       
    96 
       
    97     /**
       
    98      * Returns token label
       
    99      * @since 3.0
       
   100      * @return Reference to descriptor, contains token label.
       
   101      */
       
   102     const TDesC& TokenLabelL();
       
   103 
       
   104     /**
       
   105      * Sets card application AID
       
   106      * @since 3.0
       
   107      */
       
   108     void SetAIDL(const TDesC8& aAID);
       
   109 
       
   110 private:
       
   111 
       
   112     /**
       
   113      * C++ default constructor.
       
   114      */
       
   115     CSTSPKCS15Reader();
       
   116 
       
   117     /**
       
   118      * By default Symbian 2nd phase constructor is private.
       
   119      */
       
   120     void ConstructL();
       
   121 
       
   122     /**
       
   123      * Reads ACIF file for finding path to Access Control Files (ACF).
       
   124      * Saves data to member array.
       
   125      */
       
   126     void ReadACIFL();
       
   127 
       
   128 private: // Data
       
   129 
       
   130     // AID of the application, owned
       
   131     HBufC8* iAID;
       
   132     //state
       
   133     TConnectionState iState;
       
   134 
       
   135     // array for all found acies, owned
       
   136     CArrayPtrFlat< CSTSAcie>* iAcies;
       
   137 
       
   138     CSTSFileDataManager* iFileDataManager; // owned
       
   139 
       
   140 };
       
   141 
       
   142 } //namespace satsa
       
   143 } //namespace java
       
   144 #endif // CSTSPKCS15READER_H
       
   145 // End of File