security/nss/lib/dev/dev.h

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

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

mercurial