sl@0
|
1 |
/*
|
sl@0
|
2 |
* Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
3 |
* All rights reserved.
|
sl@0
|
4 |
* This component and the accompanying materials are made available
|
sl@0
|
5 |
* under the terms of the License "Eclipse Public License v1.0"
|
sl@0
|
6 |
* which accompanies this distribution, and is available
|
sl@0
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
8 |
*
|
sl@0
|
9 |
* Initial Contributors:
|
sl@0
|
10 |
* Nokia Corporation - initial contribution.
|
sl@0
|
11 |
*
|
sl@0
|
12 |
* Contributors:
|
sl@0
|
13 |
*
|
sl@0
|
14 |
* Description:
|
sl@0
|
15 |
*
|
sl@0
|
16 |
*/
|
sl@0
|
17 |
|
sl@0
|
18 |
|
sl@0
|
19 |
#include "fsmarshaller.h"
|
sl@0
|
20 |
#include "fsdatatypes.h"
|
sl@0
|
21 |
#include "NullStream.h"
|
sl@0
|
22 |
#include <asymmetric.h>
|
sl@0
|
23 |
#include <bigint.h>
|
sl@0
|
24 |
#include <pbedata.h>
|
sl@0
|
25 |
#include <s32mem.h>
|
sl@0
|
26 |
#include <certificateapps.h>
|
sl@0
|
27 |
#include <ccertattributefilter.h>
|
sl@0
|
28 |
|
sl@0
|
29 |
// Generic externalization stuff ///////////////////////////////////////////////
|
sl@0
|
30 |
|
sl@0
|
31 |
/**
|
sl@0
|
32 |
* Determine how many bytes are taked up by the externalized representation of
|
sl@0
|
33 |
* an object.
|
sl@0
|
34 |
*/
|
sl@0
|
35 |
template <class T>
|
sl@0
|
36 |
TInt Size(const T& aObject)
|
sl@0
|
37 |
{
|
sl@0
|
38 |
RNullWriteStream stream;
|
sl@0
|
39 |
TRAPD(err, stream << aObject);
|
sl@0
|
40 |
if(err != KErrNone)
|
sl@0
|
41 |
{
|
sl@0
|
42 |
_LIT(KPanicCategory, "InValid Size");
|
sl@0
|
43 |
User::Panic(KPanicCategory,ESerialisationPanic);
|
sl@0
|
44 |
}
|
sl@0
|
45 |
stream.Close();
|
sl@0
|
46 |
return stream.BytesWritten();
|
sl@0
|
47 |
}
|
sl@0
|
48 |
|
sl@0
|
49 |
/**
|
sl@0
|
50 |
* Externalize an object to a buffer. Leaves if an error occurs.
|
sl@0
|
51 |
*/
|
sl@0
|
52 |
template <class T>
|
sl@0
|
53 |
void WriteL(const T& aIn, TDes8& aOut)
|
sl@0
|
54 |
{
|
sl@0
|
55 |
RDesWriteStream stream(aOut);
|
sl@0
|
56 |
stream << aIn;
|
sl@0
|
57 |
stream.Close();
|
sl@0
|
58 |
}
|
sl@0
|
59 |
|
sl@0
|
60 |
/**
|
sl@0
|
61 |
* Externalize an object to a buffer. In debug mode, it will panics if an error
|
sl@0
|
62 |
* occurs - eg buffer is too short. In release mode, errors are ignored.
|
sl@0
|
63 |
*/
|
sl@0
|
64 |
template <class T>
|
sl@0
|
65 |
void Write(const T& aIn, TDes8& aOut)
|
sl@0
|
66 |
{
|
sl@0
|
67 |
TRAPD(err, WriteL(aIn, aOut));
|
sl@0
|
68 |
if(err != KErrNone)
|
sl@0
|
69 |
{
|
sl@0
|
70 |
_LIT(KPanicCategory, "Writing Error");
|
sl@0
|
71 |
User::Panic(KPanicCategory,ESerialisationPanic);
|
sl@0
|
72 |
}
|
sl@0
|
73 |
}
|
sl@0
|
74 |
|
sl@0
|
75 |
/**
|
sl@0
|
76 |
* Implement Externalization selector for RPointerArrays to use a function.
|
sl@0
|
77 |
*/
|
sl@0
|
78 |
template <class T>
|
sl@0
|
79 |
EXTERNALIZE_FUNCTION(RPointerArray<T>)
|
sl@0
|
80 |
|
sl@0
|
81 |
/**
|
sl@0
|
82 |
* Function to externalize RPointerArrays.
|
sl@0
|
83 |
*
|
sl@0
|
84 |
* Although this is generic, it's currently only instantiated for CKeyInfo.
|
sl@0
|
85 |
*/
|
sl@0
|
86 |
template <class T>
|
sl@0
|
87 |
void ExternalizeL(const RPointerArray<T>& aIn, RWriteStream& aOut)
|
sl@0
|
88 |
{
|
sl@0
|
89 |
TInt count = aIn.Count();
|
sl@0
|
90 |
aOut.WriteInt32L(count);
|
sl@0
|
91 |
for (TInt i = 0 ; i < count ; ++i)
|
sl@0
|
92 |
{
|
sl@0
|
93 |
T* object = aIn[i];
|
sl@0
|
94 |
if (object == NULL)
|
sl@0
|
95 |
{
|
sl@0
|
96 |
User::Leave(KErrArgument);
|
sl@0
|
97 |
}
|
sl@0
|
98 |
aOut << *object;
|
sl@0
|
99 |
}
|
sl@0
|
100 |
}
|
sl@0
|
101 |
|
sl@0
|
102 |
/**
|
sl@0
|
103 |
* Implement Externalization selector for RArrays to use a function.
|
sl@0
|
104 |
*/
|
sl@0
|
105 |
template <class T>
|
sl@0
|
106 |
EXTERNALIZE_FUNCTION(RArray<T>)
|
sl@0
|
107 |
|
sl@0
|
108 |
/**
|
sl@0
|
109 |
* Function to externalize RArrays.
|
sl@0
|
110 |
*/
|
sl@0
|
111 |
template <class T>
|
sl@0
|
112 |
void ExternalizeL(const RArray<T>& aIn, RWriteStream& aOut)
|
sl@0
|
113 |
{
|
sl@0
|
114 |
TInt count = aIn.Count();
|
sl@0
|
115 |
aOut.WriteInt32L(count);
|
sl@0
|
116 |
for (TInt i = 0 ; i < count ; ++i)
|
sl@0
|
117 |
{
|
sl@0
|
118 |
aOut << aIn[i];
|
sl@0
|
119 |
}
|
sl@0
|
120 |
}
|
sl@0
|
121 |
|
sl@0
|
122 |
// No-so-generic internalization stuff /////////////////////////////////////////
|
sl@0
|
123 |
|
sl@0
|
124 |
/**
|
sl@0
|
125 |
* Internalize an object from a descriptor.
|
sl@0
|
126 |
*/
|
sl@0
|
127 |
template <class T>
|
sl@0
|
128 |
void ReadL(const TDesC8& aIn, T& aOut)
|
sl@0
|
129 |
{
|
sl@0
|
130 |
RDesReadStream stream(aIn);
|
sl@0
|
131 |
stream >> aOut;
|
sl@0
|
132 |
stream.Close();
|
sl@0
|
133 |
}
|
sl@0
|
134 |
|
sl@0
|
135 |
/**
|
sl@0
|
136 |
* Implement Internalization selector for RArrays to use a function.
|
sl@0
|
137 |
*/
|
sl@0
|
138 |
template <class T>
|
sl@0
|
139 |
inline Internalize::Function Internalization(const RArray<T>*)
|
sl@0
|
140 |
{
|
sl@0
|
141 |
return Internalize::Function();
|
sl@0
|
142 |
}
|
sl@0
|
143 |
|
sl@0
|
144 |
/**
|
sl@0
|
145 |
* Function to internalize an RArray.
|
sl@0
|
146 |
*/
|
sl@0
|
147 |
template <class T>
|
sl@0
|
148 |
void InternalizeL(RArray<T>& aOut, RReadStream& aIn)
|
sl@0
|
149 |
{
|
sl@0
|
150 |
ASSERT(aOut.Count() == 0);
|
sl@0
|
151 |
TInt count = aIn.ReadInt32L();
|
sl@0
|
152 |
for (TInt i = 0 ; i < count ; ++i)
|
sl@0
|
153 |
{
|
sl@0
|
154 |
T t;
|
sl@0
|
155 |
aIn >> t;
|
sl@0
|
156 |
User::LeaveIfError(aOut.Append(t));
|
sl@0
|
157 |
}
|
sl@0
|
158 |
}
|
sl@0
|
159 |
|
sl@0
|
160 |
/**
|
sl@0
|
161 |
* Internalize an object from a stream. Creates an instance by calling the
|
sl@0
|
162 |
* class' NewL(RReadStream&) method.
|
sl@0
|
163 |
*/
|
sl@0
|
164 |
template <class T>
|
sl@0
|
165 |
inline void CreateL(RReadStream& aIn, T*& aOut)
|
sl@0
|
166 |
{
|
sl@0
|
167 |
aOut = T::NewL(aIn);
|
sl@0
|
168 |
}
|
sl@0
|
169 |
|
sl@0
|
170 |
/**
|
sl@0
|
171 |
* Internalize an object from a descriptor.
|
sl@0
|
172 |
*/
|
sl@0
|
173 |
template <class T>
|
sl@0
|
174 |
void CreateL(const TDesC8& aIn, T& aOut)
|
sl@0
|
175 |
{
|
sl@0
|
176 |
RDesReadStream stream(aIn);
|
sl@0
|
177 |
CreateL(stream, aOut);
|
sl@0
|
178 |
stream.Close();
|
sl@0
|
179 |
}
|
sl@0
|
180 |
|
sl@0
|
181 |
/**
|
sl@0
|
182 |
* Internalize an object from a descriptor leaving the result on the cleanup
|
sl@0
|
183 |
* stack. This is generic, but is only instantiated for RInteger.
|
sl@0
|
184 |
*/
|
sl@0
|
185 |
template <class T>
|
sl@0
|
186 |
void CreateLC(const TDesC8& aIn, T& aOut)
|
sl@0
|
187 |
{
|
sl@0
|
188 |
RDesReadStream stream(aIn);
|
sl@0
|
189 |
CreateLC(stream, aOut);
|
sl@0
|
190 |
stream.Close();
|
sl@0
|
191 |
}
|
sl@0
|
192 |
|
sl@0
|
193 |
/**
|
sl@0
|
194 |
* Internalize a cryptotokens object from a descriptor.
|
sl@0
|
195 |
*/
|
sl@0
|
196 |
template <class T>
|
sl@0
|
197 |
void CreateL(const TDesC8& aIn, MCTToken& aToken, T& aOut)
|
sl@0
|
198 |
{
|
sl@0
|
199 |
RDesReadStream stream(aIn);
|
sl@0
|
200 |
CreateL(stream, aToken, aOut);
|
sl@0
|
201 |
stream.Close();
|
sl@0
|
202 |
}
|
sl@0
|
203 |
|
sl@0
|
204 |
/**
|
sl@0
|
205 |
* Internalize a cryptotoken object from a stream. Creates an instance by
|
sl@0
|
206 |
* calling the class' NewL(RReadStream&, MCTToken&) method.
|
sl@0
|
207 |
*/
|
sl@0
|
208 |
template <class T>
|
sl@0
|
209 |
inline void CreateL(RReadStream& aIn, MCTToken& aToken, T*& aOut)
|
sl@0
|
210 |
{
|
sl@0
|
211 |
aOut = T::NewL(aIn, aToken);
|
sl@0
|
212 |
}
|
sl@0
|
213 |
|
sl@0
|
214 |
/**
|
sl@0
|
215 |
* Internalize an array of of key info objects from a stream.
|
sl@0
|
216 |
*/
|
sl@0
|
217 |
void CreateL(RReadStream& aIn, MCTToken& aToken, MKeyInfoArray& aOut)
|
sl@0
|
218 |
{
|
sl@0
|
219 |
TInt count = aIn.ReadInt32L();
|
sl@0
|
220 |
for (TInt i = 0 ; i < count ; ++i)
|
sl@0
|
221 |
{
|
sl@0
|
222 |
CCTKeyInfo* t;
|
sl@0
|
223 |
CreateL(aIn, aToken, t);
|
sl@0
|
224 |
CleanupReleasePushL(*t);
|
sl@0
|
225 |
User::LeaveIfError(aOut.Append(t));
|
sl@0
|
226 |
CleanupStack::Pop();
|
sl@0
|
227 |
}
|
sl@0
|
228 |
}
|
sl@0
|
229 |
|
sl@0
|
230 |
// can we combine this with the one above?
|
sl@0
|
231 |
|
sl@0
|
232 |
/**
|
sl@0
|
233 |
* Internalize an RMPointerArray of cryptotoken objects from a stream.
|
sl@0
|
234 |
*/
|
sl@0
|
235 |
template <class T>
|
sl@0
|
236 |
void CreateL(RReadStream& aIn, MCTToken& aToken, RMPointerArray<T>& aOut)
|
sl@0
|
237 |
{
|
sl@0
|
238 |
TInt count = aIn.ReadInt32L();
|
sl@0
|
239 |
for (TInt i = 0 ; i < count ; ++i)
|
sl@0
|
240 |
{
|
sl@0
|
241 |
T* t;
|
sl@0
|
242 |
CreateL(aIn, aToken, t);
|
sl@0
|
243 |
CleanupReleasePushL(*t);
|
sl@0
|
244 |
User::LeaveIfError(aOut.Append(t));
|
sl@0
|
245 |
CleanupStack::Pop();
|
sl@0
|
246 |
}
|
sl@0
|
247 |
}
|
sl@0
|
248 |
|
sl@0
|
249 |
// Serialization for RIntegers /////////////////////////////////////////////////
|
sl@0
|
250 |
|
sl@0
|
251 |
// This is exported as it is useful itself in the server
|
sl@0
|
252 |
|
sl@0
|
253 |
/**
|
sl@0
|
254 |
* Implement a CreateL function for internalizing HBufC8s.
|
sl@0
|
255 |
*/
|
sl@0
|
256 |
inline void CreateL(RReadStream& aIn, HBufC8*& aOut)
|
sl@0
|
257 |
{
|
sl@0
|
258 |
aOut = HBufC8::NewL(aIn, KMaxIntegerSize);
|
sl@0
|
259 |
}
|
sl@0
|
260 |
|
sl@0
|
261 |
/**
|
sl@0
|
262 |
* Implement a CreateLC function for internalizing RIntegers.
|
sl@0
|
263 |
*/
|
sl@0
|
264 |
EXPORT_C void CreateLC(RReadStream& aIn, RInteger& aOut)
|
sl@0
|
265 |
{
|
sl@0
|
266 |
HBufC8* rBuf;
|
sl@0
|
267 |
CreateL(aIn, rBuf);
|
sl@0
|
268 |
CleanupStack::PushL(rBuf);
|
sl@0
|
269 |
TPtr8 rPtr(rBuf->Des());
|
sl@0
|
270 |
aOut = RInteger::NewL(rPtr);
|
sl@0
|
271 |
CleanupStack::PopAndDestroy(rBuf);
|
sl@0
|
272 |
CleanupStack::PushL(aOut);
|
sl@0
|
273 |
}
|
sl@0
|
274 |
|
sl@0
|
275 |
/**
|
sl@0
|
276 |
* Externalize an RInteger.
|
sl@0
|
277 |
*/
|
sl@0
|
278 |
EXPORT_C void ExternalizeL(const TInteger& aIn, RWriteStream& aOut)
|
sl@0
|
279 |
{
|
sl@0
|
280 |
HBufC8* sBuf = aIn.BufferLC();
|
sl@0
|
281 |
aOut << *sBuf;
|
sl@0
|
282 |
CleanupStack::PopAndDestroy(sBuf);
|
sl@0
|
283 |
}
|
sl@0
|
284 |
|
sl@0
|
285 |
// Externalization for signature objects ///////////////////////////////////////
|
sl@0
|
286 |
|
sl@0
|
287 |
/**
|
sl@0
|
288 |
* Implement Externalization selector for CDSASignature to use a function.
|
sl@0
|
289 |
*/
|
sl@0
|
290 |
EXTERNALIZE_FUNCTION(CDSASignature)
|
sl@0
|
291 |
|
sl@0
|
292 |
/**
|
sl@0
|
293 |
* Externalise a DSA signature object.
|
sl@0
|
294 |
*/
|
sl@0
|
295 |
void ExternalizeL(const CDSASignature& aIn, RWriteStream& aOut)
|
sl@0
|
296 |
{
|
sl@0
|
297 |
aOut << aIn.R();
|
sl@0
|
298 |
aOut << aIn.S();
|
sl@0
|
299 |
}
|
sl@0
|
300 |
|
sl@0
|
301 |
/**
|
sl@0
|
302 |
* Implement Externalization selector for CRSASignature to use a function.
|
sl@0
|
303 |
*/
|
sl@0
|
304 |
EXTERNALIZE_FUNCTION(CRSASignature)
|
sl@0
|
305 |
|
sl@0
|
306 |
/**
|
sl@0
|
307 |
* Externalize an RSA signature object.
|
sl@0
|
308 |
*/
|
sl@0
|
309 |
void ExternalizeL(const CRSASignature& aIn, RWriteStream& aOut)
|
sl@0
|
310 |
{
|
sl@0
|
311 |
aOut << aIn.S();
|
sl@0
|
312 |
}
|
sl@0
|
313 |
|
sl@0
|
314 |
// Internalization for signature objects ///////////////////////////////////////
|
sl@0
|
315 |
|
sl@0
|
316 |
/**
|
sl@0
|
317 |
* Specialise CreateL for CRSASignature.
|
sl@0
|
318 |
*/
|
sl@0
|
319 |
template <>
|
sl@0
|
320 |
void CreateL(RReadStream& aIn, CRSASignature*& aOut)
|
sl@0
|
321 |
{
|
sl@0
|
322 |
RInteger r;
|
sl@0
|
323 |
CreateLC(aIn, r);
|
sl@0
|
324 |
aOut = CRSASignature::NewL(r);
|
sl@0
|
325 |
CleanupStack::Pop(); // r
|
sl@0
|
326 |
}
|
sl@0
|
327 |
|
sl@0
|
328 |
/**
|
sl@0
|
329 |
* Specialise CreateL for CDSASignature.
|
sl@0
|
330 |
*/
|
sl@0
|
331 |
template <>
|
sl@0
|
332 |
void CreateL(RReadStream& aIn, CDSASignature*& aOut)
|
sl@0
|
333 |
{
|
sl@0
|
334 |
RInteger r;
|
sl@0
|
335 |
CreateLC(aIn, r);
|
sl@0
|
336 |
RInteger s;
|
sl@0
|
337 |
CreateLC(aIn, s);
|
sl@0
|
338 |
aOut = CDSASignature::NewL(r, s);
|
sl@0
|
339 |
CleanupStack::Pop(2); // s, r
|
sl@0
|
340 |
}
|
sl@0
|
341 |
|
sl@0
|
342 |
// Serialization for DH ojects /////////////////////////////////////////////////
|
sl@0
|
343 |
|
sl@0
|
344 |
/**
|
sl@0
|
345 |
* Implement Externalization selector for CDHParams to use a function.
|
sl@0
|
346 |
*/
|
sl@0
|
347 |
EXTERNALIZE_FUNCTION(CDHParams)
|
sl@0
|
348 |
|
sl@0
|
349 |
/**
|
sl@0
|
350 |
* Externalise a TDHParams object.
|
sl@0
|
351 |
*/
|
sl@0
|
352 |
void ExternalizeL(const CDHParams& aIn, RWriteStream& aOut)
|
sl@0
|
353 |
{
|
sl@0
|
354 |
aOut << aIn.N();
|
sl@0
|
355 |
aOut << aIn.G();
|
sl@0
|
356 |
}
|
sl@0
|
357 |
|
sl@0
|
358 |
/**
|
sl@0
|
359 |
* Specialise CreateL for CDHParams.
|
sl@0
|
360 |
*/
|
sl@0
|
361 |
template <>
|
sl@0
|
362 |
void CreateL(RReadStream& aIn, CDHParams*& aOut)
|
sl@0
|
363 |
{
|
sl@0
|
364 |
RInteger n;
|
sl@0
|
365 |
CreateLC(aIn, n);
|
sl@0
|
366 |
RInteger g;
|
sl@0
|
367 |
CreateLC(aIn, g);
|
sl@0
|
368 |
aOut = CDHParams::NewL(n, g);
|
sl@0
|
369 |
CleanupStack::PopAndDestroy(2, &n); // g, n
|
sl@0
|
370 |
}
|
sl@0
|
371 |
|
sl@0
|
372 |
/**
|
sl@0
|
373 |
* Implement Externalization selector for CDHPublicKey to use a function.
|
sl@0
|
374 |
*/
|
sl@0
|
375 |
EXTERNALIZE_FUNCTION(CDHPublicKey)
|
sl@0
|
376 |
|
sl@0
|
377 |
/**
|
sl@0
|
378 |
* Externalise a CDHPublicKey object.
|
sl@0
|
379 |
*/
|
sl@0
|
380 |
void ExternalizeL(const CDHPublicKey& aIn, RWriteStream& aOut)
|
sl@0
|
381 |
{
|
sl@0
|
382 |
aOut << aIn.N();
|
sl@0
|
383 |
aOut << aIn.G();
|
sl@0
|
384 |
aOut << aIn.X();
|
sl@0
|
385 |
}
|
sl@0
|
386 |
|
sl@0
|
387 |
/**
|
sl@0
|
388 |
* Specialise CreateL for CDHPublicKey.
|
sl@0
|
389 |
*/
|
sl@0
|
390 |
template <>
|
sl@0
|
391 |
void CreateL(RReadStream& aIn, CDHPublicKey*& aOut)
|
sl@0
|
392 |
{
|
sl@0
|
393 |
RInteger n;
|
sl@0
|
394 |
CreateLC(aIn, n);
|
sl@0
|
395 |
RInteger g;
|
sl@0
|
396 |
CreateLC(aIn, g);
|
sl@0
|
397 |
RInteger X;
|
sl@0
|
398 |
CreateLC(aIn, X);
|
sl@0
|
399 |
aOut = CDHPublicKey::NewL(n, g, X);
|
sl@0
|
400 |
CleanupStack::Pop(3); // X, g, n
|
sl@0
|
401 |
}
|
sl@0
|
402 |
|
sl@0
|
403 |
// Common //////////////////////////////////////////////////////////////////////
|
sl@0
|
404 |
|
sl@0
|
405 |
EXPORT_C void TokenDataMarshaller::ReadL(const TDesC8& aIn, RArray<TUid>& aOut)
|
sl@0
|
406 |
{
|
sl@0
|
407 |
::ReadL(aIn, aOut);
|
sl@0
|
408 |
}
|
sl@0
|
409 |
|
sl@0
|
410 |
EXPORT_C TInt TokenDataMarshaller::Size(const CKeyInfoBase& aIn)
|
sl@0
|
411 |
{
|
sl@0
|
412 |
return ::Size(aIn);
|
sl@0
|
413 |
}
|
sl@0
|
414 |
|
sl@0
|
415 |
EXPORT_C void TokenDataMarshaller::Write(const CKeyInfoBase& aIn, TDes8& aOut)
|
sl@0
|
416 |
{
|
sl@0
|
417 |
::Write(aIn, aOut);
|
sl@0
|
418 |
}
|
sl@0
|
419 |
|
sl@0
|
420 |
EXPORT_C TInt TokenDataMarshaller::Size(const RArray<TUid>& aIn)
|
sl@0
|
421 |
{
|
sl@0
|
422 |
return ::Size(aIn);
|
sl@0
|
423 |
}
|
sl@0
|
424 |
|
sl@0
|
425 |
EXPORT_C void TokenDataMarshaller::Write(const RArray<TUid>& aIn, TDes8& aOut)
|
sl@0
|
426 |
{
|
sl@0
|
427 |
::Write(aIn, aOut);
|
sl@0
|
428 |
}
|
sl@0
|
429 |
|
sl@0
|
430 |
EXPORT_C TInt TokenDataMarshaller::Size(const MCertInfo& aIn)
|
sl@0
|
431 |
{
|
sl@0
|
432 |
return ::Size(aIn);
|
sl@0
|
433 |
}
|
sl@0
|
434 |
|
sl@0
|
435 |
EXPORT_C void TokenDataMarshaller::Write(const MCertInfo& aIn, TDes8& aOut)
|
sl@0
|
436 |
{
|
sl@0
|
437 |
::Write(aIn, aOut);
|
sl@0
|
438 |
}
|
sl@0
|
439 |
|
sl@0
|
440 |
// Client //////////////////////////////////////////////////////////////////////
|
sl@0
|
441 |
|
sl@0
|
442 |
EXPORT_C void TokenDataMarshaller::ReadL(const TDesC8& aIn, MCTToken& aToken, MKeyInfoArray& aOut)
|
sl@0
|
443 |
{
|
sl@0
|
444 |
::CreateL(aIn, aToken, aOut);
|
sl@0
|
445 |
}
|
sl@0
|
446 |
|
sl@0
|
447 |
EXPORT_C void TokenDataMarshaller::ReadL(const TDesC8& aIn, MCTToken& aToken, CCTKeyInfo*& aOut)
|
sl@0
|
448 |
{
|
sl@0
|
449 |
::CreateL(aIn, aToken, aOut);
|
sl@0
|
450 |
}
|
sl@0
|
451 |
|
sl@0
|
452 |
EXPORT_C void TokenDataMarshaller::ReadL(const TDesC8& aIn, CDSASignature*& aOut)
|
sl@0
|
453 |
{
|
sl@0
|
454 |
::CreateL(aIn, aOut);
|
sl@0
|
455 |
}
|
sl@0
|
456 |
|
sl@0
|
457 |
EXPORT_C void TokenDataMarshaller::ReadL(const TDesC8& aIn, CRSASignature*& aOut)
|
sl@0
|
458 |
{
|
sl@0
|
459 |
::CreateL(aIn, aOut);
|
sl@0
|
460 |
}
|
sl@0
|
461 |
|
sl@0
|
462 |
EXPORT_C TInt TokenDataMarshaller::Size(const CDHParams& aIn)
|
sl@0
|
463 |
{
|
sl@0
|
464 |
return Size(aIn.N()) + Size(aIn.G());
|
sl@0
|
465 |
}
|
sl@0
|
466 |
|
sl@0
|
467 |
EXPORT_C void TokenDataMarshaller::WriteL(const CDHParams& aIn, TDes8& aOut)
|
sl@0
|
468 |
{
|
sl@0
|
469 |
::WriteL(aIn, aOut);
|
sl@0
|
470 |
}
|
sl@0
|
471 |
|
sl@0
|
472 |
EXPORT_C TInt TokenDataMarshaller::Size(const CDHPublicKey& aIn)
|
sl@0
|
473 |
{
|
sl@0
|
474 |
return Size(aIn.N()) + Size(aIn.G()) + Size(aIn.X());
|
sl@0
|
475 |
}
|
sl@0
|
476 |
|
sl@0
|
477 |
EXPORT_C void TokenDataMarshaller::WriteL(const CDHPublicKey& aIn, TDes8& aOut)
|
sl@0
|
478 |
{
|
sl@0
|
479 |
::WriteL(aIn, aOut);
|
sl@0
|
480 |
}
|
sl@0
|
481 |
|
sl@0
|
482 |
EXPORT_C void TokenDataMarshaller::ReadL(const TDesC8& aIn, RInteger& aInteger)
|
sl@0
|
483 |
{
|
sl@0
|
484 |
::CreateLC(aIn, aInteger);
|
sl@0
|
485 |
CleanupStack::Pop();
|
sl@0
|
486 |
}
|
sl@0
|
487 |
|
sl@0
|
488 |
EXPORT_C TInt TokenDataMarshaller::Size(const CPBEncryptParms& aIn)
|
sl@0
|
489 |
{
|
sl@0
|
490 |
return ::Size(aIn);
|
sl@0
|
491 |
}
|
sl@0
|
492 |
|
sl@0
|
493 |
EXPORT_C void TokenDataMarshaller::Write(const CPBEncryptParms& aIn, TDes8& aOut)
|
sl@0
|
494 |
{
|
sl@0
|
495 |
::Write(aIn, aOut);
|
sl@0
|
496 |
}
|
sl@0
|
497 |
|
sl@0
|
498 |
EXPORT_C void TokenDataMarshaller::ReadL(const TDesC8& aIn, MCTToken& aToken, RMPointerArray<CCTCertInfo>& aOut)
|
sl@0
|
499 |
{
|
sl@0
|
500 |
::CreateL(aIn, aToken, aOut);
|
sl@0
|
501 |
}
|
sl@0
|
502 |
|
sl@0
|
503 |
EXPORT_C void TokenDataMarshaller::ReadL(const TDesC8& aIn, MCTToken& aToken, CCTCertInfo*& aOut)
|
sl@0
|
504 |
{
|
sl@0
|
505 |
::CreateL(aIn, aToken, aOut);
|
sl@0
|
506 |
}
|
sl@0
|
507 |
|
sl@0
|
508 |
EXPORT_C void TokenDataMarshaller::ReadL(const TDesC8& aIn, RArray<TCertificateAppInfo>& aOut)
|
sl@0
|
509 |
{
|
sl@0
|
510 |
::ReadL(aIn, aOut);
|
sl@0
|
511 |
}
|
sl@0
|
512 |
|
sl@0
|
513 |
EXPORT_C TInt TokenDataMarshaller::Size(const CCertAttributeFilter& aIn)
|
sl@0
|
514 |
{
|
sl@0
|
515 |
return ::Size(aIn);
|
sl@0
|
516 |
}
|
sl@0
|
517 |
|
sl@0
|
518 |
EXPORT_C void TokenDataMarshaller::WriteL(const CCertAttributeFilter& aIn, TDes8& aOut)
|
sl@0
|
519 |
{
|
sl@0
|
520 |
::WriteL(aIn, aOut);
|
sl@0
|
521 |
}
|
sl@0
|
522 |
|
sl@0
|
523 |
// Server //////////////////////////////////////////////////////////////////////
|
sl@0
|
524 |
|
sl@0
|
525 |
EXPORT_C TInt TokenDataMarshaller::Size(const RPointerArray<CKeyInfo>& aIn)
|
sl@0
|
526 |
{
|
sl@0
|
527 |
return ::Size(aIn);
|
sl@0
|
528 |
}
|
sl@0
|
529 |
|
sl@0
|
530 |
EXPORT_C void TokenDataMarshaller::ReadL(const TDesC8& aIn, CPBEncryptParms*& aOut)
|
sl@0
|
531 |
{
|
sl@0
|
532 |
::CreateL(aIn, aOut);
|
sl@0
|
533 |
}
|
sl@0
|
534 |
|
sl@0
|
535 |
EXPORT_C void TokenDataMarshaller::Write(const RPointerArray<CKeyInfo>& aIn, TDes8& aOut)
|
sl@0
|
536 |
{
|
sl@0
|
537 |
::Write(aIn, aOut);
|
sl@0
|
538 |
}
|
sl@0
|
539 |
|
sl@0
|
540 |
EXPORT_C void TokenDataMarshaller::ReadL(const TDesC8& aIn, CKeyInfo*& aOut)
|
sl@0
|
541 |
{
|
sl@0
|
542 |
::CreateL(aIn, aOut);
|
sl@0
|
543 |
}
|
sl@0
|
544 |
|
sl@0
|
545 |
/**
|
sl@0
|
546 |
* Determine the size of an externalized big integer. This assumes that the
|
sl@0
|
547 |
* size of the buffer returned by TInteger::BufferLC() is the same as the size
|
sl@0
|
548 |
* of the integer as returned by TInteger::ByteCount(). This is done to avoid
|
sl@0
|
549 |
* allocating the buffer just so we can tell how big it is.
|
sl@0
|
550 |
*/
|
sl@0
|
551 |
EXPORT_C TInt TokenDataMarshaller::Size(const TInteger& aIn)
|
sl@0
|
552 |
{
|
sl@0
|
553 |
// This is an overestimate as the length is encoded with a TCardinality
|
sl@0
|
554 |
return sizeof(TInt32) + aIn.ByteCount();
|
sl@0
|
555 |
}
|
sl@0
|
556 |
|
sl@0
|
557 |
EXPORT_C TInt TokenDataMarshaller::Size(const CDSASignature& aIn)
|
sl@0
|
558 |
{
|
sl@0
|
559 |
return Size(aIn.R()) + Size(aIn.S());
|
sl@0
|
560 |
}
|
sl@0
|
561 |
|
sl@0
|
562 |
EXPORT_C void TokenDataMarshaller::WriteL(const CDSASignature& aIn, TDes8& aOut)
|
sl@0
|
563 |
{
|
sl@0
|
564 |
::WriteL(aIn, aOut);
|
sl@0
|
565 |
}
|
sl@0
|
566 |
|
sl@0
|
567 |
EXPORT_C TInt TokenDataMarshaller::Size(const CRSASignature& aIn)
|
sl@0
|
568 |
{
|
sl@0
|
569 |
return Size(aIn.S());
|
sl@0
|
570 |
}
|
sl@0
|
571 |
|
sl@0
|
572 |
EXPORT_C void TokenDataMarshaller::WriteL(const CRSASignature& aIn, TDes8& aOut)
|
sl@0
|
573 |
{
|
sl@0
|
574 |
::WriteL(aIn, aOut);
|
sl@0
|
575 |
}
|
sl@0
|
576 |
|
sl@0
|
577 |
EXPORT_C void TokenDataMarshaller::ReadL(const TDesC8& aIn, CDHParams*& aOut)
|
sl@0
|
578 |
{
|
sl@0
|
579 |
::CreateL(aIn, aOut);
|
sl@0
|
580 |
}
|
sl@0
|
581 |
|
sl@0
|
582 |
EXPORT_C void TokenDataMarshaller::ReadL(const TDesC8& aIn, CDHPublicKey*& aOut)
|
sl@0
|
583 |
{
|
sl@0
|
584 |
::CreateL(aIn, aOut);
|
sl@0
|
585 |
}
|
sl@0
|
586 |
|
sl@0
|
587 |
EXPORT_C void TokenDataMarshaller::WriteL(const TInteger& aIn, TDes8& aOut)
|
sl@0
|
588 |
{
|
sl@0
|
589 |
::WriteL(aIn, aOut);
|
sl@0
|
590 |
}
|
sl@0
|
591 |
|
sl@0
|
592 |
EXPORT_C void TokenDataMarshaller::ReadL(const TDesC8& aIn, CCertInfo*& aOut)
|
sl@0
|
593 |
{
|
sl@0
|
594 |
::CreateL(aIn, aOut);
|
sl@0
|
595 |
}
|
sl@0
|
596 |
|
sl@0
|
597 |
EXPORT_C TInt TokenDataMarshaller::Size(const RPointerArray<CCertInfo>& aIn)
|
sl@0
|
598 |
{
|
sl@0
|
599 |
return ::Size(aIn);
|
sl@0
|
600 |
}
|
sl@0
|
601 |
|
sl@0
|
602 |
EXPORT_C void TokenDataMarshaller::Write(const RPointerArray<CCertInfo>& aIn, TDes8& aOut)
|
sl@0
|
603 |
{
|
sl@0
|
604 |
::Write(aIn, aOut);
|
sl@0
|
605 |
}
|
sl@0
|
606 |
|
sl@0
|
607 |
EXPORT_C TInt TokenDataMarshaller::Size(const RArray<TCertificateAppInfo>& aIn)
|
sl@0
|
608 |
{
|
sl@0
|
609 |
return ::Size(aIn);
|
sl@0
|
610 |
}
|
sl@0
|
611 |
|
sl@0
|
612 |
EXPORT_C void TokenDataMarshaller::Write(const RArray<TCertificateAppInfo>& aIn, TDes8& aOut)
|
sl@0
|
613 |
{
|
sl@0
|
614 |
::Write(aIn, aOut);
|
sl@0
|
615 |
}
|
sl@0
|
616 |
|
sl@0
|
617 |
EXPORT_C void TokenDataMarshaller::ReadL(const TDesC8& aIn, CCertAttributeFilter*& aOut)
|
sl@0
|
618 |
{
|
sl@0
|
619 |
::CreateL(aIn, aOut);
|
sl@0
|
620 |
}
|