os/security/cryptoservices/certificateandkeymgmt/swicertstore/CSWICertStoreToken.cpp
First public contribution.
2 * Copyright (c) 2004-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 "CSWICertStoreToken.h"
20 #include "CSWICertStoreTokenType.h"
21 #include <swicertstore.h>
23 _LIT(KSWICertStoreTokenLabel, "SWI cert store");
24 _LIT(KSWICertStoreVersion, "1.00");
25 _LIT(KSWICertStoreSerialNo, "N/A");
26 _LIT(KSWICertStoreManufacturer, "Symbian Software Ltd.");
28 CSWICertStoreToken::CSWICertStoreToken(CCTTokenType& aTokenType) :
29 iTokenType(aTokenType)
33 CSWICertStoreToken::~CSWICertStoreToken()
37 MCTTokenType& CSWICertStoreToken::TokenType()
42 const TDesC& CSWICertStoreToken::Label()
44 return KSWICertStoreTokenLabel;
47 TCTTokenHandle CSWICertStoreToken::Handle()
49 TUid tokenTypeUid = { KSWICertStoreTokenTypeUid };
50 return TCTTokenHandle(tokenTypeUid, 0);
53 TInt& CSWICertStoreToken::ReferenceCount()
58 void CSWICertStoreToken::DoGetInterface(TUid aRequiredInterface,
59 MCTTokenInterface*& aReturnedInterface,
60 TRequestStatus& aStatus)
62 TInt result = KErrNone;
64 if (aRequiredInterface.iUid != KInterfaceCertStore)
66 result = KErrNotSupported;
72 TRAP(result, iCertStore = CSWICertStore::NewL(*this, iTokenType.Fs()));
76 if (result != KErrNone)
83 aReturnedInterface = static_cast<MCTCertStore*>(iCertStore);
86 TRequestStatus* stat = &aStatus;
87 User::RequestComplete(stat, result);
90 TBool CSWICertStoreToken::DoCancelGetInterface()
95 const TDesC& CSWICertStoreToken::Information(TTokenInformation aRequiredInformation)
97 //there is no support for localisation here
98 switch (aRequiredInformation)
101 return KSWICertStoreVersion;
104 return KSWICertStoreSerialNo;
107 return KSWICertStoreManufacturer;
114 TBool CSWICertStoreToken::ReleaseInterface()
116 // Decrement the interface's reference count and return whether it should be
117 // deleted. Called by CSWICertStore's DoRelease method.
119 TBool canDelete = --iInterfaceRefCount == 0;