sl@0: /*
sl@0: * Copyright (c) 2004-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: * CSWICertStoreEntryList class implementation
sl@0: *
sl@0: */
sl@0: 
sl@0: 
sl@0: /**
sl@0:  @file 
sl@0:  @internalTechnology
sl@0: */
sl@0:  
sl@0: #ifndef __CSWICERTSTOREENTRYLIST_H__
sl@0: #define __CSWICERTSTOREENTRYLIST_H__
sl@0: 
sl@0: #include <s32file.h>
sl@0: 
sl@0: class MCTToken;
sl@0: class TCTTokenObjectHandle;
sl@0: class CSWICertStoreEntry;
sl@0: 
sl@0: /**
sl@0:  * An in-memory list of the certs in the store.
sl@0:  */
sl@0: NONSHARABLE_CLASS(CSWICertStoreEntryList) : public CBase
sl@0: 	{
sl@0:  public:
sl@0: 	/// Read the cert list from a stream
sl@0: 	static CSWICertStoreEntryList* NewL(RReadStream& aStream, MCTToken& aToken, TInt aCertIndex = 0, TInt aStoreIndex = 0);
sl@0: 
sl@0: 	static CSWICertStoreEntryList* NewL();
sl@0: 	
sl@0: 	virtual ~CSWICertStoreEntryList();
sl@0: 
sl@0: 	/// Get the number of certificates in the list
sl@0: 	TInt Count() const;
sl@0: 
sl@0: 	/// Determine whether a certificate exists with the specified label
sl@0: 	TBool LabelExists(const TDesC& aLabel) const;
sl@0: 	
sl@0: 	/// Add a mapping and return its index, takes ownership
sl@0: 	TInt AppendL(CSWICertStoreEntry* aEntry);
sl@0: 	
sl@0: 	/// Removes and an entry from the list
sl@0: 	void Remove(TInt aIndex);
sl@0: 	
sl@0: 	/// Get a mapping given its index.
sl@0: 	const CSWICertStoreEntry& GetByIndex(TInt aIndex) const;
sl@0: 
sl@0: 	/// Get a mapping given the cert handle.
sl@0: 	/// @leave KErrNotFound If the specified cert is not present.
sl@0: 	const CSWICertStoreEntry& GetByHandleL(const TCTTokenObjectHandle& aHandle) const;
sl@0: 	
sl@0:  private:
sl@0: 	CSWICertStoreEntryList();
sl@0: 	void InternalizeL(RReadStream& aStream, MCTToken& aToken, TInt aCertIndex, TInt aStoreIndex);
sl@0: 
sl@0:  private:
sl@0: 	RPointerArray<CSWICertStoreEntry> iEntries;
sl@0: 	};
sl@0: 
sl@0: #endif