author | sl@SLION-WIN7.fritz.box |
Fri, 15 Jun 2012 03:10:57 +0200 | |
changeset 0 | bde4ae8d615e |
permissions | -rw-r--r-- |
sl@0 | 1 |
/* |
sl@0 | 2 |
* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). |
sl@0 | 3 |
* All rights reserved. |
sl@0 | 4 |
* This component and the accompanying materials are made available |
sl@0 | 5 |
* under the terms of the License "Eclipse Public License v1.0" |
sl@0 | 6 |
* which accompanies this distribution, and is available |
sl@0 | 7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html". |
sl@0 | 8 |
* |
sl@0 | 9 |
* Initial Contributors: |
sl@0 | 10 |
* Nokia Corporation - initial contribution. |
sl@0 | 11 |
* |
sl@0 | 12 |
* Contributors: |
sl@0 | 13 |
* |
sl@0 | 14 |
* Description: |
sl@0 | 15 |
* |
sl@0 | 16 |
*/ |
sl@0 | 17 |
|
sl@0 | 18 |
|
sl@0 | 19 |
/** |
sl@0 | 20 |
@file |
sl@0 | 21 |
@internalTechnology |
sl@0 | 22 |
*/ |
sl@0 | 23 |
|
sl@0 | 24 |
#ifndef TCMSSTEP_H |
sl@0 | 25 |
#define TCMSSTEP_H |
sl@0 | 26 |
|
sl@0 | 27 |
#include <test/testexecutestepbase.h> |
sl@0 | 28 |
#include "tpkcs7server.h" |
sl@0 | 29 |
#include <x509cert.h> |
sl@0 | 30 |
#include <cmssignerinfo.h> |
sl@0 | 31 |
|
sl@0 | 32 |
|
sl@0 | 33 |
class CDecPKCS8Data; |
sl@0 | 34 |
class MPKCS8DecodedKeyPairData; |
sl@0 | 35 |
class CRSAPrivateKey; |
sl@0 | 36 |
class CDSAPrivateKey; |
sl@0 | 37 |
class CMessageDigest; |
sl@0 | 38 |
class CASN1EncBase; |
sl@0 | 39 |
class CCmsSignedObject; |
sl@0 | 40 |
class CEncapsulatedContentInfo; |
sl@0 | 41 |
class CCmsSignerInfo; |
sl@0 | 42 |
|
sl@0 | 43 |
|
sl@0 | 44 |
/** |
sl@0 | 45 |
The base class for testing CMS data types |
sl@0 | 46 |
*/ |
sl@0 | 47 |
class CTCmsBaseStep : public CTestStep |
sl@0 | 48 |
{ |
sl@0 | 49 |
public: |
sl@0 | 50 |
CTCmsBaseStep(); |
sl@0 | 51 |
~CTCmsBaseStep(); |
sl@0 | 52 |
TVerdict doTestStepL(); |
sl@0 | 53 |
TVerdict doTestStepPreambleL(); |
sl@0 | 54 |
|
sl@0 | 55 |
protected: |
sl@0 | 56 |
HBufC8* readFileL (TPtrC tag); |
sl@0 | 57 |
HBufC8* CreateDEREncodingLC(const CASN1EncBase& aEncoding); |
sl@0 | 58 |
void OutputResultToFileL(const TDesC8& aSignature); |
sl@0 | 59 |
TVerdict doOOMTestL(); |
sl@0 | 60 |
virtual void doTestL() = 0; |
sl@0 | 61 |
TInt CovertContentDataTypeNameToDataType(const TDesC& aDataTypeName); |
sl@0 | 62 |
|
sl@0 | 63 |
protected: |
sl@0 | 64 |
RFs iFs; |
sl@0 | 65 |
HBufC8* iDataContent; |
sl@0 | 66 |
TInt iExpectedDataType; |
sl@0 | 67 |
HBufC8* iExpectedEncoding; |
sl@0 | 68 |
TInt iExpectedResult; |
sl@0 | 69 |
TBool iIsOOMTest; |
sl@0 | 70 |
}; |
sl@0 | 71 |
|
sl@0 | 72 |
/** |
sl@0 | 73 |
The class for testing CMS Content Info |
sl@0 | 74 |
*/ |
sl@0 | 75 |
class CTCmsContentInfoDecodingStep : public CTCmsBaseStep |
sl@0 | 76 |
{ |
sl@0 | 77 |
public: |
sl@0 | 78 |
CTCmsContentInfoDecodingStep(); |
sl@0 | 79 |
~CTCmsContentInfoDecodingStep(); |
sl@0 | 80 |
void doTestL(); |
sl@0 | 81 |
}; |
sl@0 | 82 |
|
sl@0 | 83 |
/** |
sl@0 | 84 |
The class for testing CMS data type |
sl@0 | 85 |
*/ |
sl@0 | 86 |
class CTCmsDataStep : public CTCmsBaseStep |
sl@0 | 87 |
{ |
sl@0 | 88 |
public: |
sl@0 | 89 |
CTCmsDataStep(); |
sl@0 | 90 |
~CTCmsDataStep(); |
sl@0 | 91 |
void doTestL(); |
sl@0 | 92 |
protected: |
sl@0 | 93 |
void DecodingAndCheckL(TDesC8& aRawData); |
sl@0 | 94 |
}; |
sl@0 | 95 |
|
sl@0 | 96 |
/** |
sl@0 | 97 |
The class for testing CMS data type Decoding |
sl@0 | 98 |
*/ |
sl@0 | 99 |
class CTCmsDataDecodingStep : public CTCmsDataStep |
sl@0 | 100 |
{ |
sl@0 | 101 |
public: |
sl@0 | 102 |
CTCmsDataDecodingStep(); |
sl@0 | 103 |
~CTCmsDataDecodingStep(); |
sl@0 | 104 |
void doTestL(); |
sl@0 | 105 |
}; |
sl@0 | 106 |
|
sl@0 | 107 |
/** |
sl@0 | 108 |
The base class for testing CMS signed data and PKCS7 signed data |
sl@0 | 109 |
encoding, decoding and validation. OOM test is configurable in this |
sl@0 | 110 |
test base step |
sl@0 | 111 |
*/ |
sl@0 | 112 |
class CTSignedDataBaseStep : public CTCmsBaseStep |
sl@0 | 113 |
{ |
sl@0 | 114 |
public: |
sl@0 | 115 |
CTSignedDataBaseStep(); |
sl@0 | 116 |
~CTSignedDataBaseStep(); |
sl@0 | 117 |
TVerdict doTestStepPreambleL(); |
sl@0 | 118 |
|
sl@0 | 119 |
protected: |
sl@0 | 120 |
CMessageDigest* CreateHashLC(TAlgorithmId aAlgorithmId); |
sl@0 | 121 |
TInt CovertHashNameToAlgorithmId(const TDesC& aHashName); |
sl@0 | 122 |
TInt CovertCertificateNameToCertificateType(const TDesC& aCertificateName); |
sl@0 | 123 |
|
sl@0 | 124 |
protected: |
sl@0 | 125 |
RPointerArray<CDecPKCS8Data> iDecPKCS8Data; |
sl@0 | 126 |
RPointerArray<CX509Certificate> iCertificates; |
sl@0 | 127 |
RArray<TInt> iSignerInfoVersion; |
sl@0 | 128 |
RArray<TInt> iHashName; |
sl@0 | 129 |
RArray<TBool> iValidateResults; |
sl@0 | 130 |
RArray<TBool> iSignedAttributePresent; |
sl@0 | 131 |
RArray<TBool> iUnSignedAttributePresent; |
sl@0 | 132 |
TInt iContentType; |
sl@0 | 133 |
TBool iIsHashAvailable; |
sl@0 | 134 |
TBool iIsDetached; |
sl@0 | 135 |
TBool iTwoStepCreation; |
sl@0 | 136 |
TBool iRsaAlgorithm; |
sl@0 | 137 |
TBool iCertificateSetPresent; |
sl@0 | 138 |
TBool iCRLsSetPresent; |
sl@0 | 139 |
TInt iSignedDataVersion; |
sl@0 | 140 |
TInt iAlgorithmCount; |
sl@0 | 141 |
TInt iCertsCount; |
sl@0 | 142 |
TInt iSignerCount; |
sl@0 | 143 |
CX509Certificate* iRootCertificate; |
sl@0 | 144 |
CX509Certificate* iAdditionalCertificate; |
sl@0 | 145 |
TBool iNoCertSet; |
sl@0 | 146 |
TBool iValidateUsingUserCerts; |
sl@0 | 147 |
TBool iNoSigning; |
sl@0 | 148 |
TInt iAdditionalEncodedCertificateType; |
sl@0 | 149 |
HBufC8* iAdditionalEncodedCertificate; |
sl@0 | 150 |
TBool iNoValidationTest; |
sl@0 | 151 |
TBool iValidationDetachedWithoutInput; |
sl@0 | 152 |
}; |
sl@0 | 153 |
|
sl@0 | 154 |
/** |
sl@0 | 155 |
The class test encoding, decoding and validation of the CMS signed data object |
sl@0 | 156 |
*/ |
sl@0 | 157 |
class CTCmsSignedDataStep : public CTSignedDataBaseStep |
sl@0 | 158 |
{ |
sl@0 | 159 |
public: |
sl@0 | 160 |
CTCmsSignedDataStep(); |
sl@0 | 161 |
~CTCmsSignedDataStep(); |
sl@0 | 162 |
void doTestL(); |
sl@0 | 163 |
|
sl@0 | 164 |
protected: |
sl@0 | 165 |
void CheckAndValidateSignedDataL(TDesC8& aRawData); |
sl@0 | 166 |
void CheckSignedDataFieldsL(const CCmsSignedObject& aSignedData); |
sl@0 | 167 |
void CheckEncapsulatedContentFieldsL(const CEncapsulatedContentInfo& encapContentInfo); |
sl@0 | 168 |
void CheckAlgorithmSetFieldsL(const RPointerArray<CX509AlgorithmIdentifier>& aAlgorithms); |
sl@0 | 169 |
void CheckCertificateSetFieldsL(const CCmsSignedObject& aSignedData); |
sl@0 | 170 |
void CheckSignerInfoFieldsL(const RPointerArray<CCmsSignerInfo>& signerInfos); |
sl@0 | 171 |
}; |
sl@0 | 172 |
|
sl@0 | 173 |
/** |
sl@0 | 174 |
The class test decoding and validation of the CMS signed data object |
sl@0 | 175 |
*/ |
sl@0 | 176 |
class CTCmsSignedDataDecodingStep : public CTCmsSignedDataStep |
sl@0 | 177 |
{ |
sl@0 | 178 |
public: |
sl@0 | 179 |
CTCmsSignedDataDecodingStep(); |
sl@0 | 180 |
~CTCmsSignedDataDecodingStep(); |
sl@0 | 181 |
void doTestL(); |
sl@0 | 182 |
}; |
sl@0 | 183 |
|
sl@0 | 184 |
#endif //TCMSSTEP_H |