javamanager/javacaptain/systemams/src/certificatesmanager.h
branchRCL_3
changeset 14 04becd199f91
equal deleted inserted replaced
13:f5050f1da672 14:04becd199f91
       
     1 /*
       
     2 * Copyright (c) 2009 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 #include <e32base.h>
       
    18 #include <mctwritablecertstore.h>
       
    19 #include <ct.h>
       
    20 #include <ecom/ecom.h>
       
    21 #include <s32mem.h>
       
    22 
       
    23 namespace java
       
    24 {
       
    25 namespace security
       
    26 {
       
    27 namespace legacysupport
       
    28 {
       
    29 
       
    30 class CertificatesManager: public CActive
       
    31 {
       
    32 
       
    33     enum State
       
    34     {
       
    35         EStart,
       
    36         EOpenToken,
       
    37         EGetTokenInterface,
       
    38         EListCertificates,
       
    39         EInitCertsRetrieval,
       
    40         ERetrieveCertificates,
       
    41         ERetrieveCertState,
       
    42         ERetrieveCertLength,
       
    43         ECollectCertInfo,
       
    44         EFinish
       
    45     };
       
    46 
       
    47 public:
       
    48 
       
    49     static CertificatesManager* NewL();
       
    50 
       
    51     TUint32 TrustRootCount(const TDesC& aProtectionDomain);
       
    52     TPtr8 TrustRootInfo(const TDesC& aProtectionDomain);
       
    53     TPtr8 TrustRootInfoCertificateL(const TInt id);
       
    54     void DeleteTrustRootL(const TInt id);
       
    55     void DisableTrustRootL(const TInt id);
       
    56     void EnableTrustRootL(const TInt id);
       
    57 
       
    58     virtual void RunL();
       
    59     virtual void DoCancel();
       
    60     virtual TInt RunError(TInt aError);
       
    61 
       
    62 public:
       
    63 
       
    64     virtual ~CertificatesManager();
       
    65 
       
    66 private:
       
    67 
       
    68     CertificatesManager();
       
    69     void ConstructL();
       
    70     CCTCertInfo* getTrustRootL(const TInt aId);
       
    71     void CompleteRequest();
       
    72     void InitL();
       
    73     void OpenToken();
       
    74     void GetTokenInterface();
       
    75     void ListCertificatesL();
       
    76     void InitCertsRetrievalL();
       
    77     void RetrieveCertificates();
       
    78     void RetrieveCertState();
       
    79     void RetrieveCertLengthL();
       
    80     void CollectCertInfoL();
       
    81     void UpdateCacheL(TInt aCertId, TInt aCertState);
       
    82     void LazyInit();
       
    83 
       
    84 private:
       
    85     State iState;
       
    86     MCTToken* iCTToken;
       
    87     CCTTokenType* iCTTokenType;
       
    88     RCPointerArray<HBufC> iCTTokenInfo;
       
    89     MCTTokenInterface* iCTTokenInterface;
       
    90     MCTWritableCertStore* iCertStore;
       
    91     CCertAttributeFilter* iCertsFilter;
       
    92     RMPointerArray<CCTCertInfo> iCertInfos;
       
    93     TUid iJavaCertStoreEcomPluginId;
       
    94     CBufFlat* iBuffer;
       
    95     int iBufferPos;
       
    96     TBool iCanDisable;
       
    97     RArray<TUid> iApplications;
       
    98     HBufC8* iEncodedCert;
       
    99     int iCurrentRetrievedCert;
       
   100     HBufC8* iCurrentCert;
       
   101     CCTCertInfo* iCurrentCertInfo;
       
   102     HBufC* iProtDomain;
       
   103     int iCertCount;
       
   104     TBool iInitialized;
       
   105 };
       
   106 
       
   107 } //end namespace legacysupport
       
   108 } //end namespace security
       
   109 } //end namespace java
       
   110