diff -r 000000000000 -r 2c201484c85f cryptoservices/certificateandkeymgmt/tpkcs7/tcmsstep.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cryptoservices/certificateandkeymgmt/tpkcs7/tcmsstep.h Wed Jul 08 11:25:26 2009 +0100 @@ -0,0 +1,186 @@ +/* +* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + + + +/** + @file + @internalTechnology +*/ + +#ifndef TCMSSTEP_H +#define TCMSSTEP_H + +#include +#include "tpkcs7server.h" +#include +#include + + +class CDecPKCS8Data; +class MPKCS8DecodedKeyPairData; +class CRSAPrivateKey; +class CDSAPrivateKey; +class CMessageDigest; +class CASN1EncBase; +class CCmsSignedObject; +class CEncapsulatedContentInfo; +class CCmsSignerInfo; + + +/** +The base class for testing CMS data types +*/ +class CTCmsBaseStep : public CTestStep + { +public: + CTCmsBaseStep(); + ~CTCmsBaseStep(); + TVerdict doTestStepL(); + TVerdict doTestStepPreambleL(); + +protected: + HBufC8* readFileL (TPtrC tag); + HBufC8* CreateDEREncodingLC(const CASN1EncBase& aEncoding); + void OutputResultToFileL(const TDesC8& aSignature); + TVerdict doOOMTestL(); + virtual void doTestL() = 0; + TInt CovertContentDataTypeNameToDataType(const TDesC& aDataTypeName); + +protected: + RFs iFs; + HBufC8* iDataContent; + TInt iExpectedDataType; + HBufC8* iExpectedEncoding; + TInt iExpectedResult; + TBool iIsOOMTest; + }; + +/** +The class for testing CMS Content Info +*/ +class CTCmsContentInfoDecodingStep : public CTCmsBaseStep + { +public: + CTCmsContentInfoDecodingStep(); + ~CTCmsContentInfoDecodingStep(); + void doTestL(); + }; + +/** +The class for testing CMS data type +*/ +class CTCmsDataStep : public CTCmsBaseStep + { +public: + CTCmsDataStep(); + ~CTCmsDataStep(); + void doTestL(); +protected: + void DecodingAndCheckL(TDesC8& aRawData); + }; + +/** +The class for testing CMS data type Decoding +*/ +class CTCmsDataDecodingStep : public CTCmsDataStep + { +public: + CTCmsDataDecodingStep(); + ~CTCmsDataDecodingStep(); + void doTestL(); + }; + +/** +The base class for testing CMS signed data and PKCS7 signed data +encoding, decoding and validation. OOM test is configurable in this +test base step +*/ +class CTSignedDataBaseStep : public CTCmsBaseStep + { +public: + CTSignedDataBaseStep(); + ~CTSignedDataBaseStep(); + TVerdict doTestStepPreambleL(); + +protected: + CMessageDigest* CreateHashLC(TAlgorithmId aAlgorithmId); + TInt CovertHashNameToAlgorithmId(const TDesC& aHashName); + TInt CovertCertificateNameToCertificateType(const TDesC& aCertificateName); + +protected: + RPointerArray iDecPKCS8Data; + RPointerArray iCertificates; + RArray iSignerInfoVersion; + RArray iHashName; + RArray iValidateResults; + RArray iSignedAttributePresent; + RArray iUnSignedAttributePresent; + TInt iContentType; + TBool iIsHashAvailable; + TBool iIsDetached; + TBool iTwoStepCreation; + TBool iRsaAlgorithm; + TBool iCertificateSetPresent; + TBool iCRLsSetPresent; + TInt iSignedDataVersion; + TInt iAlgorithmCount; + TInt iCertsCount; + TInt iSignerCount; + CX509Certificate* iRootCertificate; + CX509Certificate* iAdditionalCertificate; + TBool iNoCertSet; + TBool iValidateUsingUserCerts; + TBool iNoSigning; + TInt iAdditionalEncodedCertificateType; + HBufC8* iAdditionalEncodedCertificate; + TBool iNoValidationTest; + TBool iValidationDetachedWithoutInput; + }; + +/** +The class test encoding, decoding and validation of the CMS signed data object +*/ +class CTCmsSignedDataStep : public CTSignedDataBaseStep + { +public: + CTCmsSignedDataStep(); + ~CTCmsSignedDataStep(); + void doTestL(); + +protected: + void CheckAndValidateSignedDataL(TDesC8& aRawData); + void CheckSignedDataFieldsL(const CCmsSignedObject& aSignedData); + void CheckEncapsulatedContentFieldsL(const CEncapsulatedContentInfo& encapContentInfo); + void CheckAlgorithmSetFieldsL(const RPointerArray& aAlgorithms); + void CheckCertificateSetFieldsL(const CCmsSignedObject& aSignedData); + void CheckSignerInfoFieldsL(const RPointerArray& signerInfos); + }; + +/** +The class test decoding and validation of the CMS signed data object +*/ +class CTCmsSignedDataDecodingStep : public CTCmsSignedDataStep + { +public: + CTCmsSignedDataDecodingStep(); + ~CTCmsSignedDataDecodingStep(); + void doTestL(); + }; + +#endif //TCMSSTEP_H