sl@0: /* sl@0: * Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: * All rights reserved. sl@0: * This component and the accompanying materials are made available sl@0: * under the terms of the License "Eclipse Public License v1.0" sl@0: * which accompanies this distribution, and is available sl@0: * at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: * sl@0: * Initial Contributors: sl@0: * Nokia Corporation - initial contribution. sl@0: * sl@0: * Contributors: sl@0: * sl@0: * Description: sl@0: * Declares test step classes for positive cases of PKCS#10 tests. sl@0: * sl@0: */ sl@0: sl@0: sl@0: /** sl@0: @file sl@0: @internalTechnology sl@0: */ sl@0: sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: sl@0: #if (!defined __CERTIFICATEREQUEST_STEP_H__) sl@0: #define __CERTIFICATEREQUEST_STEP_H__ sl@0: #include sl@0: #include "tpkcs10stepbasev2.h" sl@0: sl@0: _LIT(KCertificateRequestStep,"PKCS10CertRequest"); sl@0: sl@0: // forward declarations: sl@0: class CCertificateRequestStep; sl@0: sl@0: class CPKCS10TesterActive : public CActive sl@0: { sl@0: public: sl@0: CPKCS10TesterActive( CTestExecuteLogger& aLogger ); sl@0: ~CPKCS10TesterActive(); sl@0: sl@0: TVerdict doActiveCertRequestL(CCertificateRequestStep* aStep); sl@0: sl@0: //Active sl@0: void DoCancel() {return; }; sl@0: void RunL(); sl@0: virtual TInt RunError(TInt aError); sl@0: // Generic sl@0: sl@0: void AddGenericAttributesL(); sl@0: void AddChallengePasswordL(); sl@0: void AddV3ExtensionsL(); sl@0: void DeleteAllKeysL(); sl@0: CX500DistinguishedName* MakeDistinguishedNameL(); sl@0: TVerdict verifyCertReqEncodingL(); sl@0: TBool CompareRequestToOPENSSLReqL(); sl@0: public: sl@0: sl@0: CTestExecuteLogger& Logger(){return iLogger;} sl@0: //Log buffer sl@0: TBuf<150> iLogInfo; sl@0: CTestExecuteLogger& iLogger; sl@0: CCertificateRequestStep* iStepPointer; sl@0: CUnifiedKeyStore* iKeyStore; sl@0: HBufC8* iKeyData; sl@0: CCTKeyInfo* iKeyInfo; sl@0: CPKCS10Request* iCertRequest; sl@0: CX500DistinguishedName* iDN; sl@0: CPKCS10Attributes* iAttrCollection; sl@0: CPKCS9ExtensionRequestAttr* iV3ExtensionsCollection; sl@0: TInt iError; sl@0: HBufC8* iOutputASN1Encoding; sl@0: HBufC8* iSecondOutputASN1Encoding; sl@0: TVerdict iTestSuccess; sl@0: RMPointerArray iKeys; sl@0: TCTKeyAttributeFilter iKeyFilter; sl@0: TInt iRunError; sl@0: sl@0: sl@0: RFs iFs; sl@0: sl@0: enum EState sl@0: { sl@0: EIdle, sl@0: // Delete all keys sl@0: EDeleteAllInit, sl@0: EDeleteAllDelete, sl@0: sl@0: // Main test sl@0: EInitKeyStore, sl@0: EKeyPolicy, sl@0: EImportKey, sl@0: EGenerateCertRequest, sl@0: EGenerateSecondCertRequest, sl@0: EDeleteKey sl@0: }; sl@0: sl@0: EState iState; sl@0: sl@0: } ; sl@0: sl@0: class CCertificateRequestStep : public CTPKCS10StepBase sl@0: { sl@0: public: sl@0: CCertificateRequestStep(); sl@0: ~CCertificateRequestStep(); sl@0: virtual TVerdict doTestStepPreambleL(); sl@0: virtual TVerdict doTestStepL(); sl@0: virtual TVerdict doTestStepPostambleL(); sl@0: virtual TVerdict doOOMTestL(); sl@0: virtual void doTestL(); sl@0: sl@0: TAlgorithmId ConvertNameToDigestId(const TDesC& aHashName); sl@0: TInt ConvertNameToEKeyAlgorithm(const TDesC& aName); sl@0: void OutputEncodingToFileL(const TDesC8& aEncoding); sl@0: TBool IsMatchingEncodingL(CASN1EncBase* aASN1Enc1, CASN1EncBase* aASN1Enc2); sl@0: sl@0: public: sl@0: RFs iFs; sl@0: TBool iOOMCondition; sl@0: TInt iExpectedError; sl@0: TPtrC iDN_country; sl@0: TPtrC iDN_state; sl@0: TPtrC iDN_locality; sl@0: TPtrC iDN_organization; sl@0: TPtrC iDN_unit; sl@0: TPtrC iDN_common; sl@0: TPtrC iDN_email; sl@0: TPtrC iPrivateKey; sl@0: TPtrC iOPENSSLCertReq; sl@0: TPtrC iKeyAlg; sl@0: TPtrC iChallengePassword; sl@0: TPtrC iDigestAlg; sl@0: TInt iElemCertReqCount; sl@0: TInt iElemCertInfoCount; sl@0: TInt iCertReqVer; sl@0: TInt iElemSubPubKeytInfoCount; sl@0: TInt iElemKeyAlgIdenCount; sl@0: TInt iElemSigAlgIdenCount; sl@0: TInt iAttribute_count; sl@0: CPKCS10TesterActive* iActiveObjTest; sl@0: CActiveScheduler* iSched; sl@0: RArray iArrayGenAttrOID; sl@0: RArray iArrayGenAttrValue; sl@0: RArray iArrayV3AttrOID; sl@0: RArray iArrayV3AttrCritical; sl@0: RArray iArrayV3AttrValue; sl@0: sl@0: TBool iGenerateSecondRequest; sl@0: TBool iRepopulateDataRequest; sl@0: TInt iError; sl@0: sl@0: }; sl@0: sl@0: sl@0: #endif