1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/security/cryptoservices/certificateandkeymgmt/tpkcs7/tcmsstep.h Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,184 @@
1.4 +/*
1.5 +* Copyright (c) 2006-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 +*
1.19 +*/
1.20 +
1.21 +
1.22 +/**
1.23 + @file
1.24 + @internalTechnology
1.25 +*/
1.26 +
1.27 +#ifndef TCMSSTEP_H
1.28 +#define TCMSSTEP_H
1.29 +
1.30 +#include <test/testexecutestepbase.h>
1.31 +#include "tpkcs7server.h"
1.32 +#include <x509cert.h>
1.33 +#include <cmssignerinfo.h>
1.34 +
1.35 +
1.36 +class CDecPKCS8Data;
1.37 +class MPKCS8DecodedKeyPairData;
1.38 +class CRSAPrivateKey;
1.39 +class CDSAPrivateKey;
1.40 +class CMessageDigest;
1.41 +class CASN1EncBase;
1.42 +class CCmsSignedObject;
1.43 +class CEncapsulatedContentInfo;
1.44 +class CCmsSignerInfo;
1.45 +
1.46 +
1.47 +/**
1.48 +The base class for testing CMS data types
1.49 +*/
1.50 +class CTCmsBaseStep : public CTestStep
1.51 + {
1.52 +public:
1.53 + CTCmsBaseStep();
1.54 + ~CTCmsBaseStep();
1.55 + TVerdict doTestStepL();
1.56 + TVerdict doTestStepPreambleL();
1.57 +
1.58 +protected:
1.59 + HBufC8* readFileL (TPtrC tag);
1.60 + HBufC8* CreateDEREncodingLC(const CASN1EncBase& aEncoding);
1.61 + void OutputResultToFileL(const TDesC8& aSignature);
1.62 + TVerdict doOOMTestL();
1.63 + virtual void doTestL() = 0;
1.64 + TInt CovertContentDataTypeNameToDataType(const TDesC& aDataTypeName);
1.65 +
1.66 +protected:
1.67 + RFs iFs;
1.68 + HBufC8* iDataContent;
1.69 + TInt iExpectedDataType;
1.70 + HBufC8* iExpectedEncoding;
1.71 + TInt iExpectedResult;
1.72 + TBool iIsOOMTest;
1.73 + };
1.74 +
1.75 +/**
1.76 +The class for testing CMS Content Info
1.77 +*/
1.78 +class CTCmsContentInfoDecodingStep : public CTCmsBaseStep
1.79 + {
1.80 +public:
1.81 + CTCmsContentInfoDecodingStep();
1.82 + ~CTCmsContentInfoDecodingStep();
1.83 + void doTestL();
1.84 + };
1.85 +
1.86 +/**
1.87 +The class for testing CMS data type
1.88 +*/
1.89 +class CTCmsDataStep : public CTCmsBaseStep
1.90 + {
1.91 +public:
1.92 + CTCmsDataStep();
1.93 + ~CTCmsDataStep();
1.94 + void doTestL();
1.95 +protected:
1.96 + void DecodingAndCheckL(TDesC8& aRawData);
1.97 + };
1.98 +
1.99 +/**
1.100 +The class for testing CMS data type Decoding
1.101 +*/
1.102 +class CTCmsDataDecodingStep : public CTCmsDataStep
1.103 + {
1.104 +public:
1.105 + CTCmsDataDecodingStep();
1.106 + ~CTCmsDataDecodingStep();
1.107 + void doTestL();
1.108 + };
1.109 +
1.110 +/**
1.111 +The base class for testing CMS signed data and PKCS7 signed data
1.112 +encoding, decoding and validation. OOM test is configurable in this
1.113 +test base step
1.114 +*/
1.115 +class CTSignedDataBaseStep : public CTCmsBaseStep
1.116 + {
1.117 +public:
1.118 + CTSignedDataBaseStep();
1.119 + ~CTSignedDataBaseStep();
1.120 + TVerdict doTestStepPreambleL();
1.121 +
1.122 +protected:
1.123 + CMessageDigest* CreateHashLC(TAlgorithmId aAlgorithmId);
1.124 + TInt CovertHashNameToAlgorithmId(const TDesC& aHashName);
1.125 + TInt CovertCertificateNameToCertificateType(const TDesC& aCertificateName);
1.126 +
1.127 +protected:
1.128 + RPointerArray<CDecPKCS8Data> iDecPKCS8Data;
1.129 + RPointerArray<CX509Certificate> iCertificates;
1.130 + RArray<TInt> iSignerInfoVersion;
1.131 + RArray<TInt> iHashName;
1.132 + RArray<TBool> iValidateResults;
1.133 + RArray<TBool> iSignedAttributePresent;
1.134 + RArray<TBool> iUnSignedAttributePresent;
1.135 + TInt iContentType;
1.136 + TBool iIsHashAvailable;
1.137 + TBool iIsDetached;
1.138 + TBool iTwoStepCreation;
1.139 + TBool iRsaAlgorithm;
1.140 + TBool iCertificateSetPresent;
1.141 + TBool iCRLsSetPresent;
1.142 + TInt iSignedDataVersion;
1.143 + TInt iAlgorithmCount;
1.144 + TInt iCertsCount;
1.145 + TInt iSignerCount;
1.146 + CX509Certificate* iRootCertificate;
1.147 + CX509Certificate* iAdditionalCertificate;
1.148 + TBool iNoCertSet;
1.149 + TBool iValidateUsingUserCerts;
1.150 + TBool iNoSigning;
1.151 + TInt iAdditionalEncodedCertificateType;
1.152 + HBufC8* iAdditionalEncodedCertificate;
1.153 + TBool iNoValidationTest;
1.154 + TBool iValidationDetachedWithoutInput;
1.155 + };
1.156 +
1.157 +/**
1.158 +The class test encoding, decoding and validation of the CMS signed data object
1.159 +*/
1.160 +class CTCmsSignedDataStep : public CTSignedDataBaseStep
1.161 + {
1.162 +public:
1.163 + CTCmsSignedDataStep();
1.164 + ~CTCmsSignedDataStep();
1.165 + void doTestL();
1.166 +
1.167 +protected:
1.168 + void CheckAndValidateSignedDataL(TDesC8& aRawData);
1.169 + void CheckSignedDataFieldsL(const CCmsSignedObject& aSignedData);
1.170 + void CheckEncapsulatedContentFieldsL(const CEncapsulatedContentInfo& encapContentInfo);
1.171 + void CheckAlgorithmSetFieldsL(const RPointerArray<CX509AlgorithmIdentifier>& aAlgorithms);
1.172 + void CheckCertificateSetFieldsL(const CCmsSignedObject& aSignedData);
1.173 + void CheckSignerInfoFieldsL(const RPointerArray<CCmsSignerInfo>& signerInfos);
1.174 + };
1.175 +
1.176 +/**
1.177 +The class test decoding and validation of the CMS signed data object
1.178 +*/
1.179 +class CTCmsSignedDataDecodingStep : public CTCmsSignedDataStep
1.180 + {
1.181 +public:
1.182 + CTCmsSignedDataDecodingStep();
1.183 + ~CTCmsSignedDataDecodingStep();
1.184 + void doTestL();
1.185 + };
1.186 +
1.187 +#endif //TCMSSTEP_H