sl@0: /* sl@0: * Copyright (c) 2005-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: * This file contains the implementation of the CPfxHeader,CSafeBagAttribute, sl@0: * CSafeContentBag,CSafeBagData. sl@0: * sl@0: */ sl@0: sl@0: sl@0: /** sl@0: @file sl@0: @internalTechnology sl@0: */ sl@0: //User Include sl@0: #include "tpkcs12data.h" sl@0: sl@0: // Implementation of CPfxHeader sl@0: sl@0: /** sl@0: Description:constructor sl@0: @internalTechnology: sl@0: @test sl@0: */ sl@0: CPfxHeader::CPfxHeader() sl@0: { sl@0: } sl@0: /** sl@0: Description:Function is intended to create the CPfxHeader object sl@0: @internalTechnology: sl@0: @test sl@0: */ sl@0: CPfxHeader* CPfxHeader::NewL(const CDecPkcs12& aDecPkcs12 , TInt aError) sl@0: { sl@0: CPfxHeader* self = NewLC(aDecPkcs12 , aError); sl@0: CleanupStack::Pop(self); sl@0: return self; sl@0: } sl@0: /** sl@0: Description:Function is intended to pcreate the CPfxHeader object and push it to cleanupstack sl@0: @internalTechnology: sl@0: @test sl@0: */ sl@0: CPfxHeader* CPfxHeader::NewLC(const CDecPkcs12& aDecPkcs12 , TInt aError) sl@0: { sl@0: CPfxHeader* self = new (ELeave) CPfxHeader(); sl@0: CleanupStack::PushL(self); sl@0: self->ConstructL(aDecPkcs12 , aError); sl@0: return self; sl@0: } sl@0: sl@0: /** sl@0: Description:Function is intended to construct the CPfxHeader object sl@0: @param-CDecPkcs12&: reference to the CDecPkcs12 object sl@0: @param-aError: Error to be set in case, the CDecPkcs12 object creation fails sl@0: @internalTechnology: sl@0: @test sl@0: */ sl@0: void CPfxHeader::ConstructL(const CDecPkcs12& aDecPkcs12 , TInt aError) sl@0: { sl@0: if(aError != KErrNone) sl@0: { sl@0: iPkcs12ActualError = aError; sl@0: return; sl@0: } sl@0: //get the version sl@0: iVersion = aDecPkcs12.Version(); sl@0: // put the integrity mode in the Header sl@0: iIntegrityMode = aDecPkcs12.IntegrityMode(); sl@0: sl@0: // Get the macData sl@0: const CDecPkcs12MacData* macData = aDecPkcs12.MacData(); sl@0: sl@0: // set the macData member in the Header sl@0: sl@0: iIsMacDataPresent = ( macData != NULL) ; sl@0: sl@0: if (macData && iIntegrityMode == CDecPkcs12::EPasswordIntegrityMode) sl@0: { sl@0: // MacL method returns the DigestInfo structure. sl@0: const CPKCS7DigestInfo& digestInfo = macData->DigestInfo(); sl@0: iMac = digestInfo.Digest().AllocL(); sl@0: // MacSaltL method returns the macSalt sl@0: iMacSalt = macData->MacSalt().AllocL(); sl@0: // IterationCountL method returns the iteration Count. sl@0: iIterationCount= macData->IterationCount(); sl@0: } sl@0: } sl@0: /** sl@0: Description:destructor sl@0: @internalTechnology: sl@0: @test sl@0: */ sl@0: CPfxHeader::~CPfxHeader() sl@0: { sl@0: delete iMac; sl@0: delete iMacSalt; sl@0: } sl@0: sl@0: // Implementation of CSafeBagAttribute sl@0: /** sl@0: Description:constructor sl@0: @internalTechnology: sl@0: @test sl@0: */ sl@0: CSafeBagAttribute::CSafeBagAttribute() sl@0: { sl@0: } sl@0: /** sl@0: Description:destructor sl@0: @internalTechnology: sl@0: @test sl@0: */ sl@0: CSafeBagAttribute::~CSafeBagAttribute() sl@0: { sl@0: delete iAttrId; sl@0: } sl@0: /** sl@0: Description:Function is intended create CSafeBagAttribute object sl@0: @param-aAttribute: constant reference to the CDecPkcs12Attribute sl@0: @internalTechnology: sl@0: @test sl@0: */ sl@0: CSafeBagAttribute* CSafeBagAttribute::NewL(const CDecPkcs12Attribute& aAttribute) sl@0: { sl@0: CSafeBagAttribute* self = NewLC(aAttribute); sl@0: CleanupStack::Pop(self); sl@0: return self; sl@0: } sl@0: /** sl@0: Description:Function is intended to construct CSafeBagAttribute object, push it to cleanupstack sl@0: @param-aAttribute: constant reference to the CDecPkcs12Attribute sl@0: @internalTechnology: sl@0: @test sl@0: */ sl@0: CSafeBagAttribute* CSafeBagAttribute::NewLC(const CDecPkcs12Attribute& aAttribute) sl@0: { sl@0: CSafeBagAttribute* self = new (ELeave) CSafeBagAttribute(); sl@0: CleanupStack::PushL(self); sl@0: self->ConstructL(aAttribute); sl@0: return self; sl@0: } sl@0: /** sl@0: Description:Function is intended to construct the CSafeBagAttribute object sl@0: @param-CDecPkcs12Attribute: pointer to the CDecPkcs12ShroudedKeyBag sl@0: @internalTechnology: sl@0: @test sl@0: */ sl@0: void CSafeBagAttribute::ConstructL(const CDecPkcs12Attribute& aAttribute) sl@0: { sl@0: iAttrId = aAttribute.AttributeId().AllocL(); sl@0: iAttrValCount = aAttribute.AttributeValue().Count(); sl@0: } sl@0: sl@0: //Implementation of CSafeContentBag sl@0: sl@0: /** sl@0: Description:Function is intended to create the CSafeContentBag sl@0: @internalTechnology: sl@0: @test sl@0: */ sl@0: CSafeContentBag* CSafeContentBag::NewL() sl@0: { sl@0: CSafeContentBag* self = NewLC(); sl@0: CleanupStack::Pop(self); sl@0: return self; sl@0: } sl@0: /** sl@0: Description:Function is intended to create the CSafeContentBag, push it to cleanupstack sl@0: @internalTechnology: sl@0: @test sl@0: */ sl@0: CSafeContentBag* CSafeContentBag::NewLC() sl@0: { sl@0: CSafeContentBag* self = new (ELeave) CSafeContentBag(); sl@0: CleanupStack::PushL(self); sl@0: return self; sl@0: } sl@0: /** sl@0: Description:constructor sl@0: @internalTechnology: sl@0: @test sl@0: */ sl@0: CSafeContentBag::CSafeContentBag() sl@0: { sl@0: } sl@0: sl@0: // Implementation of CSafeBagData sl@0: sl@0: /** sl@0: Description:destructor sl@0: @internalTechnology: sl@0: @test sl@0: */ sl@0: CSafeBagData::~CSafeBagData() sl@0: { sl@0: delete iBagValue; sl@0: delete iAlgorithmID; sl@0: delete iCertificateID; sl@0: iAttributeIDs.ResetAndDestroy(); sl@0: iAttributeValues.ResetAndDestroy(); sl@0: } sl@0: /** sl@0: Description:Function is intended to create the CSafeBagData object sl@0: @internalTechnology: sl@0: @test sl@0: */ sl@0: CSafeBagData* CSafeBagData::NewL() sl@0: { sl@0: CSafeBagData* self = NewLC(); sl@0: CleanupStack::Pop(self); sl@0: return self; sl@0: } sl@0: /** sl@0: Description:Function is intended to create the CSafeBagData object, push it to cleanupstack sl@0: @internalTechnology: sl@0: @test sl@0: */ sl@0: CSafeBagData* CSafeBagData::NewLC() sl@0: { sl@0: CSafeBagData* self = new (ELeave) CSafeBagData; sl@0: CleanupStack::PushL(self); sl@0: return self; sl@0: } sl@0: /** sl@0: Description:constructor sl@0: @internalTechnology: sl@0: @test sl@0: */ sl@0: CSafeBagData::CSafeBagData() sl@0: { sl@0: }