|
1 /* |
|
2 * Copyright (c) 2006-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 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". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include "paddingshim.h" |
|
20 #include <cryptospi/cryptospidef.h> |
|
21 |
|
22 // CPaddingNoneShim |
|
23 CPaddingNoneShim* CPaddingNoneShim::NewL(TInt aBlockBytes) |
|
24 { |
|
25 CPaddingNoneShim* self = CPaddingNoneShim::NewLC(aBlockBytes); |
|
26 CleanupStack::Pop(self); |
|
27 return self; |
|
28 } |
|
29 CPaddingNoneShim* CPaddingNoneShim::NewLC(TInt aBlockBytes) |
|
30 { |
|
31 CPaddingNoneShim* self = new(ELeave) CPaddingNoneShim(aBlockBytes); |
|
32 CleanupStack::PushL(self); |
|
33 return self; |
|
34 } |
|
35 |
|
36 TInt CPaddingNoneShim::Extension_(TUint aExtensionId, TAny*& a0, TAny* /*a1*/) |
|
37 { |
|
38 TInt err(KErrNone); |
|
39 if (aExtensionId == CryptoSpi::KPaddingInterface) |
|
40 { |
|
41 TUid* uid(static_cast<TUid*>(a0)); |
|
42 *uid = CryptoSpi::KPaddingModeNoneUid; |
|
43 } |
|
44 else |
|
45 { |
|
46 err = KErrExtensionNotSupported; |
|
47 } |
|
48 return err; |
|
49 } |
|
50 |
|
51 CPaddingNoneShim::CPaddingNoneShim(TInt aBlockBytes) : |
|
52 CPaddingNone(aBlockBytes) |
|
53 { |
|
54 } |
|
55 |
|
56 // CPaddingPKCS1SignatureShim |
|
57 CPaddingPKCS1SignatureShim* CPaddingPKCS1SignatureShim::NewL(TInt aBlockBytes) |
|
58 { |
|
59 CPaddingPKCS1SignatureShim* self = CPaddingPKCS1SignatureShim::NewLC(aBlockBytes); |
|
60 CleanupStack::Pop(self); |
|
61 return self; |
|
62 } |
|
63 CPaddingPKCS1SignatureShim* CPaddingPKCS1SignatureShim::NewLC(TInt aBlockBytes) |
|
64 { |
|
65 CPaddingPKCS1SignatureShim* self = new(ELeave) CPaddingPKCS1SignatureShim(aBlockBytes); |
|
66 CleanupStack::PushL(self); |
|
67 return self; |
|
68 } |
|
69 |
|
70 TInt CPaddingPKCS1SignatureShim::Extension_(TUint aExtensionId, TAny*& a0, TAny* /*a1*/) |
|
71 { |
|
72 TInt err(KErrNone); |
|
73 if (aExtensionId == CryptoSpi::KPaddingInterface) |
|
74 { |
|
75 TUid* uid(static_cast<TUid*>(a0)); |
|
76 *uid = CryptoSpi::KPaddingModePkcs1_v1_5_SignatureUid; |
|
77 } |
|
78 else |
|
79 { |
|
80 err = KErrExtensionNotSupported; |
|
81 } |
|
82 return err; |
|
83 } |
|
84 |
|
85 CPaddingPKCS1SignatureShim::CPaddingPKCS1SignatureShim(TInt aBlockBytes) : |
|
86 CPaddingPKCS1Signature(aBlockBytes) |
|
87 { |
|
88 } |
|
89 |
|
90 // CPaddingPKCS1EncryptionShim |
|
91 CPaddingPKCS1EncryptionShim* CPaddingPKCS1EncryptionShim::NewL(TInt aBlockBytes) |
|
92 { |
|
93 CPaddingPKCS1EncryptionShim* self = CPaddingPKCS1EncryptionShim::NewLC(aBlockBytes); |
|
94 CleanupStack::Pop(self); |
|
95 return self; |
|
96 } |
|
97 CPaddingPKCS1EncryptionShim* CPaddingPKCS1EncryptionShim::NewLC(TInt aBlockBytes) |
|
98 { |
|
99 CPaddingPKCS1EncryptionShim* self = new(ELeave) CPaddingPKCS1EncryptionShim(aBlockBytes); |
|
100 CleanupStack::PushL(self); |
|
101 return self; |
|
102 } |
|
103 |
|
104 TInt CPaddingPKCS1EncryptionShim::Extension_(TUint aExtensionId, TAny*& a0, TAny* /*a1*/) |
|
105 { |
|
106 TInt err(KErrNone); |
|
107 if (aExtensionId == CryptoSpi::KPaddingInterface) |
|
108 { |
|
109 TUid* uid(static_cast<TUid*>(a0)); |
|
110 *uid = CryptoSpi::KPaddingModePkcs1_v1_5_EncryptionUid; |
|
111 } |
|
112 else |
|
113 { |
|
114 err = KErrExtensionNotSupported; |
|
115 } |
|
116 return err; |
|
117 } |
|
118 |
|
119 CPaddingPKCS1EncryptionShim::CPaddingPKCS1EncryptionShim(TInt aBlockBytes) : |
|
120 CPaddingPKCS1Encryption(aBlockBytes) |
|
121 { |
|
122 } |
|
123 |
|
124 // CPaddingSSLv3Shim |
|
125 CPaddingSSLv3Shim* CPaddingSSLv3Shim::NewL(TInt aBlockBytes) |
|
126 { |
|
127 CPaddingSSLv3Shim* self = CPaddingSSLv3Shim::NewLC(aBlockBytes); |
|
128 CleanupStack::Pop(self); |
|
129 return self; |
|
130 } |
|
131 CPaddingSSLv3Shim* CPaddingSSLv3Shim::NewLC(TInt aBlockBytes) |
|
132 { |
|
133 CPaddingSSLv3Shim* self = new(ELeave) CPaddingSSLv3Shim(aBlockBytes); |
|
134 CleanupStack::PushL(self); |
|
135 return self; |
|
136 } |
|
137 |
|
138 TInt CPaddingSSLv3Shim::Extension_(TUint aExtensionId, TAny*& a0, TAny* /*a1*/) |
|
139 { |
|
140 TInt err(KErrNone); |
|
141 if (aExtensionId == CryptoSpi::KPaddingInterface) |
|
142 { |
|
143 TUid* uid(static_cast<TUid*>(a0)); |
|
144 *uid = CryptoSpi::KPaddingModeSSLv3Uid; |
|
145 } |
|
146 else |
|
147 { |
|
148 err = KErrExtensionNotSupported; |
|
149 } |
|
150 return err; |
|
151 } |
|
152 |
|
153 CPaddingSSLv3Shim::CPaddingSSLv3Shim(TInt aBlockBytes) : |
|
154 CPaddingSSLv3(aBlockBytes) |
|
155 { |
|
156 } |
|
157 |
|
158 // CPaddingPKCS7Shim |
|
159 CPaddingPKCS7Shim* CPaddingPKCS7Shim::NewL(TInt aBlockBytes) |
|
160 { |
|
161 CPaddingPKCS7Shim* self = CPaddingPKCS7Shim::NewLC(aBlockBytes); |
|
162 CleanupStack::Pop(self); |
|
163 return self; |
|
164 } |
|
165 CPaddingPKCS7Shim* CPaddingPKCS7Shim::NewLC(TInt aBlockBytes) |
|
166 { |
|
167 CPaddingPKCS7Shim* self = new(ELeave) CPaddingPKCS7Shim(aBlockBytes); |
|
168 CleanupStack::PushL(self); |
|
169 return self; |
|
170 } |
|
171 |
|
172 TInt CPaddingPKCS7Shim::Extension_(TUint aExtensionId, TAny*& a0, TAny* /*a1*/) |
|
173 { |
|
174 TInt err(KErrNone); |
|
175 if (aExtensionId == CryptoSpi::KPaddingInterface) |
|
176 { |
|
177 TUid* uid(static_cast<TUid*>(a0)); |
|
178 *uid = CryptoSpi::KPaddingModePKCS7Uid; |
|
179 } |
|
180 else |
|
181 { |
|
182 err = KErrExtensionNotSupported; |
|
183 } |
|
184 return err; |
|
185 } |
|
186 |
|
187 CPaddingPKCS7Shim::CPaddingPKCS7Shim(TInt aBlockBytes) : |
|
188 CPaddingPKCS7(aBlockBytes) |
|
189 { |
|
190 } |