|
1 /* |
|
2 * Copyright (c) 2006 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: The header file of TrustedSitesServer |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef __TRUSTEDSITESSERVER_H__ |
|
21 #define __TRUSTEDSITESSERVER_H__ |
|
22 |
|
23 #include <s32file.h> |
|
24 #include <e32std.h> |
|
25 #include <securitydefs.h> |
|
26 #include <d32dbms.h> |
|
27 |
|
28 class CTrustedSitesSession; |
|
29 class CTrustedSitesConduit; |
|
30 class CDevTokenServer; |
|
31 /** |
|
32 * Trust sites store implementation in server side |
|
33 * |
|
34 * @lib |
|
35 * @since S60 3.2 |
|
36 */ |
|
37 class CTrustedSitesServer : public CBase |
|
38 { |
|
39 public: |
|
40 |
|
41 static CTrustedSitesServer* NewL( CDevTokenServer* aServer ); |
|
42 |
|
43 virtual ~CTrustedSitesServer(); |
|
44 |
|
45 CTrustedSitesSession* CreateSessionL(); |
|
46 |
|
47 public: |
|
48 |
|
49 /** |
|
50 * add new trust record to trust site store |
|
51 * |
|
52 * @param aCert a certificate |
|
53 * @param aSiteName trusted site name |
|
54 * @param aMessage IPC message |
|
55 * @return |
|
56 */ |
|
57 void AddL(const TDesC8& aCert, const TDesC& aSiteName, const RMessage2& aMessage ); |
|
58 |
|
59 /** |
|
60 * add new trust record to trust site store, this is called internally in DeviceToken server |
|
61 * |
|
62 * @param aCert a certificate |
|
63 * @param aSiteName trusted site name |
|
64 * @return |
|
65 */ |
|
66 void AddL(const TDesC8& aCertHash, const TDesC& aSiteName ); |
|
67 |
|
68 /** |
|
69 * check whether the given cert is trusted for the given site |
|
70 * |
|
71 * @param aCert a certificate |
|
72 * @param aSiteName trusted site name |
|
73 * @param aCertBuf |
|
74 * @param aMessage IPC message |
|
75 * @return ETrue /EFalse |
|
76 */ |
|
77 TBool IsTrustedSiteL( const TDesC8& aCert, const TDesC& aSiteName, const TDesC8& aCertBuf, const RMessage2& aMessage ); |
|
78 |
|
79 |
|
80 /** |
|
81 * check whether the out of date certificate is allowed for the forgiven sites |
|
82 * |
|
83 * @param aCert a certificate |
|
84 * @param aSiteName trusted site name |
|
85 * @param aCertBuf |
|
86 * @param aMessage IPC message |
|
87 * @return ETrue /EFalse |
|
88 */ |
|
89 TBool IsOutOfDateAllowedL( const TDesC8& aCertHash, const TDesC& aSiteName, const RMessage2& aMessage ); |
|
90 |
|
91 /** |
|
92 * list all of the sites for which the cert is trusted |
|
93 * |
|
94 * @param aCert a certificate |
|
95 * @param aListOfSites trusted sites' name |
|
96 * @param aMessage IPC message |
|
97 * @return ETrue /EFalse |
|
98 */ |
|
99 void GetTrustedSitesL( const TDesC8& aCert, RPointerArray<HBufC>& aListOfSites, const RMessage2& aMessage); |
|
100 |
|
101 /** |
|
102 * Remove trust record from trust site store |
|
103 * |
|
104 * @param aCert a certificate |
|
105 * @return |
|
106 */ |
|
107 void RemoveL( const TDesC8& aCert ); |
|
108 |
|
109 /** |
|
110 * Add forgiven site. The site will be forgiven for untrusted certificate |
|
111 * |
|
112 * @param aSite |
|
113 * @param aOutOfDateAllowed |
|
114 * @param aMessage IPC message |
|
115 */ |
|
116 void AddForgivenSiteL(const TDesC& aSite,const TBool& aOutOfDateAllowed, const RMessage2& aMessage ); |
|
117 |
|
118 /** |
|
119 * Remove all forgiven sites set by this client |
|
120 * |
|
121 * @param aMessage IPC message |
|
122 */ |
|
123 void RemoveAllForgivenSitesL( const RMessage2& aMessage ); |
|
124 |
|
125 |
|
126 /** |
|
127 * Remove the given site |
|
128 * |
|
129 * @param aMessage IPC message |
|
130 */ |
|
131 void RemoveThisForgivenSiteL( const TDesC& aSite, const RMessage2& aMessage ); |
|
132 |
|
133 private: |
|
134 |
|
135 CTrustedSitesServer( CDevTokenServer* aServer ); |
|
136 |
|
137 void ConstructL(); |
|
138 |
|
139 void CreateDBL(); |
|
140 |
|
141 TBool IsSiteAlreadyExistL(const TInt& aCertID, const TDesC& aSiteName); |
|
142 |
|
143 TBool IsOutOfDateAllowedForTheSiteL(const TInt& aCertID, const TDesC& aSiteName); |
|
144 |
|
145 void DoAddSiteNameL(const TInt& aCertID, const TDesC& aSiteName ); |
|
146 |
|
147 void DoAddCertL( const TDesC8& aCertHash ); |
|
148 |
|
149 void GetCertIDL( const TDesC8& aCertHash, TInt& aCertID ); |
|
150 |
|
151 void DoRemoveL(const TInt& aCertID ); |
|
152 |
|
153 void DoGetTrustedSitesL( const TInt& aCertID, RPointerArray<HBufC>& aListOfSites); |
|
154 |
|
155 const TSecurityPolicy& AddRemovePolicy() const; |
|
156 |
|
157 const TSecurityPolicy& ReadPolicy() const; |
|
158 |
|
159 void DoOverWriteOutOfDateL( const TDesC& aSite, const TBool& aOutOfDateAllowed ); |
|
160 |
|
161 void DoOverWriteCertL( const TDesC& aSiteName, const TDesC8& aCertHash ); |
|
162 |
|
163 void DoAddForgivenSiteL(const TDesC& aSite, const TBool& aOutOfDateAllowed, const TUint32& aUID ); |
|
164 |
|
165 TBool IsForgivenSiteAlreadyL(const TDesC& aSite ); |
|
166 |
|
167 private: |
|
168 |
|
169 // Conduit for marshalling/unmarshalling client communications |
|
170 CTrustedSitesConduit* iConduit; |
|
171 |
|
172 RFs iFs; |
|
173 |
|
174 RDbNamedDatabase iDatabase; |
|
175 |
|
176 CDevTokenServer* iServer; //not owned |
|
177 }; |
|
178 |
|
179 #endif //_TRUSTEDSITESSERVER_H__ |
|
180 |
|
181 //EOF |
|
182 |