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 |
#ifndef __FSMARSHALLER_H__
|
sl@0
|
20 |
#define __FSMARSHALLER_H__
|
sl@0
|
21 |
|
sl@0
|
22 |
#include <e32std.h>
|
sl@0
|
23 |
#include <s32strm.h>
|
sl@0
|
24 |
#include <ct/rmpointerarray.h>
|
sl@0
|
25 |
|
sl@0
|
26 |
/**
|
sl@0
|
27 |
* @file
|
sl@0
|
28 |
* @internalComponent
|
sl@0
|
29 |
*
|
sl@0
|
30 |
* Marshalling and unmarshalling utils for the filetokens server This is used by
|
sl@0
|
31 |
* both client and server dlls.
|
sl@0
|
32 |
*/
|
sl@0
|
33 |
|
sl@0
|
34 |
class MCTToken;
|
sl@0
|
35 |
class CKeyInfoBase;
|
sl@0
|
36 |
class CCTKeyInfo;
|
sl@0
|
37 |
class CKeyInfo;
|
sl@0
|
38 |
class MKeyInfoArray;
|
sl@0
|
39 |
class CDSASignature;
|
sl@0
|
40 |
class CRSASignature;
|
sl@0
|
41 |
class CPBEncryptParms;
|
sl@0
|
42 |
struct TDHParams;
|
sl@0
|
43 |
class CDHParams;
|
sl@0
|
44 |
class CDHPublicKey;
|
sl@0
|
45 |
class TInteger;
|
sl@0
|
46 |
class RInteger;
|
sl@0
|
47 |
class MCertInfo;
|
sl@0
|
48 |
class CCTCertInfo;
|
sl@0
|
49 |
class CCertInfo;
|
sl@0
|
50 |
class TCertificateAppInfo;
|
sl@0
|
51 |
class CCertAttributeFilter;
|
sl@0
|
52 |
|
sl@0
|
53 |
/// A macro that marks a type as externalized by a global function
|
sl@0
|
54 |
#define EXTERNALIZE_FUNCTION(TYPE) \
|
sl@0
|
55 |
inline Externalize::Function Externalization(const TYPE*) \
|
sl@0
|
56 |
{ \
|
sl@0
|
57 |
return Externalize::Function(); \
|
sl@0
|
58 |
}
|
sl@0
|
59 |
|
sl@0
|
60 |
// Serialization for bigints, used in server
|
sl@0
|
61 |
|
sl@0
|
62 |
/**
|
sl@0
|
63 |
* Maximum size of integer to decode - keys are limited to 2048 bits, so nothing
|
sl@0
|
64 |
* we pass around should be bigger than this.
|
sl@0
|
65 |
*/
|
sl@0
|
66 |
const TInt KMaxIntegerSize = 256;
|
sl@0
|
67 |
|
sl@0
|
68 |
/**
|
sl@0
|
69 |
* Maximum size in bytes of serialised representations, given the limit on key
|
sl@0
|
70 |
* size.
|
sl@0
|
71 |
*/
|
sl@0
|
72 |
const TInt KMaxDSASignatureSize = 48; // Two 160 bit integers
|
sl@0
|
73 |
const TInt KMaxRSASignatureSize = 516; // One 4096 bit integer
|
sl@0
|
74 |
const TInt KMaxRSAPlaintextSize = 516; // One 4096 bit integer
|
sl@0
|
75 |
const TInt KMaxDHAgreedKeySize = 516; // One 4096 bit integer
|
sl@0
|
76 |
|
sl@0
|
77 |
// enum for handling panics
|
sl@0
|
78 |
|
sl@0
|
79 |
enum KTokenMarshallerPanics
|
sl@0
|
80 |
{
|
sl@0
|
81 |
ESerialisationPanic
|
sl@0
|
82 |
};
|
sl@0
|
83 |
|
sl@0
|
84 |
|
sl@0
|
85 |
EXTERNALIZE_FUNCTION(TInteger)
|
sl@0
|
86 |
IMPORT_C void ExternalizeL(const TInteger& aIn, RWriteStream& aOut);
|
sl@0
|
87 |
IMPORT_C void CreateLC(RReadStream& aIn, RInteger& aOut);
|
sl@0
|
88 |
|
sl@0
|
89 |
/** Marshals data over the IPC boundary between filetokens client and server. */
|
sl@0
|
90 |
class TokenDataMarshaller
|
sl@0
|
91 |
{
|
sl@0
|
92 |
// Common
|
sl@0
|
93 |
public:
|
sl@0
|
94 |
IMPORT_C static void ReadL(const TDesC8& aIn, RArray<TUid>& aOut);
|
sl@0
|
95 |
|
sl@0
|
96 |
IMPORT_C static TInt Size(const CKeyInfoBase& aIn);
|
sl@0
|
97 |
IMPORT_C static void Write(const CKeyInfoBase& aIn, TDes8& aOut);
|
sl@0
|
98 |
|
sl@0
|
99 |
IMPORT_C static TInt Size(const RArray<TUid>& aIn);
|
sl@0
|
100 |
IMPORT_C static void Write(const RArray<TUid>& aIn, TDes8& aOut);
|
sl@0
|
101 |
|
sl@0
|
102 |
IMPORT_C static TInt Size(const MCertInfo& aIn);
|
sl@0
|
103 |
IMPORT_C static void Write(const MCertInfo& aIn, TDes8& aOut);
|
sl@0
|
104 |
|
sl@0
|
105 |
// Used by client
|
sl@0
|
106 |
public:
|
sl@0
|
107 |
IMPORT_C static void ReadL(const TDesC8& aIn, MCTToken& aToken, MKeyInfoArray& aOut);
|
sl@0
|
108 |
IMPORT_C static void ReadL(const TDesC8& aIn, MCTToken& aToken, CCTKeyInfo*& aOut);
|
sl@0
|
109 |
|
sl@0
|
110 |
IMPORT_C static void ReadL(const TDesC8& aIn, CDSASignature*& aOut);
|
sl@0
|
111 |
IMPORT_C static void ReadL(const TDesC8& aIn, CRSASignature*& aOut);
|
sl@0
|
112 |
|
sl@0
|
113 |
IMPORT_C static TInt Size(const CPBEncryptParms& aIn);
|
sl@0
|
114 |
IMPORT_C static void Write(const CPBEncryptParms& aIn, TDes8& aOut);
|
sl@0
|
115 |
|
sl@0
|
116 |
IMPORT_C static TInt Size(const CDHParams& aIn);
|
sl@0
|
117 |
IMPORT_C static void WriteL(const CDHParams& aIn, TDes8& aOut);
|
sl@0
|
118 |
|
sl@0
|
119 |
IMPORT_C static TInt Size(const CDHPublicKey& aIn);
|
sl@0
|
120 |
IMPORT_C static void WriteL(const CDHPublicKey& aIn, TDes8& aOut);
|
sl@0
|
121 |
|
sl@0
|
122 |
IMPORT_C static void ReadL(const TDesC8& aIn, RInteger& aInteger);
|
sl@0
|
123 |
|
sl@0
|
124 |
IMPORT_C static void ReadL(const TDesC8& aIn, MCTToken& aToken, RMPointerArray<CCTCertInfo>& aOut);
|
sl@0
|
125 |
IMPORT_C static void ReadL(const TDesC8& aIn, MCTToken& aToken, CCTCertInfo*& aOut);
|
sl@0
|
126 |
|
sl@0
|
127 |
IMPORT_C static void ReadL(const TDesC8& aIn, RArray<TCertificateAppInfo>& aOut);
|
sl@0
|
128 |
|
sl@0
|
129 |
IMPORT_C static TInt Size(const CCertAttributeFilter& aIn);
|
sl@0
|
130 |
IMPORT_C static void WriteL(const CCertAttributeFilter& aIn, TDes8& aOut);
|
sl@0
|
131 |
|
sl@0
|
132 |
// Used by server
|
sl@0
|
133 |
public:
|
sl@0
|
134 |
IMPORT_C static void ReadL(const TDesC8& aIn, CKeyInfo*& aOut);
|
sl@0
|
135 |
|
sl@0
|
136 |
IMPORT_C static void ReadL(const TDesC8& aIn, CPBEncryptParms*& aOut);
|
sl@0
|
137 |
|
sl@0
|
138 |
IMPORT_C static TInt Size(const RPointerArray<CKeyInfo>& aIn);
|
sl@0
|
139 |
IMPORT_C static void Write(const RPointerArray<CKeyInfo>& aIn, TDes8& aOut);
|
sl@0
|
140 |
|
sl@0
|
141 |
IMPORT_C static TInt Size(const CDSASignature& aIn);
|
sl@0
|
142 |
IMPORT_C static void WriteL(const CDSASignature& aIn, TDes8& aOut);
|
sl@0
|
143 |
|
sl@0
|
144 |
IMPORT_C static TInt Size(const CRSASignature& aIn);
|
sl@0
|
145 |
IMPORT_C static void WriteL(const CRSASignature& aIn, TDes8& aOut);
|
sl@0
|
146 |
|
sl@0
|
147 |
IMPORT_C static void ReadL(const TDesC8& aIn, CDHParams*& aOut);
|
sl@0
|
148 |
IMPORT_C static void ReadL(const TDesC8& aIn, CDHPublicKey*& aOut);
|
sl@0
|
149 |
|
sl@0
|
150 |
IMPORT_C static TInt Size(const TInteger& aIn);
|
sl@0
|
151 |
IMPORT_C static void WriteL(const TInteger& aIn, TDes8& aOut);
|
sl@0
|
152 |
|
sl@0
|
153 |
IMPORT_C static void ReadL(const TDesC8& aIn, CCertInfo*& aOut);
|
sl@0
|
154 |
|
sl@0
|
155 |
IMPORT_C static TInt Size(const RPointerArray<CCertInfo>& aIn);
|
sl@0
|
156 |
IMPORT_C static void Write(const RPointerArray<CCertInfo>& aIn, TDes8& aOut);
|
sl@0
|
157 |
|
sl@0
|
158 |
IMPORT_C static TInt Size(const RArray<TCertificateAppInfo>& aIn);
|
sl@0
|
159 |
IMPORT_C static void Write(const RArray<TCertificateAppInfo>& aIn, TDes8& aOut);
|
sl@0
|
160 |
|
sl@0
|
161 |
IMPORT_C static void ReadL(const TDesC8& aIn, CCertAttributeFilter*& aOut);
|
sl@0
|
162 |
};
|
sl@0
|
163 |
|
sl@0
|
164 |
#endif
|