eapol/eapol_framework/eapol_symbian/am/include/EapTlsPeapCertInterface.h
changeset 0 c8830336c852
child 2 1c7bc153c08e
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/eapol/eapol_framework/eapol_symbian/am/include/EapTlsPeapCertInterface.h	Thu Dec 17 08:47:43 2009 +0200
@@ -0,0 +1,213 @@
+/*
+* Copyright (c) 2001-2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  EAP and WLAN authentication protocols.
+*
+*/
+
+
+#ifndef _EAPTLSPEAPCERTINTERFACE_H_
+#define _EAPTLSPEAPCERTINTERFACE_H_
+
+// INCLUDES
+#include <e32base.h>
+#include "eap_tools.h"
+#include "eap_am_type_tls_peap_symbian.h"
+#include <unifiedcertstore.h>
+#include <mctwritablecertstore.h>
+#include <unifiedkeystore.h>
+#include <pkixcertchain.h>
+#include <x509cert.h>
+#include "EapTlsPeapUtils.h"
+
+const TInt KMaxHashLength = 128;
+// FORWARD DECLARATIONS
+
+
+// CLASS DECLARATION
+class CEapTlsPeapCertInterface 
+: public CActive
+{
+public:
+	
+	static CEapTlsPeapCertInterface* NewL(abs_eap_am_tools_c* const aTools, 
+		eap_am_type_tls_peap_symbian_c* const aParent);	
+
+	virtual ~CEapTlsPeapCertInterface();	
+	
+	void ReadCertificateL(SCertEntry& aCertInfo, const TBool aRetrieveChain);
+	
+	void ReadCACertificateL(SCertEntry& aCertInfo);
+	
+	void ReadPrivateKeyL(TKeyIdentifier& aHash);
+	
+	void ValidateChainL(TDesC8& aCertChain, RArray<SCertEntry>& aCACerts);
+
+	
+	void GetMatchingCertificatesL(
+		const RArray<SCertEntry>& aAllowedUserCerts,
+		const TBool aUseCertAuthoritiesFilter,
+		EAP_TEMPLATE_CONST eap_array_c<eap_variable_data_c> * const aCertAuthorities,
+		const TBool aUseCertTypesFilter,
+		EAP_TEMPLATE_CONST eap_array_c<u8_t> * const aCertTypes,
+		const TBool aUseAllowedCipherSuitesFilter,
+		const RArray<TUint>& aAllowedCipherSuites);		
+
+	void SignL(
+		TKeyIdentifier& aKeyId,
+		const TDesC8& aHashIn,
+		const TUint aSignatureLength);
+
+	void DecryptL(
+		TKeyIdentifier& aKeyId,
+		const TDesC8& aData);
+		
+	void CancelSignWithPrivateKey();		
+
+protected:
+	
+	CEapTlsPeapCertInterface(abs_eap_am_tools_c* const aTools, eap_am_type_tls_peap_symbian_c* const aParent);
+	
+	void ConstructL();
+	
+	void RunL();
+	
+	void DoCancel();
+
+private:
+
+	enum TState
+	{
+		EReadCertInitStore,
+		EReadCertList,
+		EReadCert,		
+		EValidateChainInitStore,
+		EValidateChainGetCACertList,
+		EValidateChainGetCACert,		
+		EValidateChainEnd,
+		EGetMatchingCertsInitStore,
+		EGetMatchingCertsInitialize,
+		EGetMatchingCertsLoop,
+		ESignInitStore,
+		ESignList,
+		ESignOpenKeyStore,
+		ESign,
+		EDecryptInitStore,
+		EDecryptList,
+		EDecryptOpenKeyStore,
+		EDecrypt,		
+		EGetAllCerts,
+		ECreateCertChain,
+		ERetrieveChainInitStore,		
+		ESetPassphraseTimeout,
+		EReadCACertInitStore,
+		EReadCACertList,
+		EReadCACert
+	};
+	
+	TState iState;
+	
+	eap_am_type_tls_peap_symbian_c * const iParent;
+	
+	abs_eap_am_tools_c * const m_am_tools;	
+	
+	CUnifiedCertStore* iCertStore;	
+	
+	MRSASigner* iRSASigner;
+	
+	MDSASigner* iDSASigner;
+	
+	MCTDecryptor* iDecryptor;
+	
+	RFs iFs;
+	
+	RArray<SCertEntry> iAllowedUserCerts;
+
+	TBool iUseCertAuthoritiesFilter;
+	
+	TBool iUseCertTypesFilter;
+	
+	TBool iUseAllowedCipherSuitesFilter;
+
+	TBool iRSACertsAllowed;
+
+	TBool iDSACertsAllowed;
+	
+	RPointerArray<CX500DistinguishedName> iCertAuthorities;
+	
+	const eap_array_c<u8_t>* iCertTypes;
+
+	RMPointerArray<CCTCertInfo> iCertInfos;
+	
+	RMPointerArray<CCTKeyInfo> iKeyInfos;
+	
+	HBufC8* iEncodedCertificate;
+	TPtr8 iCertPtr;
+
+	CCertAttributeFilter* iCertFilter;
+	
+	TCTKeyAttributeFilter* iKeyFilter;
+	
+	CPKIXCertChain* iCertChain;
+	
+	CPKIXValidationResult* iValidationResult;
+	
+	TTime iTime;
+	
+	RPointerArray<CX509Certificate> iRootCerts;
+
+	RPointerArray<CX509Certificate> iMatchingUserCerts;
+
+	RPointerArray<CX509Certificate> iUserCertChain;
+	
+	CArrayFixFlat<SCertEntry> iMatchingUserCertInfos;
+
+	TUint iCAIndex;
+
+	TUint iUserCertIndex;
+	
+	RArray<SCertEntry> iAllowedCACerts;
+	
+	HBufC8* iInputCertChain;
+
+	SCertEntry iCertInfo;
+
+	TAny *iResArray;	
+
+	// SignL
+	TKeyIdentifier iKeyIdentifier;
+
+	TBuf8<KMaxHashLength> iHashIn;
+
+	HBufC8* iDataIn;
+	
+	HBufC8* iDataOut;
+
+	HBufC8* iSignature;
+	
+	CRSASignature* iRSASignature;
+	
+	CDSASignature* iDSASignature;
+	
+	TPtr8* iSignaturePtr;
+
+	TPtr8* iPtrOut;
+
+	CUnifiedKeyStore* iKeyStore;
+
+	TBool iRetrieveChain;
+}; 
+
+#endif // _EAPTLSPEAPCERTINTERFACE_H_
+
+// End of file