~ubuntu-branches/ubuntu/precise/kompozer/precise

« back to all changes in this revision

Viewing changes to mozilla/security/nss/lib/dev/dev.h

  • Committer: Bazaar Package Importer
  • Author(s): Anthony Yarusso
  • Date: 2007-08-27 01:11:03 UTC
  • Revision ID: james.westby@ubuntu.com-20070827011103-2jgf4s6532gqu2ka
Tags: upstream-0.7.10
ImportĀ upstreamĀ versionĀ 0.7.10

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* 
 
2
 * The contents of this file are subject to the Mozilla Public
 
3
 * License Version 1.1 (the "License"); you may not use this file
 
4
 * except in compliance with the License. You may obtain a copy of
 
5
 * the License at http://www.mozilla.org/MPL/
 
6
 * 
 
7
 * Software distributed under the License is distributed on an "AS
 
8
 * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
 
9
 * implied. See the License for the specific language governing
 
10
 * rights and limitations under the License.
 
11
 * 
 
12
 * The Original Code is the Netscape security libraries.
 
13
 * 
 
14
 * The Initial Developer of the Original Code is Netscape
 
15
 * Communications Corporation.  Portions created by Netscape are 
 
16
 * Copyright (C) 1994-2000 Netscape Communications Corporation.  All
 
17
 * Rights Reserved.
 
18
 * 
 
19
 * Contributor(s):
 
20
 * 
 
21
 * Alternatively, the contents of this file may be used under the
 
22
 * terms of the GNU General Public License Version 2 or later (the
 
23
 * "GPL"), in which case the provisions of the GPL are applicable 
 
24
 * instead of those above.  If you wish to allow use of your 
 
25
 * version of this file only under the terms of the GPL and not to
 
26
 * allow others to use your version of this file under the MPL,
 
27
 * indicate your decision by deleting the provisions above and
 
28
 * replace them with the notice and other provisions required by
 
29
 * the GPL.  If you do not delete the provisions above, a recipient
 
30
 * may use your version of this file under either the MPL or the
 
31
 * GPL.
 
32
 */
 
33
 
 
34
#ifndef DEV_H
 
35
#define DEV_H
 
36
 
 
37
/*
 
38
 * dev.h
 
39
 *
 
40
 * Low-level methods for interaction with cryptoki devices
 
41
 */
 
42
 
 
43
#ifdef DEBUG
 
44
static const char DEV_CVS_ID[] = "@(#) $RCSfile: dev.h,v $ $Revision: 1.33 $ $Date: 2003/04/19 00:03:13 $ $Name: FIREFOX_1_0_RELEASE $";
 
45
#endif /* DEBUG */
 
46
 
 
47
#ifndef NSSCKT_H
 
48
#include "nssckt.h"
 
49
#endif /* NSSCKT_H */
 
50
 
 
51
#ifndef NSSDEV_H
 
52
#include "nssdev.h"
 
53
#endif /* NSSDEV_H */
 
54
 
 
55
#ifndef DEVT_H
 
56
#include "devt.h"
 
57
#endif /* DEVT_H */
 
58
 
 
59
PR_BEGIN_EXTERN_C
 
60
 
 
61
/* the global module list
 
62
 *
 
63
 * These functions are for managing the global set of modules.  Trust Domains,
 
64
 * etc., will draw from this set.  These functions are completely internal
 
65
 * and only invoked when there are changes to the global module state
 
66
 * (load or unload).
 
67
 *
 
68
 * nss_InitializeGlobalModuleList
 
69
 * nss_DestroyGlobalModuleList
 
70
 * nss_GetLoadedModules
 
71
 *
 
72
 * nssGlobalModuleList_Add
 
73
 * nssGlobalModuleList_Remove
 
74
 * nssGlobalModuleList_FindModuleByName
 
75
 * nssGlobalModuleList_FindSlotByName
 
76
 * nssGlobalModuleList_FindTokenByName
 
77
 */
 
78
 
 
79
NSS_EXTERN PRStatus
 
80
nss_InitializeGlobalModuleList
 
81
(
 
82
  void
 
83
);
 
84
 
 
85
NSS_EXTERN PRStatus
 
86
nss_DestroyGlobalModuleList
 
87
(
 
88
  void
 
89
);
 
90
 
 
91
NSS_EXTERN NSSModule **
 
92
nss_GetLoadedModules
 
93
(
 
94
  void
 
95
);
 
96
 
 
97
NSS_EXTERN PRStatus
 
98
nssGlobalModuleList_Add
 
99
(
 
100
  NSSModule *module
 
101
);
 
102
 
 
103
NSS_EXTERN PRStatus
 
104
nssGlobalModuleList_Remove
 
105
(
 
106
  NSSModule *module
 
107
);
 
108
 
 
109
NSS_EXTERN NSSModule *
 
110
nssGlobalModuleList_FindModuleByName
 
111
(
 
112
  NSSUTF8 *moduleName
 
113
);
 
114
 
 
115
NSS_EXTERN NSSSlot *
 
116
nssGlobalModuleList_FindSlotByName
 
117
(
 
118
  NSSUTF8 *slotName
 
119
);
 
120
 
 
121
NSS_EXTERN NSSToken *
 
122
nssGlobalModuleList_FindTokenByName
 
123
(
 
124
  NSSUTF8 *tokenName
 
125
);
 
126
 
 
127
NSS_EXTERN NSSToken *
 
128
nss_GetDefaultCryptoToken
 
129
(
 
130
  void
 
131
);
 
132
 
 
133
NSS_EXTERN NSSToken *
 
134
nss_GetDefaultDatabaseToken
 
135
(
 
136
  void
 
137
);
 
138
 
 
139
/*
 
140
 *  |-----------|<---> NSSSlot <--> NSSToken
 
141
 *  | NSSModule |<---> NSSSlot <--> NSSToken
 
142
 *  |-----------|<---> NSSSlot <--> NSSToken
 
143
 */
 
144
 
 
145
/* NSSModule
 
146
 *
 
147
 * nssModule_Create
 
148
 * nssModule_CreateFromSpec
 
149
 * nssModule_AddRef
 
150
 * nssModule_GetName
 
151
 * nssModule_GetSlots
 
152
 * nssModule_FindSlotByName
 
153
 * nssModule_FindTokenByName
 
154
 * nssModule_GetCertOrder
 
155
 */
 
156
 
 
157
NSS_EXTERN NSSModule *
 
158
nssModule_Create
 
159
(
 
160
  NSSUTF8 *moduleOpt,
 
161
  NSSUTF8 *uriOpt,
 
162
  NSSUTF8 *opaqueOpt,
 
163
  void    *reserved
 
164
);
 
165
 
 
166
/* This is to use the new loading mechanism. */
 
167
NSS_EXTERN NSSModule *
 
168
nssModule_CreateFromSpec
 
169
(
 
170
  NSSUTF8 *moduleSpec,
 
171
  NSSModule *parent,
 
172
  PRBool loadSubModules
 
173
);
 
174
 
 
175
NSS_EXTERN PRStatus
 
176
nssModule_Destroy
 
177
(
 
178
  NSSModule *mod
 
179
);
 
180
 
 
181
NSS_EXTERN NSSModule *
 
182
nssModule_AddRef
 
183
(
 
184
  NSSModule *mod
 
185
);
 
186
 
 
187
NSS_EXTERN NSSUTF8 *
 
188
nssModule_GetName
 
189
(
 
190
  NSSModule *mod
 
191
);
 
192
 
 
193
NSS_EXTERN NSSSlot **
 
194
nssModule_GetSlots
 
195
(
 
196
  NSSModule *mod
 
197
);
 
198
 
 
199
NSS_EXTERN NSSSlot *
 
200
nssModule_FindSlotByName
 
201
(
 
202
  NSSModule *mod,
 
203
  NSSUTF8 *slotName
 
204
);
 
205
 
 
206
NSS_EXTERN NSSToken *
 
207
nssModule_FindTokenByName
 
208
(
 
209
  NSSModule *mod,
 
210
  NSSUTF8 *tokenName
 
211
);
 
212
 
 
213
NSS_EXTERN PRInt32
 
214
nssModule_GetCertOrder
 
215
(
 
216
  NSSModule *module
 
217
);
 
218
 
 
219
/* NSSSlot
 
220
 *
 
221
 * nssSlot_Destroy
 
222
 * nssSlot_AddRef
 
223
 * nssSlot_GetName
 
224
 * nssSlot_GetTokenName
 
225
 * nssSlot_IsTokenPresent
 
226
 * nssSlot_IsPermanent
 
227
 * nssSlot_IsFriendly
 
228
 * nssSlot_IsHardware
 
229
 * nssSlot_Refresh
 
230
 * nssSlot_GetModule
 
231
 * nssSlot_GetToken
 
232
 * nssSlot_Login
 
233
 * nssSlot_Logout
 
234
 * nssSlot_SetPassword
 
235
 * nssSlot_CreateSession
 
236
 */
 
237
 
 
238
NSS_EXTERN PRStatus
 
239
nssSlot_Destroy
 
240
(
 
241
  NSSSlot *slot
 
242
);
 
243
 
 
244
NSS_EXTERN NSSSlot *
 
245
nssSlot_AddRef
 
246
(
 
247
  NSSSlot *slot
 
248
);
 
249
 
 
250
NSS_EXTERN NSSUTF8 *
 
251
nssSlot_GetName
 
252
(
 
253
  NSSSlot *slot
 
254
);
 
255
 
 
256
NSS_EXTERN NSSUTF8 *
 
257
nssSlot_GetTokenName
 
258
(
 
259
  NSSSlot *slot
 
260
);
 
261
 
 
262
NSS_EXTERN NSSModule *
 
263
nssSlot_GetModule
 
264
(
 
265
  NSSSlot *slot
 
266
);
 
267
 
 
268
NSS_EXTERN NSSToken *
 
269
nssSlot_GetToken
 
270
(
 
271
  NSSSlot *slot
 
272
);
 
273
 
 
274
NSS_EXTERN PRBool
 
275
nssSlot_IsTokenPresent
 
276
(
 
277
  NSSSlot *slot
 
278
);
 
279
 
 
280
NSS_EXTERN PRBool
 
281
nssSlot_IsPermanent
 
282
(
 
283
  NSSSlot *slot
 
284
);
 
285
 
 
286
NSS_EXTERN PRBool
 
287
nssSlot_IsFriendly
 
288
(
 
289
  NSSSlot *slot
 
290
);
 
291
 
 
292
NSS_EXTERN PRBool
 
293
nssSlot_IsHardware
 
294
(
 
295
  NSSSlot *slot
 
296
);
 
297
 
 
298
NSS_EXTERN PRBool
 
299
nssSlot_IsLoggedIn
 
300
(
 
301
  NSSSlot *slot
 
302
);
 
303
 
 
304
NSS_EXTERN PRStatus
 
305
nssSlot_Refresh
 
306
(
 
307
  NSSSlot *slot
 
308
);
 
309
 
 
310
NSS_EXTERN PRStatus
 
311
nssSlot_Login
 
312
(
 
313
  NSSSlot *slot,
 
314
  NSSCallback *pwcb
 
315
);
 
316
extern const NSSError NSS_ERROR_INVALID_PASSWORD;
 
317
extern const NSSError NSS_ERROR_USER_CANCELED;
 
318
 
 
319
NSS_EXTERN PRStatus
 
320
nssSlot_Logout
 
321
(
 
322
  NSSSlot *slot,
 
323
  nssSession *sessionOpt
 
324
);
 
325
 
 
326
NSS_EXTERN void
 
327
nssSlot_EnterMonitor
 
328
(
 
329
  NSSSlot *slot
 
330
);
 
331
 
 
332
NSS_EXTERN void
 
333
nssSlot_ExitMonitor
 
334
(
 
335
  NSSSlot *slot
 
336
);
 
337
 
 
338
#define NSSSLOT_ASK_PASSWORD_FIRST_TIME -1
 
339
#define NSSSLOT_ASK_PASSWORD_EVERY_TIME  0
 
340
NSS_EXTERN void
 
341
nssSlot_SetPasswordDefaults
 
342
(
 
343
  NSSSlot *slot,
 
344
  PRInt32 askPasswordTimeout
 
345
);
 
346
 
 
347
NSS_EXTERN PRStatus
 
348
nssSlot_SetPassword
 
349
(
 
350
  NSSSlot *slot,
 
351
  NSSUTF8 *oldPasswordOpt,
 
352
  NSSUTF8 *newPassword
 
353
);
 
354
extern const NSSError NSS_ERROR_INVALID_PASSWORD;
 
355
extern const NSSError NSS_ERROR_USER_CANCELED;
 
356
 
 
357
/*
 
358
 * nssSlot_IsLoggedIn
 
359
 */
 
360
 
 
361
NSS_EXTERN nssSession *
 
362
nssSlot_CreateSession
 
363
(
 
364
  NSSSlot *slot,
 
365
  NSSArena *arenaOpt,
 
366
  PRBool readWrite /* so far, this is the only flag used */
 
367
);
 
368
 
 
369
/* NSSToken
 
370
 *
 
371
 * nssToken_Destroy
 
372
 * nssToken_AddRef
 
373
 * nssToken_GetName
 
374
 * nssToken_GetModule
 
375
 * nssToken_GetSlot
 
376
 * nssToken_NeedsPINInitialization
 
377
 * nssToken_ImportCertificate
 
378
 * nssToken_ImportTrust
 
379
 * nssToken_ImportCRL
 
380
 * nssToken_GenerateKeyPair
 
381
 * nssToken_GenerateSymmetricKey
 
382
 * nssToken_DeleteStoredObject
 
383
 * nssToken_FindCertificates
 
384
 * nssToken_FindCertificatesBySubject
 
385
 * nssToken_FindCertificatesByNickname
 
386
 * nssToken_FindCertificatesByEmail
 
387
 * nssToken_FindCertificateByIssuerAndSerialNumber
 
388
 * nssToken_FindCertificateByEncodedCertificate
 
389
 * nssToken_FindTrustObjects
 
390
 * nssToken_FindTrustForCertificate
 
391
 * nssToken_FindCRLs
 
392
 * nssToken_FindCRLsBySubject
 
393
 * nssToken_FindPrivateKeys
 
394
 * nssToken_FindPrivateKeyByID
 
395
 * nssToken_Digest
 
396
 * nssToken_BeginDigest
 
397
 * nssToken_ContinueDigest
 
398
 * nssToken_FinishDigest
 
399
 */
 
400
 
 
401
NSS_EXTERN PRStatus
 
402
nssToken_Destroy
 
403
(
 
404
  NSSToken *tok
 
405
);
 
406
 
 
407
NSS_EXTERN NSSToken *
 
408
nssToken_AddRef
 
409
(
 
410
  NSSToken *tok
 
411
);
 
412
 
 
413
NSS_EXTERN NSSUTF8 *
 
414
nssToken_GetName
 
415
(
 
416
  NSSToken *tok
 
417
);
 
418
 
 
419
NSS_EXTERN NSSModule *
 
420
nssToken_GetModule
 
421
(
 
422
  NSSToken *token
 
423
);
 
424
 
 
425
NSS_EXTERN NSSSlot *
 
426
nssToken_GetSlot
 
427
(
 
428
  NSSToken *tok
 
429
);
 
430
 
 
431
NSS_EXTERN PRBool
 
432
nssToken_NeedsPINInitialization
 
433
(
 
434
  NSSToken *token
 
435
);
 
436
 
 
437
NSS_EXTERN nssCryptokiObject *
 
438
nssToken_ImportCertificate
 
439
(
 
440
  NSSToken *tok,
 
441
  nssSession *sessionOpt,
 
442
  NSSCertificateType certType,
 
443
  NSSItem *id,
 
444
  NSSUTF8 *nickname,
 
445
  NSSDER *encoding,
 
446
  NSSDER *issuer,
 
447
  NSSDER *subject,
 
448
  NSSDER *serial,
 
449
  NSSASCII7 *emailAddr,
 
450
  PRBool asTokenObject
 
451
);
 
452
 
 
453
NSS_EXTERN nssCryptokiObject *
 
454
nssToken_ImportTrust
 
455
(
 
456
  NSSToken *tok,
 
457
  nssSession *sessionOpt,
 
458
  NSSDER *certEncoding,
 
459
  NSSDER *certIssuer,
 
460
  NSSDER *certSerial,
 
461
  nssTrustLevel serverAuth,
 
462
  nssTrustLevel clientAuth,
 
463
  nssTrustLevel codeSigning,
 
464
  nssTrustLevel emailProtection,
 
465
  PRBool asTokenObject
 
466
);
 
467
 
 
468
NSS_EXTERN nssCryptokiObject *
 
469
nssToken_ImportCRL
 
470
(
 
471
  NSSToken *token,
 
472
  nssSession *sessionOpt,
 
473
  NSSDER *subject,
 
474
  NSSDER *encoding,
 
475
  PRBool isKRL,
 
476
  NSSUTF8 *url,
 
477
  PRBool asTokenObject
 
478
);
 
479
 
 
480
/* Permanently remove an object from the token. */
 
481
NSS_EXTERN PRStatus
 
482
nssToken_DeleteStoredObject
 
483
(
 
484
  nssCryptokiObject *instance
 
485
);
 
486
 
 
487
NSS_EXTERN nssCryptokiObject **
 
488
nssToken_FindCertificates
 
489
(
 
490
  NSSToken *token,
 
491
  nssSession *sessionOpt,
 
492
  nssTokenSearchType searchType,
 
493
  PRUint32 maximumOpt,
 
494
  PRStatus *statusOpt
 
495
);
 
496
 
 
497
NSS_EXTERN nssCryptokiObject **
 
498
nssToken_FindCertificatesBySubject
 
499
(
 
500
  NSSToken *token,
 
501
  nssSession *sessionOpt,
 
502
  NSSDER *subject,
 
503
  nssTokenSearchType searchType,
 
504
  PRUint32 maximumOpt,
 
505
  PRStatus *statusOpt
 
506
);
 
507
 
 
508
NSS_EXTERN nssCryptokiObject **
 
509
nssToken_FindCertificatesByNickname
 
510
(
 
511
  NSSToken *token,
 
512
  nssSession *sessionOpt,
 
513
  NSSUTF8 *name,
 
514
  nssTokenSearchType searchType,
 
515
  PRUint32 maximumOpt,
 
516
  PRStatus *statusOpt
 
517
);
 
518
 
 
519
NSS_EXTERN nssCryptokiObject **
 
520
nssToken_FindCertificatesByEmail
 
521
(
 
522
  NSSToken *token,
 
523
  nssSession *sessionOpt,
 
524
  NSSASCII7 *email,
 
525
  nssTokenSearchType searchType,
 
526
  PRUint32 maximumOpt,
 
527
  PRStatus *statusOpt
 
528
);
 
529
 
 
530
NSS_EXTERN nssCryptokiObject **
 
531
nssToken_FindCertificatesByID
 
532
(
 
533
  NSSToken *token,
 
534
  nssSession *sessionOpt,
 
535
  NSSItem *id,
 
536
  nssTokenSearchType searchType,
 
537
  PRUint32 maximumOpt,
 
538
  PRStatus *statusOpt
 
539
);
 
540
 
 
541
NSS_EXTERN nssCryptokiObject *
 
542
nssToken_FindCertificateByIssuerAndSerialNumber
 
543
(
 
544
  NSSToken *token,
 
545
  nssSession *sessionOpt,
 
546
  NSSDER *issuer,
 
547
  NSSDER *serial,
 
548
  nssTokenSearchType searchType,
 
549
  PRStatus *statusOpt
 
550
);
 
551
 
 
552
NSS_EXTERN nssCryptokiObject *
 
553
nssToken_FindCertificateByEncodedCertificate
 
554
(
 
555
  NSSToken *token,
 
556
  nssSession *sessionOpt,
 
557
  NSSBER *encodedCertificate,
 
558
  nssTokenSearchType searchType,
 
559
  PRStatus *statusOpt
 
560
);
 
561
 
 
562
NSS_EXTERN nssCryptokiObject **
 
563
nssToken_FindTrustObjects
 
564
(
 
565
  NSSToken *token,
 
566
  nssSession *sessionOpt,
 
567
  nssTokenSearchType searchType,
 
568
  PRUint32 maximumOpt,
 
569
  PRStatus *statusOpt
 
570
);
 
571
 
 
572
NSS_EXTERN nssCryptokiObject *
 
573
nssToken_FindTrustForCertificate
 
574
(
 
575
  NSSToken *token,
 
576
  nssSession *sessionOpt,
 
577
  NSSDER *certEncoding,
 
578
  NSSDER *certIssuer,
 
579
  NSSDER *certSerial,
 
580
  nssTokenSearchType searchType
 
581
);
 
582
 
 
583
NSS_EXTERN nssCryptokiObject **
 
584
nssToken_FindCRLs
 
585
(
 
586
  NSSToken *token,
 
587
  nssSession *sessionOpt,
 
588
  nssTokenSearchType searchType,
 
589
  PRUint32 maximumOpt,
 
590
  PRStatus *statusOpt
 
591
);
 
592
 
 
593
NSS_EXTERN nssCryptokiObject **
 
594
nssToken_FindCRLsBySubject
 
595
(
 
596
  NSSToken *token,
 
597
  nssSession *sessionOpt,
 
598
  NSSDER *subject,
 
599
  nssTokenSearchType searchType,
 
600
  PRUint32 maximumOpt,
 
601
  PRStatus *statusOpt
 
602
);
 
603
 
 
604
NSS_EXTERN nssCryptokiObject **
 
605
nssToken_FindPrivateKeys
 
606
(
 
607
  NSSToken *token,
 
608
  nssSession *sessionOpt,
 
609
  nssTokenSearchType searchType,
 
610
  PRUint32 maximumOpt,
 
611
  PRStatus *statusOpt
 
612
);
 
613
 
 
614
NSS_EXTERN nssCryptokiObject *
 
615
nssToken_FindPrivateKeyByID
 
616
(
 
617
  NSSToken *token,
 
618
  nssSession *sessionOpt,
 
619
  NSSItem *keyID
 
620
);
 
621
 
 
622
NSS_EXTERN nssCryptokiObject *
 
623
nssToken_FindPublicKeyByID
 
624
(
 
625
  NSSToken *token,
 
626
  nssSession *sessionOpt,
 
627
  NSSItem *keyID
 
628
);
 
629
 
 
630
NSS_EXTERN NSSItem *
 
631
nssToken_Digest
 
632
(
 
633
  NSSToken *tok,
 
634
  nssSession *sessionOpt,
 
635
  NSSAlgorithmAndParameters *ap,
 
636
  NSSItem *data,
 
637
  NSSItem *rvOpt,
 
638
  NSSArena *arenaOpt
 
639
);
 
640
 
 
641
NSS_EXTERN PRStatus
 
642
nssToken_BeginDigest
 
643
(
 
644
  NSSToken *tok,
 
645
  nssSession *sessionOpt,
 
646
  NSSAlgorithmAndParameters *ap
 
647
);
 
648
 
 
649
NSS_EXTERN PRStatus
 
650
nssToken_ContinueDigest
 
651
(
 
652
  NSSToken *tok,
 
653
  nssSession *sessionOpt,
 
654
  NSSItem *item
 
655
);
 
656
 
 
657
NSS_EXTERN NSSItem *
 
658
nssToken_FinishDigest
 
659
(
 
660
  NSSToken *tok,
 
661
  nssSession *sessionOpt,
 
662
  NSSItem *rvOpt,
 
663
  NSSArena *arenaOpt
 
664
);
 
665
 
 
666
/* nssSession
 
667
 *
 
668
 * nssSession_Destroy
 
669
 * nssSession_EnterMonitor
 
670
 * nssSession_ExitMonitor
 
671
 * nssSession_IsReadWrite
 
672
 */
 
673
 
 
674
NSS_EXTERN PRStatus
 
675
nssSession_Destroy
 
676
(
 
677
  nssSession *s
 
678
);
 
679
 
 
680
/* would like to inline */
 
681
NSS_EXTERN PRStatus
 
682
nssSession_EnterMonitor
 
683
(
 
684
  nssSession *s
 
685
);
 
686
 
 
687
/* would like to inline */
 
688
NSS_EXTERN PRStatus
 
689
nssSession_ExitMonitor
 
690
(
 
691
  nssSession *s
 
692
);
 
693
 
 
694
/* would like to inline */
 
695
NSS_EXTERN PRBool
 
696
nssSession_IsReadWrite
 
697
(
 
698
  nssSession *s
 
699
);
 
700
 
 
701
/* nssCryptokiObject
 
702
 *
 
703
 * An object living on a cryptoki token.
 
704
 * Not really proper to mix up the object types just because 
 
705
 * nssCryptokiObject itself is generic, but doing so anyway.
 
706
 *
 
707
 * nssCryptokiObject_Destroy
 
708
 * nssCryptokiObject_Equal
 
709
 * nssCryptokiObject_Clone
 
710
 * nssCryptokiCertificate_GetAttributes
 
711
 * nssCryptokiPrivateKey_GetAttributes
 
712
 * nssCryptokiPublicKey_GetAttributes
 
713
 * nssCryptokiTrust_GetAttributes
 
714
 * nssCryptokiCRL_GetAttributes
 
715
 */
 
716
 
 
717
NSS_EXTERN void
 
718
nssCryptokiObject_Destroy
 
719
(
 
720
  nssCryptokiObject *object
 
721
);
 
722
 
 
723
NSS_EXTERN PRBool
 
724
nssCryptokiObject_Equal
 
725
(
 
726
  nssCryptokiObject *object1,
 
727
  nssCryptokiObject *object2
 
728
);
 
729
 
 
730
NSS_EXTERN nssCryptokiObject *
 
731
nssCryptokiObject_Clone
 
732
(
 
733
  nssCryptokiObject *object
 
734
);
 
735
 
 
736
NSS_EXTERN PRStatus
 
737
nssCryptokiCertificate_GetAttributes
 
738
(
 
739
  nssCryptokiObject *object,
 
740
  nssSession *sessionOpt,
 
741
  NSSArena *arenaOpt,
 
742
  NSSCertificateType *certTypeOpt,
 
743
  NSSItem *idOpt,
 
744
  NSSDER *encodingOpt,
 
745
  NSSDER *issuerOpt,
 
746
  NSSDER *serialOpt,
 
747
  NSSDER *subjectOpt
 
748
);
 
749
 
 
750
NSS_EXTERN PRStatus
 
751
nssCryptokiTrust_GetAttributes
 
752
(
 
753
  nssCryptokiObject *trustObject,
 
754
  nssSession *sessionOpt,
 
755
  NSSItem *sha1_hash,
 
756
  nssTrustLevel *serverAuth,
 
757
  nssTrustLevel *clientAuth,
 
758
  nssTrustLevel *codeSigning,
 
759
  nssTrustLevel *emailProtection
 
760
);
 
761
 
 
762
NSS_EXTERN PRStatus
 
763
nssCryptokiCRL_GetAttributes
 
764
(
 
765
  nssCryptokiObject *crlObject,
 
766
  nssSession *sessionOpt,
 
767
  NSSArena *arenaOpt,
 
768
  NSSItem *encodingOpt,
 
769
  NSSItem * subjectOpt,
 
770
  CK_ULONG * crl_class,
 
771
  NSSUTF8 **urlOpt,
 
772
  PRBool *isKRLOpt
 
773
);
 
774
 
 
775
/* I'm including this to handle import of certificates in NSS 3.5.  This
 
776
 * function will set the cert-related attributes of a key, in order to
 
777
 * associate it with a cert.  Does it stay like this for 4.0?
 
778
 */
 
779
NSS_EXTERN PRStatus
 
780
nssCryptokiPrivateKey_SetCertificate
 
781
(
 
782
  nssCryptokiObject *keyObject,
 
783
  nssSession *sessionOpt,
 
784
  NSSUTF8 *nickname,
 
785
  NSSItem *id,
 
786
  NSSDER *subject
 
787
);
 
788
 
 
789
NSS_EXTERN void
 
790
nssModuleArray_Destroy
 
791
(
 
792
  NSSModule **modules
 
793
);
 
794
 
 
795
/* nssSlotArray
 
796
 *
 
797
 * nssSlotArray_Destroy
 
798
 */
 
799
 
 
800
NSS_EXTERN void
 
801
nssSlotArray_Destroy
 
802
(
 
803
  NSSSlot **slots
 
804
);
 
805
 
 
806
/* nssTokenArray
 
807
 *
 
808
 * nssTokenArray_Destroy
 
809
 */
 
810
 
 
811
NSS_EXTERN void
 
812
nssTokenArray_Destroy
 
813
(
 
814
  NSSToken **tokens
 
815
);
 
816
 
 
817
/* nssCryptokiObjectArray
 
818
 *
 
819
 * nssCryptokiObjectArray_Destroy
 
820
 */
 
821
NSS_EXTERN void
 
822
nssCryptokiObjectArray_Destroy
 
823
(
 
824
  nssCryptokiObject **object
 
825
);
 
826
 
 
827
/* nssSlotList
 
828
*
 
829
 * An ordered list of slots.  The order can be anything, it is set in the
 
830
 * Add methods.  Perhaps it should be CreateInCertOrder, ...?
 
831
 *
 
832
 * nssSlotList_Create
 
833
 * nssSlotList_Destroy
 
834
 * nssSlotList_Add
 
835
 * nssSlotList_AddModuleSlots
 
836
 * nssSlotList_GetSlots
 
837
 * nssSlotList_FindSlotByName
 
838
 * nssSlotList_FindTokenByName
 
839
 * nssSlotList_GetBestSlot
 
840
 * nssSlotList_GetBestSlotForAlgorithmAndParameters
 
841
 * nssSlotList_GetBestSlotForAlgorithmsAndParameters
 
842
 */
 
843
 
 
844
/* nssSlotList_Create
 
845
 */
 
846
NSS_EXTERN nssSlotList *
 
847
nssSlotList_Create
 
848
(
 
849
  NSSArena *arenaOpt
 
850
);
 
851
 
 
852
/* nssSlotList_Destroy
 
853
 */
 
854
NSS_EXTERN void
 
855
nssSlotList_Destroy
 
856
(
 
857
  nssSlotList *slotList
 
858
);
 
859
 
 
860
/* nssSlotList_Add
 
861
 *
 
862
 * Add the given slot in the given order.
 
863
 */
 
864
NSS_EXTERN PRStatus
 
865
nssSlotList_Add
 
866
(
 
867
  nssSlotList *slotList,
 
868
  NSSSlot *slot,
 
869
  PRUint32 order
 
870
);
 
871
 
 
872
/* nssSlotList_AddModuleSlots
 
873
 *
 
874
 * Add all slots in the module, in the given order (the slots will have
 
875
 * equal weight).
 
876
 */
 
877
NSS_EXTERN PRStatus
 
878
nssSlotList_AddModuleSlots
 
879
(
 
880
  nssSlotList *slotList,
 
881
  NSSModule *module,
 
882
  PRUint32 order
 
883
);
 
884
 
 
885
/* nssSlotList_GetSlots
 
886
 */
 
887
NSS_EXTERN NSSSlot **
 
888
nssSlotList_GetSlots
 
889
(
 
890
  nssSlotList *slotList
 
891
);
 
892
 
 
893
/* nssSlotList_FindSlotByName
 
894
 */
 
895
NSS_EXTERN NSSSlot *
 
896
nssSlotList_FindSlotByName
 
897
(
 
898
  nssSlotList *slotList,
 
899
  NSSUTF8 *slotName
 
900
);
 
901
 
 
902
/* nssSlotList_FindTokenByName
 
903
 */
 
904
NSS_EXTERN NSSToken *
 
905
nssSlotList_FindTokenByName
 
906
(
 
907
  nssSlotList *slotList,
 
908
  NSSUTF8 *tokenName
 
909
);
 
910
 
 
911
/* nssSlotList_GetBestSlot
 
912
 *
 
913
 * The best slot is the highest ranking in order, i.e., the first in the
 
914
 * list.
 
915
 */
 
916
NSS_EXTERN NSSSlot *
 
917
nssSlotList_GetBestSlot
 
918
(
 
919
  nssSlotList *slotList
 
920
);
 
921
 
 
922
/* nssSlotList_GetBestSlotForAlgorithmAndParameters
 
923
 *
 
924
 * Highest-ranking slot than can handle algorithm/parameters.
 
925
 */
 
926
NSS_EXTERN NSSSlot *
 
927
nssSlotList_GetBestSlotForAlgorithmAndParameters
 
928
(
 
929
  nssSlotList *slotList,
 
930
  NSSAlgorithmAndParameters *ap
 
931
);
 
932
 
 
933
/* nssSlotList_GetBestSlotForAlgorithmsAndParameters
 
934
 *
 
935
 * Highest-ranking slot than can handle all algorithms/parameters.
 
936
 */
 
937
NSS_EXTERN NSSSlot *
 
938
nssSlotList_GetBestSlotForAlgorithmsAndParameters
 
939
(
 
940
  nssSlotList *slotList,
 
941
  NSSAlgorithmAndParameters **ap
 
942
);
 
943
 
 
944
#ifdef NSS_3_4_CODE
 
945
 
 
946
NSS_EXTERN PRBool
 
947
nssToken_IsPresent
 
948
(
 
949
  NSSToken *token
 
950
);
 
951
 
 
952
NSS_EXTERN nssSession *
 
953
nssToken_GetDefaultSession
 
954
(
 
955
  NSSToken *token
 
956
);
 
957
 
 
958
NSS_EXTERN PRStatus
 
959
nssToken_GetTrustOrder
 
960
(
 
961
  NSSToken *tok
 
962
);
 
963
 
 
964
NSS_EXTERN PRStatus
 
965
nssToken_NotifyCertsNotVisible
 
966
(
 
967
  NSSToken *tok
 
968
);
 
969
 
 
970
NSS_EXTERN PRStatus
 
971
nssToken_TraverseCertificates
 
972
(
 
973
  NSSToken *token,
 
974
  nssSession *sessionOpt,
 
975
  nssTokenSearchType searchType,
 
976
  PRStatus (* callback)(nssCryptokiObject *instance, void *arg),
 
977
  void *arg
 
978
);
 
979
 
 
980
NSS_EXTERN PRBool
 
981
nssToken_IsPrivateKeyAvailable
 
982
(
 
983
  NSSToken *token,
 
984
  NSSCertificate *c,
 
985
  nssCryptokiObject *instance
 
986
);
 
987
 
 
988
 
 
989
#endif
 
990
 
 
991
PR_END_EXTERN_C
 
992
 
 
993
#endif /* DEV_H */