sl@0: /* sl@0: * Copyright (c) 1998-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: #include "tactiondecodepkcs5.h" sl@0: #include "t_input.h" sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: sl@0: _LIT8(KInputStart, ""); sl@0: sl@0: sl@0: CTestAction* CActionDecodePKCS5::NewL(RFs& aFs, sl@0: CConsoleBase& aConsole, sl@0: Output& aOut, sl@0: const TTestActionSpec& aTestActionSpec) sl@0: { sl@0: CActionDecodePKCS5* self = new(ELeave) CActionDecodePKCS5(aFs, aConsole, aOut); sl@0: CleanupStack::PushL(self); sl@0: self->ConstructL(aTestActionSpec); sl@0: CleanupStack::Pop(); sl@0: return self; sl@0: } sl@0: sl@0: CActionDecodePKCS5::~CActionDecodePKCS5() sl@0: { sl@0: delete iInput; sl@0: delete iOutput; sl@0: } sl@0: sl@0: CActionDecodePKCS5::CActionDecodePKCS5(RFs& aFs, sl@0: CConsoleBase& aConsole, sl@0: Output& aOut) sl@0: sl@0: : CTestAction(aConsole, aOut), iFs(aFs) sl@0: { sl@0: } sl@0: sl@0: void CActionDecodePKCS5::ConstructL(const TTestActionSpec& aTestActionSpec) sl@0: { sl@0: CTestAction::ConstructL(aTestActionSpec); sl@0: sl@0: iInput = Input::ParseElementHexL(aTestActionSpec.iActionBody, KInputStart); sl@0: iOutput = HBufC8::NewL(iInput->Length()+100); //so we detect errors in sl@0: //encoding not panics in descriptors sl@0: } sl@0: sl@0: void CActionDecodePKCS5::DoReportAction(void) sl@0: { sl@0: } sl@0: sl@0: void CActionDecodePKCS5::DoCheckResult(TInt) sl@0: { sl@0: } sl@0: sl@0: void CActionDecodePKCS5::PerformAction(TRequestStatus& aStatus) sl@0: { sl@0: TRequestStatus* status = &aStatus; sl@0: iResult = EFalse; sl@0: sl@0: CPBEncryptParms* parms = TASN1DecPKCS5::DecodeDERL(*iInput); sl@0: CleanupStack::PushL(parms); sl@0: CASN1EncSequence* seq = TASN1EncPKCS5::EncodeDERL(*parms); sl@0: CleanupStack::PushL(seq); sl@0: sl@0: iOutput->Des().SetLength(seq->LengthDER()); sl@0: TUint length=0; sl@0: TPtr8 iOutputTemp = iOutput->Des(); sl@0: seq->WriteDERL(iOutputTemp, length); sl@0: sl@0: if(*iOutput == *iInput) sl@0: { sl@0: iResult = ETrue; sl@0: } sl@0: sl@0: CleanupStack::PopAndDestroy(2); //seq, parms sl@0: User::RequestComplete(status, KErrNone); sl@0: iActionState = CTestAction::EPostrequisite; sl@0: }