os/security/cryptoservices/certificateandkeymgmt/tcertstore/t_unifiedcertstoreadd.h
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/security/cryptoservices/certificateandkeymgmt/tcertstore/t_unifiedcertstoreadd.h Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,132 @@
1.4 +/*
1.5 +* Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies).
1.6 +* All rights reserved.
1.7 +* This component and the accompanying materials are made available
1.8 +* under the terms of the License "Eclipse Public License v1.0"
1.9 +* which accompanies this distribution, and is available
1.10 +* at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.11 +*
1.12 +* Initial Contributors:
1.13 +* Nokia Corporation - initial contribution.
1.14 +*
1.15 +* Contributors:
1.16 +*
1.17 +* Description:
1.18 +* CAddCertificate and CImportKey class implementations
1.19 +*
1.20 +*/
1.21 +
1.22 +
1.23 +/**
1.24 + @file
1.25 + @internalTechnology
1.26 +*/
1.27 +
1.28 +#ifndef __T_UNIFIEDCERTSTOREADD_H__
1.29 +#define __T_UNIFIEDCERTSTOREADD_H__
1.30 +
1.31 +#include "t_certstoreactions.h"
1.32 +#include "t_testactionspec.h"
1.33 +#include <mctkeystore.h>
1.34 +#include <unifiedkeystore.h>
1.35 +
1.36 +/**
1.37 + * This class tests the addition of a certificate to the store.
1.38 + */
1.39 +class CAddCertificate : public CSubscriberAction
1.40 + {
1.41 +public:
1.42 + static CTestAction* NewL(RFs& aFs, CConsoleBase& aConsole, Output& aOut,
1.43 + const TTestActionSpec& aTestActionSpec);
1.44 + ~CAddCertificate();
1.45 + virtual void PerformAction(TRequestStatus& aStatus);
1.46 + virtual void PerformCancel();
1.47 + virtual void AfterOOMFailure();
1.48 + virtual void Reset();
1.49 +
1.50 +private:
1.51 + CAddCertificate(RFs& aFs, CConsoleBase& aConsole, Output& aOut);
1.52 + void ConstructL(const TTestActionSpec& aTestActionSpec);
1.53 + void DoReportAction();
1.54 + void DoCheckResult(TInt aError);
1.55 + void WriteFormat();
1.56 + void WriteOwnerType();
1.57 + void SetKeyId(TKeyIdentifier& aKeyIdentifier, const TDesC8& aKeyInfo);
1.58 + void SetDeletable(const TDesC8& aDeletable);
1.59 + void SetCertFormatL(const TDesC8& aFormat);
1.60 + void SetCertOwnerTypeL(const TDesC8& aOwnerType);
1.61 + void SetCertLabelL(const TDesC8& aLabel);
1.62 + void SetStoreToUse(const TDesC8& aStoreToUse);
1.63 + void SetCertificateContentL(const TDesC8& aFileName);
1.64 + void ConstructCertL(const TDesC8& aCert);
1.65 +
1.66 +private:
1.67 + enum TState
1.68 + {
1.69 + EAdding,
1.70 + ECheckNotification,
1.71 + EFinished
1.72 + };
1.73 +
1.74 +private:
1.75 + TState iState;
1.76 + CCertificate* iCertificate;
1.77 + HBufC8* iCertificateURL;
1.78 + HBufC* iCertificateLabel;
1.79 + TCertificateFormat iCertificateFormat;
1.80 + TCertificateOwnerType iOwnerType;
1.81 + TKeyIdentifier iIssuerKeyId;
1.82 + TKeyIdentifier iSubjectKeyId;
1.83 + TBool iDeletable;
1.84 + TBool iDeletableFlagPresent;
1.85 + TInt iStoreIndex;
1.86 +
1.87 + /**
1.88 + * This is the data of the certificate, it is the data that will be written to
1.89 + * the store for any kind of certificates (URL, X.509, WTLS...)
1.90 + */
1.91 + HBufC8* iCertificateContent;
1.92 + };
1.93 +
1.94 +
1.95 +class CImportKey : public CCertStoreTestAction
1.96 +{
1.97 +public:
1.98 + static CTestAction* NewL(RFs& aFs, CConsoleBase& aConsole, Output& aOut, const TTestActionSpec& aTestActionSpec);
1.99 + static CTestAction* NewLC(RFs& aFs, CConsoleBase& aConsole, Output& aOut, const TTestActionSpec& aTestActionSpec);
1.100 + ~CImportKey();
1.101 + virtual void PerformAction(TRequestStatus& aStatus);
1.102 + virtual void PerformCancel();
1.103 + virtual void Reset();
1.104 +private:
1.105 + TBool SetKeyUsage(const TDesC8& aKeyUsage);
1.106 + void SetKeyLabel(const TDesC8& aKeyLabel);
1.107 + TBool SetKeyAccessType(const TDesC8& aKeyAccessType);
1.108 + void SetKeyDataFileL(const TDesC8& aDes);
1.109 + void SetKeyPassphrase(const TDesC8& aDes);
1.110 +private:
1.111 + CImportKey(RFs& aFs, CConsoleBase& aConsole, Output& aOut);
1.112 + void ConstructL(const TTestActionSpec& aTestActionSpec);
1.113 +private:
1.114 + void DoReportAction();
1.115 + void DoCheckResult(TInt aError);
1.116 +private:
1.117 + enum TState
1.118 + {
1.119 + EInitialise,
1.120 + EImportKey,
1.121 + EFinished
1.122 + };
1.123 +private:
1.124 + TState iState;
1.125 +private:
1.126 + TKeyUsagePKCS15 iUsage;
1.127 + HBufC* iLabel;
1.128 + HBufC8* iKeyData;
1.129 + TInt iAccessType;
1.130 + RFs iFs;
1.131 + CUnifiedKeyStore* iUnifiedKeyStore;
1.132 + CCTKeyInfo* iKeyInfo;
1.133 +};
1.134 +
1.135 +#endif