|
1 /* |
|
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "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". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 #include <mctcertstore.h> |
|
19 #include <mctwritablecertstore.h> |
|
20 |
|
21 #include "javacertstoreimpl.h" |
|
22 #include "javacertstoretokentype.h" |
|
23 #include "javacertstoretoken.h" |
|
24 #include "logger.h" |
|
25 |
|
26 using namespace java::security; |
|
27 |
|
28 CJavaCertStoreToken* CJavaCertStoreToken::New(TInt aId, CJavaCertStoreTokenType& aType) |
|
29 { |
|
30 return new CJavaCertStoreToken(aId,aType); |
|
31 } |
|
32 |
|
33 CJavaCertStoreToken::CJavaCertStoreToken(TInt aId,CJavaCertStoreTokenType& aType) |
|
34 : iType(aType),iId(aId),iRefCount(0) |
|
35 { |
|
36 } |
|
37 |
|
38 CJavaCertStoreToken::~CJavaCertStoreToken() |
|
39 { |
|
40 } |
|
41 |
|
42 MCTTokenType& CJavaCertStoreToken::TokenType() |
|
43 { |
|
44 return iType; |
|
45 } |
|
46 |
|
47 _LIT(KDummy1, "++Dummy1++"); |
|
48 |
|
49 const TDesC& CJavaCertStoreToken::Label() |
|
50 { |
|
51 return KDummy1(); |
|
52 } |
|
53 |
|
54 TCTTokenHandle CJavaCertStoreToken::Handle() |
|
55 { |
|
56 return TCTTokenHandle(iType.Type(),iId); |
|
57 } |
|
58 |
|
59 TInt& CJavaCertStoreToken::ReferenceCount() |
|
60 { |
|
61 return iRefCount; |
|
62 } |
|
63 |
|
64 void CJavaCertStoreToken::DoGetInterface(TUid aRequiredInterface, |
|
65 MCTTokenInterface*& aReturnedInterface, |
|
66 TRequestStatus& aStatus) |
|
67 { |
|
68 |
|
69 aStatus = KRequestPending; |
|
70 |
|
71 TInt status = KErrNotSupported; |
|
72 aReturnedInterface = NULL; |
|
73 MCTTokenInterface* tmpObj = NULL; |
|
74 if (KInterfaceCertStore == aRequiredInterface.iUid) |
|
75 { |
|
76 status = KErrNone; |
|
77 TRAP(status, tmpObj = CJavaCertStoreImpl::NewL(*this)); |
|
78 } |
|
79 else if (KInterfaceWritableCertStore == aRequiredInterface.iUid) |
|
80 { |
|
81 status = KErrNone; |
|
82 TRAP(status, tmpObj = CJavaCertStoreImpl::NewL(*this)); |
|
83 } |
|
84 else |
|
85 { |
|
86 Release(); |
|
87 } |
|
88 if (KErrNone == status) |
|
89 { |
|
90 aReturnedInterface = tmpObj; |
|
91 } |
|
92 //aStatus = KRequestPending; |
|
93 TRequestStatus* pStatus = &aStatus; |
|
94 User::RequestComplete(pStatus,status); |
|
95 } |
|
96 |
|
97 TBool CJavaCertStoreToken::DoCancelGetInterface() |
|
98 { |
|
99 return EFalse; |
|
100 } |
|
101 |
|
102 _LIT(KDummy2, "++Dummy2++"); |
|
103 |
|
104 const TDesC& CJavaCertStoreToken::Information(TTokenInformation) |
|
105 { |
|
106 return KDummy2(); |
|
107 } |
|
108 |
|
109 |
|
110 |