sl@0: /* sl@0: * Copyright (c) 2006-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 "keyagreementimpl.h" sl@0: #include sl@0: #include "pluginconfig.h" sl@0: sl@0: using namespace SoftwareCrypto; sl@0: sl@0: CKeyAgreementImpl::CKeyAgreementImpl() sl@0: { sl@0: } sl@0: sl@0: void CKeyAgreementImpl::ConstructL(const CKey& aPrivateKey, const CCryptoParams* aParams) sl@0: { sl@0: SetKeyL(aPrivateKey, aParams); sl@0: } sl@0: sl@0: CKeyAgreementImpl::~CKeyAgreementImpl() sl@0: { sl@0: delete iSharedParams; sl@0: delete iPrivateKey; sl@0: } sl@0: sl@0: void CKeyAgreementImpl::Close() sl@0: { sl@0: delete this; sl@0: } sl@0: sl@0: void CKeyAgreementImpl::Reset() sl@0: { sl@0: } sl@0: sl@0: TAny* CKeyAgreementImpl::GetExtension(TUid /*aExtensionId*/) sl@0: { sl@0: return 0; sl@0: } sl@0: sl@0: void CKeyAgreementImpl::GetCharacteristicsL(const TAny*& aPluginCharacteristics) sl@0: { sl@0: TInt numCiphers = sizeof(KKeyAgreementCharacteristics)/sizeof(TKeyAgreementCharacteristics*); sl@0: TInt32 implUid = ImplementationUid().iUid; sl@0: for (TInt i = 0; i < numCiphers; ++i) sl@0: { sl@0: if (KKeyAgreementCharacteristics[i]->cmn.iImplementationUID == implUid) sl@0: { sl@0: aPluginCharacteristics = KKeyAgreementCharacteristics[i]; sl@0: break; sl@0: } sl@0: } sl@0: } sl@0: sl@0: void CKeyAgreementImpl::SetKeyL(const CKey& aSelfPrivateKey, const CCryptoParams* aSharedParams) sl@0: { sl@0: delete iPrivateKey; sl@0: iPrivateKey = CKey::NewL(aSelfPrivateKey); sl@0: delete iSharedParams; sl@0: iSharedParams = CCryptoParams::NewL(); sl@0: iSharedParams->CopyL(*aSharedParams); // copy contents of the object sl@0: }