os/security/cryptoservices/filebasedcertificateandkeystores/test/ttestplugin/cdummytokenclient.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 "cdummytokenclient.h"
20 #include "cdummykeystoreclient.h"
22 _LIT(KTokenString, "Dummy Token");
25 MCTToken* CDummyTokenClient::NewL(MCTTokenType* aTokenType)
27 CDummyTokenClient* self = new (ELeave) CDummyTokenClient(aTokenType);
28 return static_cast<MCTToken*>(self);
31 CDummyTokenClient::CDummyTokenClient(MCTTokenType* aTokenType)
32 : iTokenType(aTokenType),
37 MCTTokenType& CDummyTokenClient::TokenType()
42 const TDesC& CDummyTokenClient::Label()
44 return KTokenString();
47 TCTTokenHandle CDummyTokenClient::Handle()
49 return (TCTTokenHandle(iTokenType->Type(), 0));
52 TInt& CDummyTokenClient::ReferenceCount()
57 void CDummyTokenClient::DoGetInterface(TUid aRequiredInterface, MCTTokenInterface*& aReturnedInterface, TRequestStatus& aStatus)
59 // No longer calls server to get the interface - just creates a client object of the appropriate type
60 TUid userUid = {0x101F7334};
61 #ifndef KEYSTORE_INTERFACE
62 TUid managerUid = {0x101F7335};
63 #endif // KEYSTORE_INTERFACE
65 // Complete the TRequestStatus here since not asynchronous
66 TRequestStatus* status = &aStatus;
67 aReturnedInterface = NULL;
68 TInt err = KErrGeneral;
70 if(userUid == aRequiredInterface
71 #ifndef KEYSTORE_INTERFACE
72 || managerUid == aRequiredInterface
73 #endif //KEYSTORE_INTERFACE
76 TRAP(err, aReturnedInterface = CDummyKeyStoreClient::NewKeyStoreInterfaceL(*this));
79 if (NULL == aReturnedInterface)
84 User::RequestComplete(status, err);
87 TBool CDummyTokenClient::DoCancelGetInterface()
88 {// Not an asynchronous call for current file store, so nothing to do
92 const TDesC& CDummyTokenClient::Information(TTokenInformation /*aRequiredInformation*/)