os/security/cryptoplugins/cryptospiplugins/source/softwarecrypto/keyagreementimpl.h
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/security/cryptoplugins/cryptospiplugins/source/softwarecrypto/keyagreementimpl.h	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,87 @@
     1.4 +/*
     1.5 +* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.6 +* All rights reserved.
     1.7 +* This component and the accompanying materials are made available
     1.8 +* under the terms of the License "Eclipse Public License v1.0"
     1.9 +* which accompanies this distribution, and is available
    1.10 +* at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.11 +*
    1.12 +* Initial Contributors:
    1.13 +* Nokia Corporation - initial contribution.
    1.14 +*
    1.15 +* Contributors:
    1.16 +*
    1.17 +* Description: 
    1.18 +*
    1.19 +*/
    1.20 +
    1.21 +
    1.22 +#ifndef __KEYAGREEMENTIMPL_H__
    1.23 +#define __KEYAGREEMENTIMPL_H__
    1.24 +
    1.25 +/**
    1.26 +@file 
    1.27 +@internalComponent
    1.28 +@released
    1.29 +*/
    1.30 +
    1.31 +#include <e32base.h>
    1.32 +#include <cryptospi/cryptospidef.h>
    1.33 +#include "keys.h"
    1.34 +#include "keyagreementplugin.h"
    1.35 +
    1.36 +/**
    1.37 + * Abstract base class for key agreement plug-ins.
    1.38 + */
    1.39 +namespace SoftwareCrypto
    1.40 +	{
    1.41 +	using namespace CryptoSpi;
    1.42 +	
    1.43 +	NONSHARABLE_CLASS(CKeyAgreementImpl) : public CBase, public MKeyAgreement
    1.44 +		{
    1.45 +	public:
    1.46 +		
    1.47 +		// Override MPlugin virtual functions
    1.48 +		void Close();
    1.49 +		void Reset(); // Always call reset in super-class if you override this
    1.50 +		TAny* GetExtension(TUid aExtensionId);
    1.51 +		void GetCharacteristicsL(const TCharacteristics*& aPluginCharacteristics);
    1.52 +		// End of MPlugin
    1.53 +
    1.54 +		// Override MKeyAgreement virtual functions
    1.55 +		void SetKeyL(const CKey& aSelfPrivateKey, const CCryptoParams* aParams);
    1.56 +		// End of MKeyAgreement
    1.57 +
    1.58 +		/// Destructor
    1.59 +		~CKeyAgreementImpl();
    1.60 +		
    1.61 +	protected:
    1.62 +		/**
    1.63 +		Constructor
    1.64 +		*/
    1.65 +		CKeyAgreementImpl();
    1.66 +			
    1.67 +		/**
    1.68 +		Second phase of construction. Always call ConstructL in the super-class
    1.69 +		if your override this method.
    1.70 +		@param aPrivateKey The private key of one of the parties
    1.71 +		@param aParams	The parameters shared between both parties
    1.72 +		*/
    1.73 +		virtual void ConstructL(const CKey& aPrivateKey, const CCryptoParams* aParams);
    1.74 +
    1.75 +		/**
    1.76 +		Helper function implemented by concrete cipher sub-class that allows
    1.77 +		GetCharacteristicsL to return the correct characteristics object.
    1.78 +		@return The implemention uid
    1.79 +		*/
    1.80 +		virtual TUid ImplementationUid() const = 0;
    1.81 +
    1.82 +	private:
    1.83 +
    1.84 +	protected:
    1.85 +		CKey* iPrivateKey;
    1.86 +		CCryptoParams* iSharedParams;	// common parameters between our private key and their public key
    1.87 +		};
    1.88 +	}
    1.89 +
    1.90 +#endif	//	__KEYAGREEMENTIMPL_H__