sl@0: /* sl@0: * Copyright (c) 2006-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: * sl@0: */ sl@0: sl@0: sl@0: /** sl@0: @file sl@0: @internalTechnology sl@0: */ sl@0: sl@0: #ifndef TCMSSTEP_H sl@0: #define TCMSSTEP_H sl@0: sl@0: #include sl@0: #include "tpkcs7server.h" sl@0: #include sl@0: #include sl@0: sl@0: sl@0: class CDecPKCS8Data; sl@0: class MPKCS8DecodedKeyPairData; sl@0: class CRSAPrivateKey; sl@0: class CDSAPrivateKey; sl@0: class CMessageDigest; sl@0: class CASN1EncBase; sl@0: class CCmsSignedObject; sl@0: class CEncapsulatedContentInfo; sl@0: class CCmsSignerInfo; sl@0: sl@0: sl@0: /** sl@0: The base class for testing CMS data types sl@0: */ sl@0: class CTCmsBaseStep : public CTestStep sl@0: { sl@0: public: sl@0: CTCmsBaseStep(); sl@0: ~CTCmsBaseStep(); sl@0: TVerdict doTestStepL(); sl@0: TVerdict doTestStepPreambleL(); sl@0: sl@0: protected: sl@0: HBufC8* readFileL (TPtrC tag); sl@0: HBufC8* CreateDEREncodingLC(const CASN1EncBase& aEncoding); sl@0: void OutputResultToFileL(const TDesC8& aSignature); sl@0: TVerdict doOOMTestL(); sl@0: virtual void doTestL() = 0; sl@0: TInt CovertContentDataTypeNameToDataType(const TDesC& aDataTypeName); sl@0: sl@0: protected: sl@0: RFs iFs; sl@0: HBufC8* iDataContent; sl@0: TInt iExpectedDataType; sl@0: HBufC8* iExpectedEncoding; sl@0: TInt iExpectedResult; sl@0: TBool iIsOOMTest; sl@0: }; sl@0: sl@0: /** sl@0: The class for testing CMS Content Info sl@0: */ sl@0: class CTCmsContentInfoDecodingStep : public CTCmsBaseStep sl@0: { sl@0: public: sl@0: CTCmsContentInfoDecodingStep(); sl@0: ~CTCmsContentInfoDecodingStep(); sl@0: void doTestL(); sl@0: }; sl@0: sl@0: /** sl@0: The class for testing CMS data type sl@0: */ sl@0: class CTCmsDataStep : public CTCmsBaseStep sl@0: { sl@0: public: sl@0: CTCmsDataStep(); sl@0: ~CTCmsDataStep(); sl@0: void doTestL(); sl@0: protected: sl@0: void DecodingAndCheckL(TDesC8& aRawData); sl@0: }; sl@0: sl@0: /** sl@0: The class for testing CMS data type Decoding sl@0: */ sl@0: class CTCmsDataDecodingStep : public CTCmsDataStep sl@0: { sl@0: public: sl@0: CTCmsDataDecodingStep(); sl@0: ~CTCmsDataDecodingStep(); sl@0: void doTestL(); sl@0: }; sl@0: sl@0: /** sl@0: The base class for testing CMS signed data and PKCS7 signed data sl@0: encoding, decoding and validation. OOM test is configurable in this sl@0: test base step sl@0: */ sl@0: class CTSignedDataBaseStep : public CTCmsBaseStep sl@0: { sl@0: public: sl@0: CTSignedDataBaseStep(); sl@0: ~CTSignedDataBaseStep(); sl@0: TVerdict doTestStepPreambleL(); sl@0: sl@0: protected: sl@0: CMessageDigest* CreateHashLC(TAlgorithmId aAlgorithmId); sl@0: TInt CovertHashNameToAlgorithmId(const TDesC& aHashName); sl@0: TInt CovertCertificateNameToCertificateType(const TDesC& aCertificateName); sl@0: sl@0: protected: sl@0: RPointerArray iDecPKCS8Data; sl@0: RPointerArray iCertificates; sl@0: RArray iSignerInfoVersion; sl@0: RArray iHashName; sl@0: RArray iValidateResults; sl@0: RArray iSignedAttributePresent; sl@0: RArray iUnSignedAttributePresent; sl@0: TInt iContentType; sl@0: TBool iIsHashAvailable; sl@0: TBool iIsDetached; sl@0: TBool iTwoStepCreation; sl@0: TBool iRsaAlgorithm; sl@0: TBool iCertificateSetPresent; sl@0: TBool iCRLsSetPresent; sl@0: TInt iSignedDataVersion; sl@0: TInt iAlgorithmCount; sl@0: TInt iCertsCount; sl@0: TInt iSignerCount; sl@0: CX509Certificate* iRootCertificate; sl@0: CX509Certificate* iAdditionalCertificate; sl@0: TBool iNoCertSet; sl@0: TBool iValidateUsingUserCerts; sl@0: TBool iNoSigning; sl@0: TInt iAdditionalEncodedCertificateType; sl@0: HBufC8* iAdditionalEncodedCertificate; sl@0: TBool iNoValidationTest; sl@0: TBool iValidationDetachedWithoutInput; sl@0: }; sl@0: sl@0: /** sl@0: The class test encoding, decoding and validation of the CMS signed data object sl@0: */ sl@0: class CTCmsSignedDataStep : public CTSignedDataBaseStep sl@0: { sl@0: public: sl@0: CTCmsSignedDataStep(); sl@0: ~CTCmsSignedDataStep(); sl@0: void doTestL(); sl@0: sl@0: protected: sl@0: void CheckAndValidateSignedDataL(TDesC8& aRawData); sl@0: void CheckSignedDataFieldsL(const CCmsSignedObject& aSignedData); sl@0: void CheckEncapsulatedContentFieldsL(const CEncapsulatedContentInfo& encapContentInfo); sl@0: void CheckAlgorithmSetFieldsL(const RPointerArray& aAlgorithms); sl@0: void CheckCertificateSetFieldsL(const CCmsSignedObject& aSignedData); sl@0: void CheckSignerInfoFieldsL(const RPointerArray& signerInfos); sl@0: }; sl@0: sl@0: /** sl@0: The class test decoding and validation of the CMS signed data object sl@0: */ sl@0: class CTCmsSignedDataDecodingStep : public CTCmsSignedDataStep sl@0: { sl@0: public: sl@0: CTCmsSignedDataDecodingStep(); sl@0: ~CTCmsSignedDataDecodingStep(); sl@0: void doTestL(); sl@0: }; sl@0: sl@0: #endif //TCMSSTEP_H