Update contrib.
2 * Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
4 * This component and the accompanying materials are made available
5 * under the terms of the License "Eclipse Public License v1.0"
6 * which accompanies this distribution, and is available
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
19 #include "tpkcs7stepbase.h"
20 #include <test/testexecutelog.h>
22 CTPKCS7StepBase::~CTPKCS7StepBase()
28 CTPKCS7StepBase::CTPKCS7StepBase()
32 HBufC8* CTPKCS7StepBase::readFileL (TPtrC tag)
35 if (GetStringFromConfig(ConfigSection(), tag, fileName) == EFalse)
41 if (file.Open(iFs, fileName, EFileRead) != KErrNone)
43 INFO_PRINTF2(_L("Cannot open file %S for reading"), &fileName);
46 CleanupClosePushL(file);
49 User::LeaveIfError(file.Size(fileSize));
51 HBufC8* result = HBufC8::NewL(fileSize);
52 result->Des().SetLength(fileSize);
54 TPtr8 rawDataPtr(result->Des());
55 rawDataPtr.SetLength(fileSize);
56 file.Read (rawDataPtr);
58 CleanupStack::PopAndDestroy (&file);
60 INFO_PRINTF3(_L("Read %d octets from %S"), result->Size(), &fileName);
65 TVerdict CTPKCS7StepBase::doTestStepPreambleL()
67 User::LeaveIfError (iFs.Connect());
69 SetTestStepResult(EPass);
71 iRawData = readFileL (_L("File"));
74 INFO_PRINTF1(_L("Failed to read 'File' section of script"));
75 SetTestStepResult(ETestSuiteError);
78 HBufC8* certificate = readFileL (_L("RootCertificate"));
79 if (certificate == NULL)
81 INFO_PRINTF1(_L("No 'RootCertificate' available"));
85 CleanupStack::PushL (certificate);
86 iRootCertificate = CX509Certificate::NewL(*certificate);
87 CleanupStack::PopAndDestroy (certificate);
92 //get Salt value for comparison
93 iSaltValue = readFileL (_L("Salt"));
94 if(iSaltValue == NULL)
96 INFO_PRINTF1(_L("No 'Salt' available"));
99 iContentData = readFileL (_L("ContentData"));
100 if(iContentData == NULL)
102 INFO_PRINTF1(_L("No 'ContentData' available"));
107 iDigest = readFileL (_L("DigestValue"));
110 INFO_PRINTF1(_L("No 'DigestValue' available"));
114 iEncodedParams = readFileL (_L("EncodedParams"));
115 if(iEncodedParams == NULL)
117 INFO_PRINTF1(_L("No 'EncodedParams' available"));
120 return TestStepResult();