os/security/cryptoplugins/cryptospiplugins/source/softwarecrypto/keyagreementimpl.cpp
First public contribution.
2 * Copyright (c) 2006-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 "keyagreementimpl.h"
20 #include <cryptospi/plugincharacteristics.h>
21 #include "pluginconfig.h"
23 using namespace SoftwareCrypto;
25 CKeyAgreementImpl::CKeyAgreementImpl()
29 void CKeyAgreementImpl::ConstructL(const CKey& aPrivateKey, const CCryptoParams* aParams)
31 SetKeyL(aPrivateKey, aParams);
34 CKeyAgreementImpl::~CKeyAgreementImpl()
40 void CKeyAgreementImpl::Close()
45 void CKeyAgreementImpl::Reset()
49 TAny* CKeyAgreementImpl::GetExtension(TUid /*aExtensionId*/)
54 void CKeyAgreementImpl::GetCharacteristicsL(const TAny*& aPluginCharacteristics)
56 TInt numCiphers = sizeof(KKeyAgreementCharacteristics)/sizeof(TKeyAgreementCharacteristics*);
57 TInt32 implUid = ImplementationUid().iUid;
58 for (TInt i = 0; i < numCiphers; ++i)
60 if (KKeyAgreementCharacteristics[i]->cmn.iImplementationUID == implUid)
62 aPluginCharacteristics = KKeyAgreementCharacteristics[i];
68 void CKeyAgreementImpl::SetKeyL(const CKey& aSelfPrivateKey, const CCryptoParams* aSharedParams)
71 iPrivateKey = CKey::NewL(aSelfPrivateKey);
73 iSharedParams = CCryptoParams::NewL();
74 iSharedParams->CopyL(*aSharedParams); // copy contents of the object