Import from 1.9a8 tarball
[mozilla-nss.git] / security / nss / lib / pki / symmkey.c
blob036a9bd16c753ea6c169afe91982cc37f16f9514
1 /* ***** BEGIN LICENSE BLOCK *****
2 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
4 * The contents of this file are subject to the Mozilla Public License Version
5 * 1.1 (the "License"); you may not use this file except in compliance with
6 * the License. You may obtain a copy of the License at
7 * http://www.mozilla.org/MPL/
9 * Software distributed under the License is distributed on an "AS IS" basis,
10 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
11 * for the specific language governing rights and limitations under the
12 * License.
14 * The Original Code is the Netscape security libraries.
16 * The Initial Developer of the Original Code is
17 * Netscape Communications Corporation.
18 * Portions created by the Initial Developer are Copyright (C) 1994-2000
19 * the Initial Developer. All Rights Reserved.
21 * Contributor(s):
23 * Alternatively, the contents of this file may be used under the terms of
24 * either the GNU General Public License Version 2 or later (the "GPL"), or
25 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
26 * in which case the provisions of the GPL or the LGPL are applicable instead
27 * of those above. If you wish to allow use of your version of this file only
28 * under the terms of either the GPL or the LGPL, and not to allow others to
29 * use your version of this file under the terms of the MPL, indicate your
30 * decision by deleting the provisions above and replace them with the notice
31 * and other provisions required by the GPL or the LGPL. If you do not delete
32 * the provisions above, a recipient may use your version of this file under
33 * the terms of any one of the MPL, the GPL or the LGPL.
35 * ***** END LICENSE BLOCK ***** */
37 #ifdef DEBUG
38 static const char CVS_ID[] = "@(#) $RCSfile: symmkey.c,v $ $Revision: 1.6 $ $Date: 2005/01/20 02:25:49 $";
39 #endif /* DEBUG */
41 #ifndef NSSPKI_H
42 #include "nsspki.h"
43 #endif /* NSSPKI_H */
45 extern const NSSError NSS_ERROR_NOT_FOUND;
47 NSS_IMPLEMENT PRStatus
48 NSSSymmetricKey_Destroy (
49 NSSSymmetricKey *mk
52 nss_SetError(NSS_ERROR_NOT_FOUND);
53 return PR_FAILURE;
56 NSS_IMPLEMENT PRStatus
57 NSSSymmetricKey_DeleteStoredObject (
58 NSSSymmetricKey *mk,
59 NSSCallback *uhh
62 nss_SetError(NSS_ERROR_NOT_FOUND);
63 return PR_FAILURE;
66 NSS_IMPLEMENT PRUint32
67 NSSSymmetricKey_GetKeyLength (
68 NSSSymmetricKey *mk
71 nss_SetError(NSS_ERROR_NOT_FOUND);
72 return -1;
75 NSS_IMPLEMENT PRUint32
76 NSSSymmetricKey_GetKeyStrength (
77 NSSSymmetricKey *mk
80 nss_SetError(NSS_ERROR_NOT_FOUND);
81 return -1;
84 NSS_IMPLEMENT PRStatus
85 NSSSymmetricKey_IsStillPresent (
86 NSSSymmetricKey *mk
89 nss_SetError(NSS_ERROR_NOT_FOUND);
90 return PR_FAILURE;
93 NSS_IMPLEMENT NSSTrustDomain *
94 NSSSymmetricKey_GetTrustDomain (
95 NSSSymmetricKey *mk,
96 PRStatus *statusOpt
99 nss_SetError(NSS_ERROR_NOT_FOUND);
100 return NULL;
103 NSS_IMPLEMENT NSSToken *
104 NSSSymmetricKey_GetToken (
105 NSSSymmetricKey *mk,
106 PRStatus *statusOpt
109 nss_SetError(NSS_ERROR_NOT_FOUND);
110 return NULL;
113 NSS_IMPLEMENT NSSSlot *
114 NSSSymmetricKey_GetSlot (
115 NSSSymmetricKey *mk,
116 PRStatus *statusOpt
119 nss_SetError(NSS_ERROR_NOT_FOUND);
120 return NULL;
123 NSS_IMPLEMENT NSSModule *
124 NSSSymmetricKey_GetModule (
125 NSSSymmetricKey *mk,
126 PRStatus *statusOpt
129 nss_SetError(NSS_ERROR_NOT_FOUND);
130 return NULL;
133 NSS_IMPLEMENT NSSItem *
134 NSSSymmetricKey_Encrypt (
135 NSSSymmetricKey *mk,
136 NSSAlgorithmAndParameters *apOpt,
137 NSSItem *data,
138 NSSCallback *uhh,
139 NSSItem *rvOpt,
140 NSSArena *arenaOpt
143 nss_SetError(NSS_ERROR_NOT_FOUND);
144 return NULL;
147 NSS_IMPLEMENT NSSItem *
148 NSSSymmetricKey_Decrypt (
149 NSSSymmetricKey *mk,
150 NSSAlgorithmAndParameters *apOpt,
151 NSSItem *encryptedData,
152 NSSCallback *uhh,
153 NSSItem *rvOpt,
154 NSSArena *arenaOpt
157 nss_SetError(NSS_ERROR_NOT_FOUND);
158 return NULL;
161 NSS_IMPLEMENT NSSItem *
162 NSSSymmetricKey_Sign (
163 NSSSymmetricKey *mk,
164 NSSAlgorithmAndParameters *apOpt,
165 NSSItem *data,
166 NSSCallback *uhh,
167 NSSItem *rvOpt,
168 NSSArena *arenaOpt
171 nss_SetError(NSS_ERROR_NOT_FOUND);
172 return NULL;
175 NSS_IMPLEMENT NSSItem *
176 NSSSymmetricKey_SignRecover (
177 NSSSymmetricKey *mk,
178 NSSAlgorithmAndParameters *apOpt,
179 NSSItem *data,
180 NSSCallback *uhh,
181 NSSItem *rvOpt,
182 NSSArena *arenaOpt
185 nss_SetError(NSS_ERROR_NOT_FOUND);
186 return NULL;
189 NSS_IMPLEMENT PRStatus
190 NSSSymmetricKey_Verify (
191 NSSSymmetricKey *mk,
192 NSSAlgorithmAndParameters *apOpt,
193 NSSItem *data,
194 NSSItem *signature,
195 NSSCallback *uhh
198 nss_SetError(NSS_ERROR_NOT_FOUND);
199 return PR_FAILURE;
202 NSS_IMPLEMENT NSSItem *
203 NSSSymmetricKey_VerifyRecover (
204 NSSSymmetricKey *mk,
205 NSSAlgorithmAndParameters *apOpt,
206 NSSItem *signature,
207 NSSCallback *uhh,
208 NSSItem *rvOpt,
209 NSSArena *arenaOpt
212 nss_SetError(NSS_ERROR_NOT_FOUND);
213 return NULL;
216 NSS_IMPLEMENT NSSItem *
217 NSSSymmetricKey_WrapSymmetricKey (
218 NSSSymmetricKey *wrappingKey,
219 NSSAlgorithmAndParameters *apOpt,
220 NSSSymmetricKey *keyToWrap,
221 NSSCallback *uhh,
222 NSSItem *rvOpt,
223 NSSArena *arenaOpt
226 nss_SetError(NSS_ERROR_NOT_FOUND);
227 return NULL;
230 NSS_IMPLEMENT NSSItem *
231 NSSSymmetricKey_WrapPrivateKey (
232 NSSSymmetricKey *wrappingKey,
233 NSSAlgorithmAndParameters *apOpt,
234 NSSPrivateKey *keyToWrap,
235 NSSCallback *uhh,
236 NSSItem *rvOpt,
237 NSSArena *arenaOpt
240 nss_SetError(NSS_ERROR_NOT_FOUND);
241 return NULL;
244 NSS_IMPLEMENT NSSSymmetricKey *
245 NSSSymmetricKey_UnwrapSymmetricKey (
246 NSSSymmetricKey *wrappingKey,
247 NSSAlgorithmAndParameters *apOpt,
248 NSSItem *wrappedKey,
249 NSSOID *target,
250 PRUint32 keySizeOpt,
251 NSSOperations operations,
252 NSSCallback *uhh
255 nss_SetError(NSS_ERROR_NOT_FOUND);
256 return NULL;
259 NSS_IMPLEMENT NSSPrivateKey *
260 NSSSymmetricKey_UnwrapPrivateKey (
261 NSSSymmetricKey *wrappingKey,
262 NSSAlgorithmAndParameters *apOpt,
263 NSSItem *wrappedKey,
264 NSSUTF8 *labelOpt,
265 NSSItem *keyIDOpt,
266 PRBool persistant,
267 PRBool sensitive,
268 NSSToken *destinationOpt,
269 NSSCallback *uhh
272 nss_SetError(NSS_ERROR_NOT_FOUND);
273 return NULL;
276 NSS_IMPLEMENT NSSSymmetricKey *
277 NSSSymmetricKey_DeriveSymmetricKey (
278 NSSSymmetricKey *originalKey,
279 NSSAlgorithmAndParameters *apOpt,
280 NSSOID *target,
281 PRUint32 keySizeOpt,
282 NSSOperations operations,
283 NSSCallback *uhh
286 nss_SetError(NSS_ERROR_NOT_FOUND);
287 return NULL;
290 NSS_IMPLEMENT NSSCryptoContext *
291 NSSSymmetricKey_CreateCryptoContext (
292 NSSSymmetricKey *mk,
293 NSSAlgorithmAndParameters *apOpt,
294 NSSCallback *uhh
297 nss_SetError(NSS_ERROR_NOT_FOUND);
298 return NULL;