Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
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 NSSPKI_H |
michael@0 | 6 | #define NSSPKI_H |
michael@0 | 7 | |
michael@0 | 8 | /* |
michael@0 | 9 | * nsspki.h |
michael@0 | 10 | * |
michael@0 | 11 | * This file prototypes the methods of the top-level PKI objects. |
michael@0 | 12 | */ |
michael@0 | 13 | |
michael@0 | 14 | #ifndef NSSDEVT_H |
michael@0 | 15 | #include "nssdevt.h" |
michael@0 | 16 | #endif /* NSSDEVT_H */ |
michael@0 | 17 | |
michael@0 | 18 | #ifndef NSSPKIT_H |
michael@0 | 19 | #include "nsspkit.h" |
michael@0 | 20 | #endif /* NSSPKIT_H */ |
michael@0 | 21 | |
michael@0 | 22 | #ifndef BASE_H |
michael@0 | 23 | #include "base.h" |
michael@0 | 24 | #endif /* BASE_H */ |
michael@0 | 25 | |
michael@0 | 26 | PR_BEGIN_EXTERN_C |
michael@0 | 27 | |
michael@0 | 28 | /* |
michael@0 | 29 | * A note about interfaces |
michael@0 | 30 | * |
michael@0 | 31 | * Although these APIs are specified in C, a language which does |
michael@0 | 32 | * not have fancy support for abstract interfaces, this library |
michael@0 | 33 | * was designed from an object-oriented perspective. It may be |
michael@0 | 34 | * useful to consider the standard interfaces which went into |
michael@0 | 35 | * the writing of these APIs. |
michael@0 | 36 | * |
michael@0 | 37 | * Basic operations on all objects: |
michael@0 | 38 | * Destroy -- free a pointer to an object |
michael@0 | 39 | * DeleteStoredObject -- delete an object permanently |
michael@0 | 40 | * |
michael@0 | 41 | * Public Key cryptographic operations: |
michael@0 | 42 | * Encrypt |
michael@0 | 43 | * Verify |
michael@0 | 44 | * VerifyRecover |
michael@0 | 45 | * Wrap |
michael@0 | 46 | * Derive |
michael@0 | 47 | * |
michael@0 | 48 | * Private Key cryptographic operations: |
michael@0 | 49 | * IsStillPresent |
michael@0 | 50 | * Decrypt |
michael@0 | 51 | * Sign |
michael@0 | 52 | * SignRecover |
michael@0 | 53 | * Unwrap |
michael@0 | 54 | * Derive |
michael@0 | 55 | * |
michael@0 | 56 | * Symmetric Key cryptographic operations: |
michael@0 | 57 | * IsStillPresent |
michael@0 | 58 | * Encrypt |
michael@0 | 59 | * Decrypt |
michael@0 | 60 | * Sign |
michael@0 | 61 | * SignRecover |
michael@0 | 62 | * Verify |
michael@0 | 63 | * VerifyRecover |
michael@0 | 64 | * Wrap |
michael@0 | 65 | * Unwrap |
michael@0 | 66 | * Derive |
michael@0 | 67 | * |
michael@0 | 68 | */ |
michael@0 | 69 | |
michael@0 | 70 | /* |
michael@0 | 71 | * NSSCertificate |
michael@0 | 72 | * |
michael@0 | 73 | * These things can do crypto ops like public keys, except that the trust, |
michael@0 | 74 | * usage, and other constraints are checked. These objects are "high-level," |
michael@0 | 75 | * so trust, usages, etc. are in the form we throw around (client auth, |
michael@0 | 76 | * email signing, etc.). Remember that theoretically another implementation |
michael@0 | 77 | * (think PGP) could be beneath this object. |
michael@0 | 78 | */ |
michael@0 | 79 | |
michael@0 | 80 | /* |
michael@0 | 81 | * NSSCertificate_Destroy |
michael@0 | 82 | * |
michael@0 | 83 | * Free a pointer to a certificate object. |
michael@0 | 84 | */ |
michael@0 | 85 | |
michael@0 | 86 | NSS_EXTERN PRStatus |
michael@0 | 87 | NSSCertificate_Destroy |
michael@0 | 88 | ( |
michael@0 | 89 | NSSCertificate *c |
michael@0 | 90 | ); |
michael@0 | 91 | |
michael@0 | 92 | /* |
michael@0 | 93 | * NSSCertificate_DeleteStoredObject |
michael@0 | 94 | * |
michael@0 | 95 | * Permanently remove this certificate from storage. If this is the |
michael@0 | 96 | * only (remaining) certificate corresponding to a private key, |
michael@0 | 97 | * public key, and/or other object; then that object (those objects) |
michael@0 | 98 | * are deleted too. |
michael@0 | 99 | */ |
michael@0 | 100 | |
michael@0 | 101 | NSS_EXTERN PRStatus |
michael@0 | 102 | NSSCertificate_DeleteStoredObject |
michael@0 | 103 | ( |
michael@0 | 104 | NSSCertificate *c, |
michael@0 | 105 | NSSCallback *uhh |
michael@0 | 106 | ); |
michael@0 | 107 | |
michael@0 | 108 | /* |
michael@0 | 109 | * NSSCertificate_Validate |
michael@0 | 110 | * |
michael@0 | 111 | * Verify that this certificate is trusted, for the specified usage(s), |
michael@0 | 112 | * at the specified time, {word word} the specified policies. |
michael@0 | 113 | */ |
michael@0 | 114 | |
michael@0 | 115 | NSS_EXTERN PRStatus |
michael@0 | 116 | NSSCertificate_Validate |
michael@0 | 117 | ( |
michael@0 | 118 | NSSCertificate *c, |
michael@0 | 119 | NSSTime *timeOpt, /* NULL for "now" */ |
michael@0 | 120 | NSSUsage *usage, |
michael@0 | 121 | NSSPolicies *policiesOpt /* NULL for none */ |
michael@0 | 122 | ); |
michael@0 | 123 | |
michael@0 | 124 | /* |
michael@0 | 125 | * NSSCertificate_ValidateCompletely |
michael@0 | 126 | * |
michael@0 | 127 | * Verify that this certificate is trusted. The difference between |
michael@0 | 128 | * this and the previous call is that NSSCertificate_Validate merely |
michael@0 | 129 | * returns success or failure with an appropriate error stack. |
michael@0 | 130 | * However, there may be (and often are) multiple problems with a |
michael@0 | 131 | * certificate. This routine returns an array of errors, specifying |
michael@0 | 132 | * every problem. |
michael@0 | 133 | */ |
michael@0 | 134 | |
michael@0 | 135 | /* |
michael@0 | 136 | * Return value must be an array of objects, each of which has |
michael@0 | 137 | * an NSSError, and any corresponding certificate (in the chain) |
michael@0 | 138 | * and/or policy. |
michael@0 | 139 | */ |
michael@0 | 140 | |
michael@0 | 141 | NSS_EXTERN void ** /* void *[] */ |
michael@0 | 142 | NSSCertificate_ValidateCompletely |
michael@0 | 143 | ( |
michael@0 | 144 | NSSCertificate *c, |
michael@0 | 145 | NSSTime *timeOpt, /* NULL for "now" */ |
michael@0 | 146 | NSSUsage *usage, |
michael@0 | 147 | NSSPolicies *policiesOpt, /* NULL for none */ |
michael@0 | 148 | void **rvOpt, /* NULL for allocate */ |
michael@0 | 149 | PRUint32 rvLimit, /* zero for no limit */ |
michael@0 | 150 | NSSArena *arenaOpt /* NULL for heap */ |
michael@0 | 151 | ); |
michael@0 | 152 | |
michael@0 | 153 | /* |
michael@0 | 154 | * NSSCertificate_ValidateAndDiscoverUsagesAndPolicies |
michael@0 | 155 | * |
michael@0 | 156 | * Returns PR_SUCCESS if the certificate is valid for at least something. |
michael@0 | 157 | */ |
michael@0 | 158 | |
michael@0 | 159 | NSS_EXTERN PRStatus |
michael@0 | 160 | NSSCertificate_ValidateAndDiscoverUsagesAndPolicies |
michael@0 | 161 | ( |
michael@0 | 162 | NSSCertificate *c, |
michael@0 | 163 | NSSTime **notBeforeOutOpt, |
michael@0 | 164 | NSSTime **notAfterOutOpt, |
michael@0 | 165 | void *allowedUsages, |
michael@0 | 166 | void *disallowedUsages, |
michael@0 | 167 | void *allowedPolicies, |
michael@0 | 168 | void *disallowedPolicies, |
michael@0 | 169 | /* more args.. work on this fgmr */ |
michael@0 | 170 | NSSArena *arenaOpt |
michael@0 | 171 | ); |
michael@0 | 172 | |
michael@0 | 173 | /* |
michael@0 | 174 | * NSSCertificate_Encode |
michael@0 | 175 | * |
michael@0 | 176 | */ |
michael@0 | 177 | |
michael@0 | 178 | NSS_EXTERN NSSDER * |
michael@0 | 179 | NSSCertificate_Encode |
michael@0 | 180 | ( |
michael@0 | 181 | NSSCertificate *c, |
michael@0 | 182 | NSSDER *rvOpt, |
michael@0 | 183 | NSSArena *arenaOpt |
michael@0 | 184 | ); |
michael@0 | 185 | |
michael@0 | 186 | /* |
michael@0 | 187 | * NSSCertificate_BuildChain |
michael@0 | 188 | * |
michael@0 | 189 | * This routine returns NSSCertificate *'s for each certificate |
michael@0 | 190 | * in the "chain" starting from the specified one up to and |
michael@0 | 191 | * including the root. The zeroth element in the array is the |
michael@0 | 192 | * specified ("leaf") certificate. |
michael@0 | 193 | * |
michael@0 | 194 | * If statusOpt is supplied, and is returned as PR_FAILURE, possible |
michael@0 | 195 | * error values are: |
michael@0 | 196 | * |
michael@0 | 197 | * NSS_ERROR_CERTIFICATE_ISSUER_NOT_FOUND - the chain is incomplete |
michael@0 | 198 | * |
michael@0 | 199 | */ |
michael@0 | 200 | |
michael@0 | 201 | extern const NSSError NSS_ERROR_CERTIFICATE_ISSUER_NOT_FOUND; |
michael@0 | 202 | |
michael@0 | 203 | NSS_EXTERN NSSCertificate ** |
michael@0 | 204 | NSSCertificate_BuildChain |
michael@0 | 205 | ( |
michael@0 | 206 | NSSCertificate *c, |
michael@0 | 207 | NSSTime *timeOpt, |
michael@0 | 208 | NSSUsage *usage, |
michael@0 | 209 | NSSPolicies *policiesOpt, |
michael@0 | 210 | NSSCertificate **rvOpt, |
michael@0 | 211 | PRUint32 rvLimit, /* zero for no limit */ |
michael@0 | 212 | NSSArena *arenaOpt, |
michael@0 | 213 | PRStatus *statusOpt, |
michael@0 | 214 | NSSTrustDomain *td, |
michael@0 | 215 | NSSCryptoContext *cc |
michael@0 | 216 | ); |
michael@0 | 217 | |
michael@0 | 218 | /* |
michael@0 | 219 | * NSSCertificate_GetTrustDomain |
michael@0 | 220 | * |
michael@0 | 221 | */ |
michael@0 | 222 | |
michael@0 | 223 | NSS_EXTERN NSSTrustDomain * |
michael@0 | 224 | NSSCertificate_GetTrustDomain |
michael@0 | 225 | ( |
michael@0 | 226 | NSSCertificate *c |
michael@0 | 227 | ); |
michael@0 | 228 | |
michael@0 | 229 | /* |
michael@0 | 230 | * NSSCertificate_GetToken |
michael@0 | 231 | * |
michael@0 | 232 | * There doesn't have to be one. |
michael@0 | 233 | */ |
michael@0 | 234 | |
michael@0 | 235 | NSS_EXTERN NSSToken * |
michael@0 | 236 | NSSCertificate_GetToken |
michael@0 | 237 | ( |
michael@0 | 238 | NSSCertificate *c, |
michael@0 | 239 | PRStatus *statusOpt |
michael@0 | 240 | ); |
michael@0 | 241 | |
michael@0 | 242 | /* |
michael@0 | 243 | * NSSCertificate_GetSlot |
michael@0 | 244 | * |
michael@0 | 245 | * There doesn't have to be one. |
michael@0 | 246 | */ |
michael@0 | 247 | |
michael@0 | 248 | NSS_EXTERN NSSSlot * |
michael@0 | 249 | NSSCertificate_GetSlot |
michael@0 | 250 | ( |
michael@0 | 251 | NSSCertificate *c, |
michael@0 | 252 | PRStatus *statusOpt |
michael@0 | 253 | ); |
michael@0 | 254 | |
michael@0 | 255 | /* |
michael@0 | 256 | * NSSCertificate_GetModule |
michael@0 | 257 | * |
michael@0 | 258 | * There doesn't have to be one. |
michael@0 | 259 | */ |
michael@0 | 260 | |
michael@0 | 261 | NSS_EXTERN NSSModule * |
michael@0 | 262 | NSSCertificate_GetModule |
michael@0 | 263 | ( |
michael@0 | 264 | NSSCertificate *c, |
michael@0 | 265 | PRStatus *statusOpt |
michael@0 | 266 | ); |
michael@0 | 267 | |
michael@0 | 268 | /* |
michael@0 | 269 | * NSSCertificate_Encrypt |
michael@0 | 270 | * |
michael@0 | 271 | * Encrypt a single chunk of data with the public key corresponding to |
michael@0 | 272 | * this certificate. |
michael@0 | 273 | */ |
michael@0 | 274 | |
michael@0 | 275 | NSS_EXTERN NSSItem * |
michael@0 | 276 | NSSCertificate_Encrypt |
michael@0 | 277 | ( |
michael@0 | 278 | NSSCertificate *c, |
michael@0 | 279 | NSSAlgorithmAndParameters *apOpt, |
michael@0 | 280 | NSSItem *data, |
michael@0 | 281 | NSSTime *timeOpt, |
michael@0 | 282 | NSSUsage *usage, |
michael@0 | 283 | NSSPolicies *policiesOpt, |
michael@0 | 284 | NSSCallback *uhh, |
michael@0 | 285 | NSSItem *rvOpt, |
michael@0 | 286 | NSSArena *arenaOpt |
michael@0 | 287 | ); |
michael@0 | 288 | |
michael@0 | 289 | /* |
michael@0 | 290 | * NSSCertificate_Verify |
michael@0 | 291 | * |
michael@0 | 292 | */ |
michael@0 | 293 | |
michael@0 | 294 | NSS_EXTERN PRStatus |
michael@0 | 295 | NSSCertificate_Verify |
michael@0 | 296 | ( |
michael@0 | 297 | NSSCertificate *c, |
michael@0 | 298 | NSSAlgorithmAndParameters *apOpt, |
michael@0 | 299 | NSSItem *data, |
michael@0 | 300 | NSSItem *signature, |
michael@0 | 301 | NSSTime *timeOpt, |
michael@0 | 302 | NSSUsage *usage, |
michael@0 | 303 | NSSPolicies *policiesOpt, |
michael@0 | 304 | NSSCallback *uhh |
michael@0 | 305 | ); |
michael@0 | 306 | |
michael@0 | 307 | /* |
michael@0 | 308 | * NSSCertificate_VerifyRecover |
michael@0 | 309 | * |
michael@0 | 310 | */ |
michael@0 | 311 | |
michael@0 | 312 | NSS_EXTERN NSSItem * |
michael@0 | 313 | NSSCertificate_VerifyRecover |
michael@0 | 314 | ( |
michael@0 | 315 | NSSCertificate *c, |
michael@0 | 316 | NSSAlgorithmAndParameters *apOpt, |
michael@0 | 317 | NSSItem *signature, |
michael@0 | 318 | NSSTime *timeOpt, |
michael@0 | 319 | NSSUsage *usage, |
michael@0 | 320 | NSSPolicies *policiesOpt, |
michael@0 | 321 | NSSCallback *uhh, |
michael@0 | 322 | NSSItem *rvOpt, |
michael@0 | 323 | NSSArena *arenaOpt |
michael@0 | 324 | ); |
michael@0 | 325 | |
michael@0 | 326 | /* |
michael@0 | 327 | * NSSCertificate_WrapSymmetricKey |
michael@0 | 328 | * |
michael@0 | 329 | * This method tries very hard to to succeed, even in situations |
michael@0 | 330 | * involving sensitive keys and multiple modules. |
michael@0 | 331 | * { relyea: want to add verbiage? } |
michael@0 | 332 | */ |
michael@0 | 333 | |
michael@0 | 334 | NSS_EXTERN NSSItem * |
michael@0 | 335 | NSSCertificate_WrapSymmetricKey |
michael@0 | 336 | ( |
michael@0 | 337 | NSSCertificate *c, |
michael@0 | 338 | NSSAlgorithmAndParameters *apOpt, |
michael@0 | 339 | NSSSymmetricKey *keyToWrap, |
michael@0 | 340 | NSSTime *timeOpt, |
michael@0 | 341 | NSSUsage *usage, |
michael@0 | 342 | NSSPolicies *policiesOpt, |
michael@0 | 343 | NSSCallback *uhh, |
michael@0 | 344 | NSSItem *rvOpt, |
michael@0 | 345 | NSSArena *arenaOpt |
michael@0 | 346 | ); |
michael@0 | 347 | |
michael@0 | 348 | /* |
michael@0 | 349 | * NSSCertificate_CreateCryptoContext |
michael@0 | 350 | * |
michael@0 | 351 | * Create a crypto context, in this certificate's trust domain, with this |
michael@0 | 352 | * as the distinguished certificate. |
michael@0 | 353 | */ |
michael@0 | 354 | |
michael@0 | 355 | NSS_EXTERN NSSCryptoContext * |
michael@0 | 356 | NSSCertificate_CreateCryptoContext |
michael@0 | 357 | ( |
michael@0 | 358 | NSSCertificate *c, |
michael@0 | 359 | NSSAlgorithmAndParameters *apOpt, |
michael@0 | 360 | NSSTime *timeOpt, |
michael@0 | 361 | NSSUsage *usage, |
michael@0 | 362 | NSSPolicies *policiesOpt, |
michael@0 | 363 | NSSCallback *uhh |
michael@0 | 364 | ); |
michael@0 | 365 | |
michael@0 | 366 | /* |
michael@0 | 367 | * NSSCertificate_GetPublicKey |
michael@0 | 368 | * |
michael@0 | 369 | * Returns the public key corresponding to this certificate. |
michael@0 | 370 | */ |
michael@0 | 371 | |
michael@0 | 372 | NSS_EXTERN NSSPublicKey * |
michael@0 | 373 | NSSCertificate_GetPublicKey |
michael@0 | 374 | ( |
michael@0 | 375 | NSSCertificate *c |
michael@0 | 376 | ); |
michael@0 | 377 | |
michael@0 | 378 | /* |
michael@0 | 379 | * NSSCertificate_FindPrivateKey |
michael@0 | 380 | * |
michael@0 | 381 | * Finds and returns the private key corresponding to this certificate, |
michael@0 | 382 | * if it is available. |
michael@0 | 383 | * |
michael@0 | 384 | * { Should this hang off of NSSUserCertificate? } |
michael@0 | 385 | */ |
michael@0 | 386 | |
michael@0 | 387 | NSS_EXTERN NSSPrivateKey * |
michael@0 | 388 | NSSCertificate_FindPrivateKey |
michael@0 | 389 | ( |
michael@0 | 390 | NSSCertificate *c, |
michael@0 | 391 | NSSCallback *uhh |
michael@0 | 392 | ); |
michael@0 | 393 | |
michael@0 | 394 | /* |
michael@0 | 395 | * NSSCertificate_IsPrivateKeyAvailable |
michael@0 | 396 | * |
michael@0 | 397 | * Returns success if the private key corresponding to this certificate |
michael@0 | 398 | * is available to be used. |
michael@0 | 399 | * |
michael@0 | 400 | * { Should *this* hang off of NSSUserCertificate?? } |
michael@0 | 401 | */ |
michael@0 | 402 | |
michael@0 | 403 | NSS_EXTERN PRBool |
michael@0 | 404 | NSSCertificate_IsPrivateKeyAvailable |
michael@0 | 405 | ( |
michael@0 | 406 | NSSCertificate *c, |
michael@0 | 407 | NSSCallback *uhh, |
michael@0 | 408 | PRStatus *statusOpt |
michael@0 | 409 | ); |
michael@0 | 410 | |
michael@0 | 411 | /* |
michael@0 | 412 | * If we make NSSUserCertificate not a typedef of NSSCertificate, |
michael@0 | 413 | * then we'll need implementations of the following: |
michael@0 | 414 | * |
michael@0 | 415 | * NSSUserCertificate_Destroy |
michael@0 | 416 | * NSSUserCertificate_DeleteStoredObject |
michael@0 | 417 | * NSSUserCertificate_Validate |
michael@0 | 418 | * NSSUserCertificate_ValidateCompletely |
michael@0 | 419 | * NSSUserCertificate_ValidateAndDiscoverUsagesAndPolicies |
michael@0 | 420 | * NSSUserCertificate_Encode |
michael@0 | 421 | * NSSUserCertificate_BuildChain |
michael@0 | 422 | * NSSUserCertificate_GetTrustDomain |
michael@0 | 423 | * NSSUserCertificate_GetToken |
michael@0 | 424 | * NSSUserCertificate_GetSlot |
michael@0 | 425 | * NSSUserCertificate_GetModule |
michael@0 | 426 | * NSSUserCertificate_GetCryptoContext |
michael@0 | 427 | * NSSUserCertificate_GetPublicKey |
michael@0 | 428 | */ |
michael@0 | 429 | |
michael@0 | 430 | /* |
michael@0 | 431 | * NSSUserCertificate_IsStillPresent |
michael@0 | 432 | * |
michael@0 | 433 | * Verify that if this certificate lives on a token, that the token |
michael@0 | 434 | * is still present and the certificate still exists. This is a |
michael@0 | 435 | * lightweight call which should be used whenever it should be |
michael@0 | 436 | * verified that the user hasn't perhaps popped out his or her |
michael@0 | 437 | * token and strolled away. |
michael@0 | 438 | */ |
michael@0 | 439 | |
michael@0 | 440 | NSS_EXTERN PRBool |
michael@0 | 441 | NSSUserCertificate_IsStillPresent |
michael@0 | 442 | ( |
michael@0 | 443 | NSSUserCertificate *uc, |
michael@0 | 444 | PRStatus *statusOpt |
michael@0 | 445 | ); |
michael@0 | 446 | |
michael@0 | 447 | /* |
michael@0 | 448 | * NSSUserCertificate_Decrypt |
michael@0 | 449 | * |
michael@0 | 450 | * Decrypt a single chunk of data with the private key corresponding |
michael@0 | 451 | * to this certificate. |
michael@0 | 452 | */ |
michael@0 | 453 | |
michael@0 | 454 | NSS_EXTERN NSSItem * |
michael@0 | 455 | NSSUserCertificate_Decrypt |
michael@0 | 456 | ( |
michael@0 | 457 | NSSUserCertificate *uc, |
michael@0 | 458 | NSSAlgorithmAndParameters *apOpt, |
michael@0 | 459 | NSSItem *data, |
michael@0 | 460 | NSSTime *timeOpt, |
michael@0 | 461 | NSSUsage *usage, |
michael@0 | 462 | NSSPolicies *policiesOpt, |
michael@0 | 463 | NSSCallback *uhh, |
michael@0 | 464 | NSSItem *rvOpt, |
michael@0 | 465 | NSSArena *arenaOpt |
michael@0 | 466 | ); |
michael@0 | 467 | |
michael@0 | 468 | /* |
michael@0 | 469 | * NSSUserCertificate_Sign |
michael@0 | 470 | * |
michael@0 | 471 | */ |
michael@0 | 472 | |
michael@0 | 473 | NSS_EXTERN NSSItem * |
michael@0 | 474 | NSSUserCertificate_Sign |
michael@0 | 475 | ( |
michael@0 | 476 | NSSUserCertificate *uc, |
michael@0 | 477 | NSSAlgorithmAndParameters *apOpt, |
michael@0 | 478 | NSSItem *data, |
michael@0 | 479 | NSSTime *timeOpt, |
michael@0 | 480 | NSSUsage *usage, |
michael@0 | 481 | NSSPolicies *policiesOpt, |
michael@0 | 482 | NSSCallback *uhh, |
michael@0 | 483 | NSSItem *rvOpt, |
michael@0 | 484 | NSSArena *arenaOpt |
michael@0 | 485 | ); |
michael@0 | 486 | |
michael@0 | 487 | /* |
michael@0 | 488 | * NSSUserCertificate_SignRecover |
michael@0 | 489 | * |
michael@0 | 490 | */ |
michael@0 | 491 | |
michael@0 | 492 | NSS_EXTERN NSSItem * |
michael@0 | 493 | NSSUserCertificate_SignRecover |
michael@0 | 494 | ( |
michael@0 | 495 | NSSUserCertificate *uc, |
michael@0 | 496 | NSSAlgorithmAndParameters *apOpt, |
michael@0 | 497 | NSSItem *data, |
michael@0 | 498 | NSSTime *timeOpt, |
michael@0 | 499 | NSSUsage *usage, |
michael@0 | 500 | NSSPolicies *policiesOpt, |
michael@0 | 501 | NSSCallback *uhh, |
michael@0 | 502 | NSSItem *rvOpt, |
michael@0 | 503 | NSSArena *arenaOpt |
michael@0 | 504 | ); |
michael@0 | 505 | |
michael@0 | 506 | /* |
michael@0 | 507 | * NSSUserCertificate_UnwrapSymmetricKey |
michael@0 | 508 | * |
michael@0 | 509 | */ |
michael@0 | 510 | |
michael@0 | 511 | NSS_EXTERN NSSSymmetricKey * |
michael@0 | 512 | NSSUserCertificate_UnwrapSymmetricKey |
michael@0 | 513 | ( |
michael@0 | 514 | NSSUserCertificate *uc, |
michael@0 | 515 | NSSAlgorithmAndParameters *apOpt, |
michael@0 | 516 | NSSItem *wrappedKey, |
michael@0 | 517 | NSSTime *timeOpt, |
michael@0 | 518 | NSSUsage *usage, |
michael@0 | 519 | NSSPolicies *policiesOpt, |
michael@0 | 520 | NSSCallback *uhh, |
michael@0 | 521 | NSSItem *rvOpt, |
michael@0 | 522 | NSSArena *arenaOpt |
michael@0 | 523 | ); |
michael@0 | 524 | |
michael@0 | 525 | /* |
michael@0 | 526 | * NSSUserCertificate_DeriveSymmetricKey |
michael@0 | 527 | * |
michael@0 | 528 | */ |
michael@0 | 529 | |
michael@0 | 530 | NSS_EXTERN NSSSymmetricKey * |
michael@0 | 531 | NSSUserCertificate_DeriveSymmetricKey |
michael@0 | 532 | ( |
michael@0 | 533 | NSSUserCertificate *uc, /* provides private key */ |
michael@0 | 534 | NSSCertificate *c, /* provides public key */ |
michael@0 | 535 | NSSAlgorithmAndParameters *apOpt, |
michael@0 | 536 | NSSOID *target, |
michael@0 | 537 | PRUint32 keySizeOpt, /* zero for best allowed */ |
michael@0 | 538 | NSSOperations operations, |
michael@0 | 539 | NSSCallback *uhh |
michael@0 | 540 | ); |
michael@0 | 541 | |
michael@0 | 542 | /* filter-certs function(s) */ |
michael@0 | 543 | |
michael@0 | 544 | /** |
michael@0 | 545 | ** fgmr -- trust objects |
michael@0 | 546 | **/ |
michael@0 | 547 | |
michael@0 | 548 | /* |
michael@0 | 549 | * NSSPrivateKey |
michael@0 | 550 | * |
michael@0 | 551 | */ |
michael@0 | 552 | |
michael@0 | 553 | /* |
michael@0 | 554 | * NSSPrivateKey_Destroy |
michael@0 | 555 | * |
michael@0 | 556 | * Free a pointer to a private key object. |
michael@0 | 557 | */ |
michael@0 | 558 | |
michael@0 | 559 | NSS_EXTERN PRStatus |
michael@0 | 560 | NSSPrivateKey_Destroy |
michael@0 | 561 | ( |
michael@0 | 562 | NSSPrivateKey *vk |
michael@0 | 563 | ); |
michael@0 | 564 | |
michael@0 | 565 | /* |
michael@0 | 566 | * NSSPrivateKey_DeleteStoredObject |
michael@0 | 567 | * |
michael@0 | 568 | * Permanently remove this object, and any related objects (such as the |
michael@0 | 569 | * certificates corresponding to this key). |
michael@0 | 570 | */ |
michael@0 | 571 | |
michael@0 | 572 | NSS_EXTERN PRStatus |
michael@0 | 573 | NSSPrivateKey_DeleteStoredObject |
michael@0 | 574 | ( |
michael@0 | 575 | NSSPrivateKey *vk, |
michael@0 | 576 | NSSCallback *uhh |
michael@0 | 577 | ); |
michael@0 | 578 | |
michael@0 | 579 | /* |
michael@0 | 580 | * NSSPrivateKey_GetSignatureLength |
michael@0 | 581 | * |
michael@0 | 582 | */ |
michael@0 | 583 | |
michael@0 | 584 | NSS_EXTERN PRUint32 |
michael@0 | 585 | NSSPrivateKey_GetSignatureLength |
michael@0 | 586 | ( |
michael@0 | 587 | NSSPrivateKey *vk |
michael@0 | 588 | ); |
michael@0 | 589 | |
michael@0 | 590 | /* |
michael@0 | 591 | * NSSPrivateKey_GetPrivateModulusLength |
michael@0 | 592 | * |
michael@0 | 593 | */ |
michael@0 | 594 | |
michael@0 | 595 | NSS_EXTERN PRUint32 |
michael@0 | 596 | NSSPrivateKey_GetPrivateModulusLength |
michael@0 | 597 | ( |
michael@0 | 598 | NSSPrivateKey *vk |
michael@0 | 599 | ); |
michael@0 | 600 | |
michael@0 | 601 | /* |
michael@0 | 602 | * NSSPrivateKey_IsStillPresent |
michael@0 | 603 | * |
michael@0 | 604 | */ |
michael@0 | 605 | |
michael@0 | 606 | NSS_EXTERN PRBool |
michael@0 | 607 | NSSPrivateKey_IsStillPresent |
michael@0 | 608 | ( |
michael@0 | 609 | NSSPrivateKey *vk, |
michael@0 | 610 | PRStatus *statusOpt |
michael@0 | 611 | ); |
michael@0 | 612 | |
michael@0 | 613 | /* |
michael@0 | 614 | * NSSPrivateKey_Encode |
michael@0 | 615 | * |
michael@0 | 616 | */ |
michael@0 | 617 | |
michael@0 | 618 | NSS_EXTERN NSSItem * |
michael@0 | 619 | NSSPrivateKey_Encode |
michael@0 | 620 | ( |
michael@0 | 621 | NSSPrivateKey *vk, |
michael@0 | 622 | NSSAlgorithmAndParameters *ap, |
michael@0 | 623 | NSSItem *passwordOpt, /* NULL will cause a callback; "" for no password */ |
michael@0 | 624 | NSSCallback *uhhOpt, |
michael@0 | 625 | NSSItem *rvOpt, |
michael@0 | 626 | NSSArena *arenaOpt |
michael@0 | 627 | ); |
michael@0 | 628 | |
michael@0 | 629 | /* |
michael@0 | 630 | * NSSPrivateKey_GetTrustDomain |
michael@0 | 631 | * |
michael@0 | 632 | * There doesn't have to be one. |
michael@0 | 633 | */ |
michael@0 | 634 | |
michael@0 | 635 | NSS_EXTERN NSSTrustDomain * |
michael@0 | 636 | NSSPrivateKey_GetTrustDomain |
michael@0 | 637 | ( |
michael@0 | 638 | NSSPrivateKey *vk, |
michael@0 | 639 | PRStatus *statusOpt |
michael@0 | 640 | ); |
michael@0 | 641 | |
michael@0 | 642 | /* |
michael@0 | 643 | * NSSPrivateKey_GetToken |
michael@0 | 644 | * |
michael@0 | 645 | */ |
michael@0 | 646 | |
michael@0 | 647 | NSS_EXTERN NSSToken * |
michael@0 | 648 | NSSPrivateKey_GetToken |
michael@0 | 649 | ( |
michael@0 | 650 | NSSPrivateKey *vk |
michael@0 | 651 | ); |
michael@0 | 652 | |
michael@0 | 653 | /* |
michael@0 | 654 | * NSSPrivateKey_GetSlot |
michael@0 | 655 | * |
michael@0 | 656 | */ |
michael@0 | 657 | |
michael@0 | 658 | NSS_EXTERN NSSSlot * |
michael@0 | 659 | NSSPrivateKey_GetSlot |
michael@0 | 660 | ( |
michael@0 | 661 | NSSPrivateKey *vk |
michael@0 | 662 | ); |
michael@0 | 663 | |
michael@0 | 664 | /* |
michael@0 | 665 | * NSSPrivateKey_GetModule |
michael@0 | 666 | * |
michael@0 | 667 | */ |
michael@0 | 668 | |
michael@0 | 669 | NSS_EXTERN NSSModule * |
michael@0 | 670 | NSSPrivateKey_GetModule |
michael@0 | 671 | ( |
michael@0 | 672 | NSSPrivateKey *vk |
michael@0 | 673 | ); |
michael@0 | 674 | |
michael@0 | 675 | /* |
michael@0 | 676 | * NSSPrivateKey_Decrypt |
michael@0 | 677 | * |
michael@0 | 678 | */ |
michael@0 | 679 | |
michael@0 | 680 | NSS_EXTERN NSSItem * |
michael@0 | 681 | NSSPrivateKey_Decrypt |
michael@0 | 682 | ( |
michael@0 | 683 | NSSPrivateKey *vk, |
michael@0 | 684 | NSSAlgorithmAndParameters *apOpt, |
michael@0 | 685 | NSSItem *encryptedData, |
michael@0 | 686 | NSSCallback *uhh, |
michael@0 | 687 | NSSItem *rvOpt, |
michael@0 | 688 | NSSArena *arenaOpt |
michael@0 | 689 | ); |
michael@0 | 690 | |
michael@0 | 691 | /* |
michael@0 | 692 | * NSSPrivateKey_Sign |
michael@0 | 693 | * |
michael@0 | 694 | */ |
michael@0 | 695 | |
michael@0 | 696 | NSS_EXTERN NSSItem * |
michael@0 | 697 | NSSPrivateKey_Sign |
michael@0 | 698 | ( |
michael@0 | 699 | NSSPrivateKey *vk, |
michael@0 | 700 | NSSAlgorithmAndParameters *apOpt, |
michael@0 | 701 | NSSItem *data, |
michael@0 | 702 | NSSCallback *uhh, |
michael@0 | 703 | NSSItem *rvOpt, |
michael@0 | 704 | NSSArena *arenaOpt |
michael@0 | 705 | ); |
michael@0 | 706 | |
michael@0 | 707 | /* |
michael@0 | 708 | * NSSPrivateKey_SignRecover |
michael@0 | 709 | * |
michael@0 | 710 | */ |
michael@0 | 711 | |
michael@0 | 712 | NSS_EXTERN NSSItem * |
michael@0 | 713 | NSSPrivateKey_SignRecover |
michael@0 | 714 | ( |
michael@0 | 715 | NSSPrivateKey *vk, |
michael@0 | 716 | NSSAlgorithmAndParameters *apOpt, |
michael@0 | 717 | NSSItem *data, |
michael@0 | 718 | NSSCallback *uhh, |
michael@0 | 719 | NSSItem *rvOpt, |
michael@0 | 720 | NSSArena *arenaOpt |
michael@0 | 721 | ); |
michael@0 | 722 | |
michael@0 | 723 | /* |
michael@0 | 724 | * NSSPrivateKey_UnwrapSymmetricKey |
michael@0 | 725 | * |
michael@0 | 726 | */ |
michael@0 | 727 | |
michael@0 | 728 | NSS_EXTERN NSSSymmetricKey * |
michael@0 | 729 | NSSPrivateKey_UnwrapSymmetricKey |
michael@0 | 730 | ( |
michael@0 | 731 | NSSPrivateKey *vk, |
michael@0 | 732 | NSSAlgorithmAndParameters *apOpt, |
michael@0 | 733 | NSSItem *wrappedKey, |
michael@0 | 734 | NSSCallback *uhh |
michael@0 | 735 | ); |
michael@0 | 736 | |
michael@0 | 737 | /* |
michael@0 | 738 | * NSSPrivateKey_DeriveSymmetricKey |
michael@0 | 739 | * |
michael@0 | 740 | */ |
michael@0 | 741 | |
michael@0 | 742 | NSS_EXTERN NSSSymmetricKey * |
michael@0 | 743 | NSSPrivateKey_DeriveSymmetricKey |
michael@0 | 744 | ( |
michael@0 | 745 | NSSPrivateKey *vk, |
michael@0 | 746 | NSSPublicKey *bk, |
michael@0 | 747 | NSSAlgorithmAndParameters *apOpt, |
michael@0 | 748 | NSSOID *target, |
michael@0 | 749 | PRUint32 keySizeOpt, /* zero for best allowed */ |
michael@0 | 750 | NSSOperations operations, |
michael@0 | 751 | NSSCallback *uhh |
michael@0 | 752 | ); |
michael@0 | 753 | |
michael@0 | 754 | /* |
michael@0 | 755 | * NSSPrivateKey_FindPublicKey |
michael@0 | 756 | * |
michael@0 | 757 | */ |
michael@0 | 758 | |
michael@0 | 759 | NSS_EXTERN NSSPublicKey * |
michael@0 | 760 | NSSPrivateKey_FindPublicKey |
michael@0 | 761 | ( |
michael@0 | 762 | NSSPrivateKey *vk |
michael@0 | 763 | /* { don't need the callback here, right? } */ |
michael@0 | 764 | ); |
michael@0 | 765 | |
michael@0 | 766 | /* |
michael@0 | 767 | * NSSPrivateKey_CreateCryptoContext |
michael@0 | 768 | * |
michael@0 | 769 | * Create a crypto context, in this key's trust domain, |
michael@0 | 770 | * with this as the distinguished private key. |
michael@0 | 771 | */ |
michael@0 | 772 | |
michael@0 | 773 | NSS_EXTERN NSSCryptoContext * |
michael@0 | 774 | NSSPrivateKey_CreateCryptoContext |
michael@0 | 775 | ( |
michael@0 | 776 | NSSPrivateKey *vk, |
michael@0 | 777 | NSSAlgorithmAndParameters *apOpt, |
michael@0 | 778 | NSSCallback *uhh |
michael@0 | 779 | ); |
michael@0 | 780 | |
michael@0 | 781 | /* |
michael@0 | 782 | * NSSPrivateKey_FindCertificates |
michael@0 | 783 | * |
michael@0 | 784 | * Note that there may be more than one certificate for this |
michael@0 | 785 | * private key. { FilterCertificates function to further |
michael@0 | 786 | * reduce the list. } |
michael@0 | 787 | */ |
michael@0 | 788 | |
michael@0 | 789 | NSS_EXTERN NSSCertificate ** |
michael@0 | 790 | NSSPrivateKey_FindCertificates |
michael@0 | 791 | ( |
michael@0 | 792 | NSSPrivateKey *vk, |
michael@0 | 793 | NSSCertificate *rvOpt[], |
michael@0 | 794 | PRUint32 maximumOpt, /* 0 for no max */ |
michael@0 | 795 | NSSArena *arenaOpt |
michael@0 | 796 | ); |
michael@0 | 797 | |
michael@0 | 798 | /* |
michael@0 | 799 | * NSSPrivateKey_FindBestCertificate |
michael@0 | 800 | * |
michael@0 | 801 | * The parameters for this function will depend on what the users |
michael@0 | 802 | * need. This is just a starting point. |
michael@0 | 803 | */ |
michael@0 | 804 | |
michael@0 | 805 | NSS_EXTERN NSSCertificate * |
michael@0 | 806 | NSSPrivateKey_FindBestCertificate |
michael@0 | 807 | ( |
michael@0 | 808 | NSSPrivateKey *vk, |
michael@0 | 809 | NSSTime *timeOpt, |
michael@0 | 810 | NSSUsage *usageOpt, |
michael@0 | 811 | NSSPolicies *policiesOpt |
michael@0 | 812 | ); |
michael@0 | 813 | |
michael@0 | 814 | /* |
michael@0 | 815 | * NSSPublicKey |
michael@0 | 816 | * |
michael@0 | 817 | * Once you generate, find, or derive one of these, you can use it |
michael@0 | 818 | * to perform (simple) cryptographic operations. Though there may |
michael@0 | 819 | * be certificates associated with these public keys, they are not |
michael@0 | 820 | * verified. |
michael@0 | 821 | */ |
michael@0 | 822 | |
michael@0 | 823 | /* |
michael@0 | 824 | * NSSPublicKey_Destroy |
michael@0 | 825 | * |
michael@0 | 826 | * Free a pointer to a public key object. |
michael@0 | 827 | */ |
michael@0 | 828 | |
michael@0 | 829 | NSS_EXTERN PRStatus |
michael@0 | 830 | NSSPublicKey_Destroy |
michael@0 | 831 | ( |
michael@0 | 832 | NSSPublicKey *bk |
michael@0 | 833 | ); |
michael@0 | 834 | |
michael@0 | 835 | /* |
michael@0 | 836 | * NSSPublicKey_DeleteStoredObject |
michael@0 | 837 | * |
michael@0 | 838 | * Permanently remove this object, and any related objects (such as the |
michael@0 | 839 | * corresponding private keys and certificates). |
michael@0 | 840 | */ |
michael@0 | 841 | |
michael@0 | 842 | NSS_EXTERN PRStatus |
michael@0 | 843 | NSSPublicKey_DeleteStoredObject |
michael@0 | 844 | ( |
michael@0 | 845 | NSSPublicKey *bk, |
michael@0 | 846 | NSSCallback *uhh |
michael@0 | 847 | ); |
michael@0 | 848 | |
michael@0 | 849 | /* |
michael@0 | 850 | * NSSPublicKey_Encode |
michael@0 | 851 | * |
michael@0 | 852 | */ |
michael@0 | 853 | |
michael@0 | 854 | NSS_EXTERN NSSItem * |
michael@0 | 855 | NSSPublicKey_Encode |
michael@0 | 856 | ( |
michael@0 | 857 | NSSPublicKey *bk, |
michael@0 | 858 | NSSAlgorithmAndParameters *ap, |
michael@0 | 859 | NSSCallback *uhhOpt, |
michael@0 | 860 | NSSItem *rvOpt, |
michael@0 | 861 | NSSArena *arenaOpt |
michael@0 | 862 | ); |
michael@0 | 863 | |
michael@0 | 864 | /* |
michael@0 | 865 | * NSSPublicKey_GetTrustDomain |
michael@0 | 866 | * |
michael@0 | 867 | * There doesn't have to be one. |
michael@0 | 868 | */ |
michael@0 | 869 | |
michael@0 | 870 | NSS_EXTERN NSSTrustDomain * |
michael@0 | 871 | NSSPublicKey_GetTrustDomain |
michael@0 | 872 | ( |
michael@0 | 873 | NSSPublicKey *bk, |
michael@0 | 874 | PRStatus *statusOpt |
michael@0 | 875 | ); |
michael@0 | 876 | |
michael@0 | 877 | /* |
michael@0 | 878 | * NSSPublicKey_GetToken |
michael@0 | 879 | * |
michael@0 | 880 | * There doesn't have to be one. |
michael@0 | 881 | */ |
michael@0 | 882 | |
michael@0 | 883 | NSS_EXTERN NSSToken * |
michael@0 | 884 | NSSPublicKey_GetToken |
michael@0 | 885 | ( |
michael@0 | 886 | NSSPublicKey *bk, |
michael@0 | 887 | PRStatus *statusOpt |
michael@0 | 888 | ); |
michael@0 | 889 | |
michael@0 | 890 | /* |
michael@0 | 891 | * NSSPublicKey_GetSlot |
michael@0 | 892 | * |
michael@0 | 893 | * There doesn't have to be one. |
michael@0 | 894 | */ |
michael@0 | 895 | |
michael@0 | 896 | NSS_EXTERN NSSSlot * |
michael@0 | 897 | NSSPublicKey_GetSlot |
michael@0 | 898 | ( |
michael@0 | 899 | NSSPublicKey *bk, |
michael@0 | 900 | PRStatus *statusOpt |
michael@0 | 901 | ); |
michael@0 | 902 | |
michael@0 | 903 | /* |
michael@0 | 904 | * NSSPublicKey_GetModule |
michael@0 | 905 | * |
michael@0 | 906 | * There doesn't have to be one. |
michael@0 | 907 | */ |
michael@0 | 908 | |
michael@0 | 909 | NSS_EXTERN NSSModule * |
michael@0 | 910 | NSSPublicKey_GetModule |
michael@0 | 911 | ( |
michael@0 | 912 | NSSPublicKey *bk, |
michael@0 | 913 | PRStatus *statusOpt |
michael@0 | 914 | ); |
michael@0 | 915 | |
michael@0 | 916 | /* |
michael@0 | 917 | * NSSPublicKey_Encrypt |
michael@0 | 918 | * |
michael@0 | 919 | * Encrypt a single chunk of data with the public key corresponding to |
michael@0 | 920 | * this certificate. |
michael@0 | 921 | */ |
michael@0 | 922 | |
michael@0 | 923 | NSS_EXTERN NSSItem * |
michael@0 | 924 | NSSPublicKey_Encrypt |
michael@0 | 925 | ( |
michael@0 | 926 | NSSPublicKey *bk, |
michael@0 | 927 | NSSAlgorithmAndParameters *apOpt, |
michael@0 | 928 | NSSItem *data, |
michael@0 | 929 | NSSCallback *uhh, |
michael@0 | 930 | NSSItem *rvOpt, |
michael@0 | 931 | NSSArena *arenaOpt |
michael@0 | 932 | ); |
michael@0 | 933 | |
michael@0 | 934 | /* |
michael@0 | 935 | * NSSPublicKey_Verify |
michael@0 | 936 | * |
michael@0 | 937 | */ |
michael@0 | 938 | |
michael@0 | 939 | NSS_EXTERN PRStatus |
michael@0 | 940 | NSSPublicKey_Verify |
michael@0 | 941 | ( |
michael@0 | 942 | NSSPublicKey *bk, |
michael@0 | 943 | NSSAlgorithmAndParameters *apOpt, |
michael@0 | 944 | NSSItem *data, |
michael@0 | 945 | NSSItem *signature, |
michael@0 | 946 | NSSCallback *uhh |
michael@0 | 947 | ); |
michael@0 | 948 | |
michael@0 | 949 | /* |
michael@0 | 950 | * NSSPublicKey_VerifyRecover |
michael@0 | 951 | * |
michael@0 | 952 | */ |
michael@0 | 953 | |
michael@0 | 954 | NSS_EXTERN NSSItem * |
michael@0 | 955 | NSSPublicKey_VerifyRecover |
michael@0 | 956 | ( |
michael@0 | 957 | NSSPublicKey *bk, |
michael@0 | 958 | NSSAlgorithmAndParameters *apOpt, |
michael@0 | 959 | NSSItem *signature, |
michael@0 | 960 | NSSCallback *uhh, |
michael@0 | 961 | NSSItem *rvOpt, |
michael@0 | 962 | NSSArena *arenaOpt |
michael@0 | 963 | ); |
michael@0 | 964 | |
michael@0 | 965 | /* |
michael@0 | 966 | * NSSPublicKey_WrapSymmetricKey |
michael@0 | 967 | * |
michael@0 | 968 | */ |
michael@0 | 969 | |
michael@0 | 970 | NSS_EXTERN NSSItem * |
michael@0 | 971 | NSSPublicKey_WrapSymmetricKey |
michael@0 | 972 | ( |
michael@0 | 973 | NSSPublicKey *bk, |
michael@0 | 974 | NSSAlgorithmAndParameters *apOpt, |
michael@0 | 975 | NSSSymmetricKey *keyToWrap, |
michael@0 | 976 | NSSCallback *uhh, |
michael@0 | 977 | NSSItem *rvOpt, |
michael@0 | 978 | NSSArena *arenaOpt |
michael@0 | 979 | ); |
michael@0 | 980 | |
michael@0 | 981 | /* |
michael@0 | 982 | * NSSPublicKey_CreateCryptoContext |
michael@0 | 983 | * |
michael@0 | 984 | * Create a crypto context, in this key's trust domain, with this |
michael@0 | 985 | * as the distinguished public key. |
michael@0 | 986 | */ |
michael@0 | 987 | |
michael@0 | 988 | NSS_EXTERN NSSCryptoContext * |
michael@0 | 989 | NSSPublicKey_CreateCryptoContext |
michael@0 | 990 | ( |
michael@0 | 991 | NSSPublicKey *bk, |
michael@0 | 992 | NSSAlgorithmAndParameters *apOpt, |
michael@0 | 993 | NSSCallback *uhh |
michael@0 | 994 | ); |
michael@0 | 995 | |
michael@0 | 996 | /* |
michael@0 | 997 | * NSSPublicKey_FindCertificates |
michael@0 | 998 | * |
michael@0 | 999 | * Note that there may be more than one certificate for this |
michael@0 | 1000 | * public key. The current implementation may not find every |
michael@0 | 1001 | * last certificate available for this public key: that would |
michael@0 | 1002 | * involve trolling e.g. huge ldap databases, which will be |
michael@0 | 1003 | * grossly inefficient and not generally useful. |
michael@0 | 1004 | * { FilterCertificates function to further reduce the list } |
michael@0 | 1005 | */ |
michael@0 | 1006 | |
michael@0 | 1007 | NSS_EXTERN NSSCertificate ** |
michael@0 | 1008 | NSSPublicKey_FindCertificates |
michael@0 | 1009 | ( |
michael@0 | 1010 | NSSPublicKey *bk, |
michael@0 | 1011 | NSSCertificate *rvOpt[], |
michael@0 | 1012 | PRUint32 maximumOpt, /* 0 for no max */ |
michael@0 | 1013 | NSSArena *arenaOpt |
michael@0 | 1014 | ); |
michael@0 | 1015 | |
michael@0 | 1016 | /* |
michael@0 | 1017 | * NSSPrivateKey_FindBestCertificate |
michael@0 | 1018 | * |
michael@0 | 1019 | * The parameters for this function will depend on what the users |
michael@0 | 1020 | * need. This is just a starting point. |
michael@0 | 1021 | */ |
michael@0 | 1022 | |
michael@0 | 1023 | NSS_EXTERN NSSCertificate * |
michael@0 | 1024 | NSSPublicKey_FindBestCertificate |
michael@0 | 1025 | ( |
michael@0 | 1026 | NSSPublicKey *bk, |
michael@0 | 1027 | NSSTime *timeOpt, |
michael@0 | 1028 | NSSUsage *usageOpt, |
michael@0 | 1029 | NSSPolicies *policiesOpt |
michael@0 | 1030 | ); |
michael@0 | 1031 | |
michael@0 | 1032 | /* |
michael@0 | 1033 | * NSSPublicKey_FindPrivateKey |
michael@0 | 1034 | * |
michael@0 | 1035 | */ |
michael@0 | 1036 | |
michael@0 | 1037 | NSS_EXTERN NSSPrivateKey * |
michael@0 | 1038 | NSSPublicKey_FindPrivateKey |
michael@0 | 1039 | ( |
michael@0 | 1040 | NSSPublicKey *bk, |
michael@0 | 1041 | NSSCallback *uhh |
michael@0 | 1042 | ); |
michael@0 | 1043 | |
michael@0 | 1044 | /* |
michael@0 | 1045 | * NSSSymmetricKey |
michael@0 | 1046 | * |
michael@0 | 1047 | */ |
michael@0 | 1048 | |
michael@0 | 1049 | /* |
michael@0 | 1050 | * NSSSymmetricKey_Destroy |
michael@0 | 1051 | * |
michael@0 | 1052 | * Free a pointer to a symmetric key object. |
michael@0 | 1053 | */ |
michael@0 | 1054 | |
michael@0 | 1055 | NSS_EXTERN PRStatus |
michael@0 | 1056 | NSSSymmetricKey_Destroy |
michael@0 | 1057 | ( |
michael@0 | 1058 | NSSSymmetricKey *mk |
michael@0 | 1059 | ); |
michael@0 | 1060 | |
michael@0 | 1061 | /* |
michael@0 | 1062 | * NSSSymmetricKey_DeleteStoredObject |
michael@0 | 1063 | * |
michael@0 | 1064 | * Permanently remove this object. |
michael@0 | 1065 | */ |
michael@0 | 1066 | |
michael@0 | 1067 | NSS_EXTERN PRStatus |
michael@0 | 1068 | NSSSymmetricKey_DeleteStoredObject |
michael@0 | 1069 | ( |
michael@0 | 1070 | NSSSymmetricKey *mk, |
michael@0 | 1071 | NSSCallback *uhh |
michael@0 | 1072 | ); |
michael@0 | 1073 | |
michael@0 | 1074 | /* |
michael@0 | 1075 | * NSSSymmetricKey_GetKeyLength |
michael@0 | 1076 | * |
michael@0 | 1077 | */ |
michael@0 | 1078 | |
michael@0 | 1079 | NSS_EXTERN PRUint32 |
michael@0 | 1080 | NSSSymmetricKey_GetKeyLength |
michael@0 | 1081 | ( |
michael@0 | 1082 | NSSSymmetricKey *mk |
michael@0 | 1083 | ); |
michael@0 | 1084 | |
michael@0 | 1085 | /* |
michael@0 | 1086 | * NSSSymmetricKey_GetKeyStrength |
michael@0 | 1087 | * |
michael@0 | 1088 | */ |
michael@0 | 1089 | |
michael@0 | 1090 | NSS_EXTERN PRUint32 |
michael@0 | 1091 | NSSSymmetricKey_GetKeyStrength |
michael@0 | 1092 | ( |
michael@0 | 1093 | NSSSymmetricKey *mk |
michael@0 | 1094 | ); |
michael@0 | 1095 | |
michael@0 | 1096 | /* |
michael@0 | 1097 | * NSSSymmetricKey_IsStillPresent |
michael@0 | 1098 | * |
michael@0 | 1099 | */ |
michael@0 | 1100 | |
michael@0 | 1101 | NSS_EXTERN PRStatus |
michael@0 | 1102 | NSSSymmetricKey_IsStillPresent |
michael@0 | 1103 | ( |
michael@0 | 1104 | NSSSymmetricKey *mk |
michael@0 | 1105 | ); |
michael@0 | 1106 | |
michael@0 | 1107 | /* |
michael@0 | 1108 | * NSSSymmetricKey_GetTrustDomain |
michael@0 | 1109 | * |
michael@0 | 1110 | * There doesn't have to be one. |
michael@0 | 1111 | */ |
michael@0 | 1112 | |
michael@0 | 1113 | NSS_EXTERN NSSTrustDomain * |
michael@0 | 1114 | NSSSymmetricKey_GetTrustDomain |
michael@0 | 1115 | ( |
michael@0 | 1116 | NSSSymmetricKey *mk, |
michael@0 | 1117 | PRStatus *statusOpt |
michael@0 | 1118 | ); |
michael@0 | 1119 | |
michael@0 | 1120 | /* |
michael@0 | 1121 | * NSSSymmetricKey_GetToken |
michael@0 | 1122 | * |
michael@0 | 1123 | * There doesn't have to be one. |
michael@0 | 1124 | */ |
michael@0 | 1125 | |
michael@0 | 1126 | NSS_EXTERN NSSToken * |
michael@0 | 1127 | NSSSymmetricKey_GetToken |
michael@0 | 1128 | ( |
michael@0 | 1129 | NSSSymmetricKey *mk, |
michael@0 | 1130 | PRStatus *statusOpt |
michael@0 | 1131 | ); |
michael@0 | 1132 | |
michael@0 | 1133 | /* |
michael@0 | 1134 | * NSSSymmetricKey_GetSlot |
michael@0 | 1135 | * |
michael@0 | 1136 | * There doesn't have to be one. |
michael@0 | 1137 | */ |
michael@0 | 1138 | |
michael@0 | 1139 | NSS_EXTERN NSSSlot * |
michael@0 | 1140 | NSSSymmetricKey_GetSlot |
michael@0 | 1141 | ( |
michael@0 | 1142 | NSSSymmetricKey *mk, |
michael@0 | 1143 | PRStatus *statusOpt |
michael@0 | 1144 | ); |
michael@0 | 1145 | |
michael@0 | 1146 | /* |
michael@0 | 1147 | * NSSSymmetricKey_GetModule |
michael@0 | 1148 | * |
michael@0 | 1149 | * There doesn't have to be one. |
michael@0 | 1150 | */ |
michael@0 | 1151 | |
michael@0 | 1152 | NSS_EXTERN NSSModule * |
michael@0 | 1153 | NSSSymmetricKey_GetModule |
michael@0 | 1154 | ( |
michael@0 | 1155 | NSSSymmetricKey *mk, |
michael@0 | 1156 | PRStatus *statusOpt |
michael@0 | 1157 | ); |
michael@0 | 1158 | |
michael@0 | 1159 | /* |
michael@0 | 1160 | * NSSSymmetricKey_Encrypt |
michael@0 | 1161 | * |
michael@0 | 1162 | */ |
michael@0 | 1163 | |
michael@0 | 1164 | NSS_EXTERN NSSItem * |
michael@0 | 1165 | NSSSymmetricKey_Encrypt |
michael@0 | 1166 | ( |
michael@0 | 1167 | NSSSymmetricKey *mk, |
michael@0 | 1168 | NSSAlgorithmAndParameters *apOpt, |
michael@0 | 1169 | NSSItem *data, |
michael@0 | 1170 | NSSCallback *uhh, |
michael@0 | 1171 | NSSItem *rvOpt, |
michael@0 | 1172 | NSSArena *arenaOpt |
michael@0 | 1173 | ); |
michael@0 | 1174 | |
michael@0 | 1175 | /* |
michael@0 | 1176 | * NSSSymmetricKey_Decrypt |
michael@0 | 1177 | * |
michael@0 | 1178 | */ |
michael@0 | 1179 | |
michael@0 | 1180 | NSS_EXTERN NSSItem * |
michael@0 | 1181 | NSSSymmetricKey_Decrypt |
michael@0 | 1182 | ( |
michael@0 | 1183 | NSSSymmetricKey *mk, |
michael@0 | 1184 | NSSAlgorithmAndParameters *apOpt, |
michael@0 | 1185 | NSSItem *encryptedData, |
michael@0 | 1186 | NSSCallback *uhh, |
michael@0 | 1187 | NSSItem *rvOpt, |
michael@0 | 1188 | NSSArena *arenaOpt |
michael@0 | 1189 | ); |
michael@0 | 1190 | |
michael@0 | 1191 | /* |
michael@0 | 1192 | * NSSSymmetricKey_Sign |
michael@0 | 1193 | * |
michael@0 | 1194 | */ |
michael@0 | 1195 | |
michael@0 | 1196 | NSS_EXTERN NSSItem * |
michael@0 | 1197 | NSSSymmetricKey_Sign |
michael@0 | 1198 | ( |
michael@0 | 1199 | NSSSymmetricKey *mk, |
michael@0 | 1200 | NSSAlgorithmAndParameters *apOpt, |
michael@0 | 1201 | NSSItem *data, |
michael@0 | 1202 | NSSCallback *uhh, |
michael@0 | 1203 | NSSItem *rvOpt, |
michael@0 | 1204 | NSSArena *arenaOpt |
michael@0 | 1205 | ); |
michael@0 | 1206 | |
michael@0 | 1207 | /* |
michael@0 | 1208 | * NSSSymmetricKey_SignRecover |
michael@0 | 1209 | * |
michael@0 | 1210 | */ |
michael@0 | 1211 | |
michael@0 | 1212 | NSS_EXTERN NSSItem * |
michael@0 | 1213 | NSSSymmetricKey_SignRecover |
michael@0 | 1214 | ( |
michael@0 | 1215 | NSSSymmetricKey *mk, |
michael@0 | 1216 | NSSAlgorithmAndParameters *apOpt, |
michael@0 | 1217 | NSSItem *data, |
michael@0 | 1218 | NSSCallback *uhh, |
michael@0 | 1219 | NSSItem *rvOpt, |
michael@0 | 1220 | NSSArena *arenaOpt |
michael@0 | 1221 | ); |
michael@0 | 1222 | |
michael@0 | 1223 | /* |
michael@0 | 1224 | * NSSSymmetricKey_Verify |
michael@0 | 1225 | * |
michael@0 | 1226 | */ |
michael@0 | 1227 | |
michael@0 | 1228 | NSS_EXTERN PRStatus |
michael@0 | 1229 | NSSSymmetricKey_Verify |
michael@0 | 1230 | ( |
michael@0 | 1231 | NSSSymmetricKey *mk, |
michael@0 | 1232 | NSSAlgorithmAndParameters *apOpt, |
michael@0 | 1233 | NSSItem *data, |
michael@0 | 1234 | NSSItem *signature, |
michael@0 | 1235 | NSSCallback *uhh |
michael@0 | 1236 | ); |
michael@0 | 1237 | |
michael@0 | 1238 | /* |
michael@0 | 1239 | * NSSSymmetricKey_VerifyRecover |
michael@0 | 1240 | * |
michael@0 | 1241 | */ |
michael@0 | 1242 | |
michael@0 | 1243 | NSS_EXTERN NSSItem * |
michael@0 | 1244 | NSSSymmetricKey_VerifyRecover |
michael@0 | 1245 | ( |
michael@0 | 1246 | NSSSymmetricKey *mk, |
michael@0 | 1247 | NSSAlgorithmAndParameters *apOpt, |
michael@0 | 1248 | NSSItem *signature, |
michael@0 | 1249 | NSSCallback *uhh, |
michael@0 | 1250 | NSSItem *rvOpt, |
michael@0 | 1251 | NSSArena *arenaOpt |
michael@0 | 1252 | ); |
michael@0 | 1253 | |
michael@0 | 1254 | /* |
michael@0 | 1255 | * NSSSymmetricKey_WrapSymmetricKey |
michael@0 | 1256 | * |
michael@0 | 1257 | */ |
michael@0 | 1258 | |
michael@0 | 1259 | NSS_EXTERN NSSItem * |
michael@0 | 1260 | NSSSymmetricKey_WrapSymmetricKey |
michael@0 | 1261 | ( |
michael@0 | 1262 | NSSSymmetricKey *wrappingKey, |
michael@0 | 1263 | NSSAlgorithmAndParameters *apOpt, |
michael@0 | 1264 | NSSSymmetricKey *keyToWrap, |
michael@0 | 1265 | NSSCallback *uhh, |
michael@0 | 1266 | NSSItem *rvOpt, |
michael@0 | 1267 | NSSArena *arenaOpt |
michael@0 | 1268 | ); |
michael@0 | 1269 | |
michael@0 | 1270 | /* |
michael@0 | 1271 | * NSSSymmetricKey_WrapPrivateKey |
michael@0 | 1272 | * |
michael@0 | 1273 | */ |
michael@0 | 1274 | |
michael@0 | 1275 | NSS_EXTERN NSSItem * |
michael@0 | 1276 | NSSSymmetricKey_WrapPrivateKey |
michael@0 | 1277 | ( |
michael@0 | 1278 | NSSSymmetricKey *wrappingKey, |
michael@0 | 1279 | NSSAlgorithmAndParameters *apOpt, |
michael@0 | 1280 | NSSPrivateKey *keyToWrap, |
michael@0 | 1281 | NSSCallback *uhh, |
michael@0 | 1282 | NSSItem *rvOpt, |
michael@0 | 1283 | NSSArena *arenaOpt |
michael@0 | 1284 | ); |
michael@0 | 1285 | |
michael@0 | 1286 | /* |
michael@0 | 1287 | * NSSSymmetricKey_UnwrapSymmetricKey |
michael@0 | 1288 | * |
michael@0 | 1289 | */ |
michael@0 | 1290 | |
michael@0 | 1291 | NSS_EXTERN NSSSymmetricKey * |
michael@0 | 1292 | NSSSymmetricKey_UnwrapSymmetricKey |
michael@0 | 1293 | ( |
michael@0 | 1294 | NSSSymmetricKey *wrappingKey, |
michael@0 | 1295 | NSSAlgorithmAndParameters *apOpt, |
michael@0 | 1296 | NSSItem *wrappedKey, |
michael@0 | 1297 | NSSOID *target, |
michael@0 | 1298 | PRUint32 keySizeOpt, |
michael@0 | 1299 | NSSOperations operations, |
michael@0 | 1300 | NSSCallback *uhh |
michael@0 | 1301 | ); |
michael@0 | 1302 | |
michael@0 | 1303 | /* |
michael@0 | 1304 | * NSSSymmetricKey_UnwrapPrivateKey |
michael@0 | 1305 | * |
michael@0 | 1306 | */ |
michael@0 | 1307 | |
michael@0 | 1308 | NSS_EXTERN NSSPrivateKey * |
michael@0 | 1309 | NSSSymmetricKey_UnwrapPrivateKey |
michael@0 | 1310 | ( |
michael@0 | 1311 | NSSSymmetricKey *wrappingKey, |
michael@0 | 1312 | NSSAlgorithmAndParameters *apOpt, |
michael@0 | 1313 | NSSItem *wrappedKey, |
michael@0 | 1314 | NSSUTF8 *labelOpt, |
michael@0 | 1315 | NSSItem *keyIDOpt, |
michael@0 | 1316 | PRBool persistant, |
michael@0 | 1317 | PRBool sensitive, |
michael@0 | 1318 | NSSToken *destinationOpt, |
michael@0 | 1319 | NSSCallback *uhh |
michael@0 | 1320 | ); |
michael@0 | 1321 | |
michael@0 | 1322 | /* |
michael@0 | 1323 | * NSSSymmetricKey_DeriveSymmetricKey |
michael@0 | 1324 | * |
michael@0 | 1325 | */ |
michael@0 | 1326 | |
michael@0 | 1327 | NSS_EXTERN NSSSymmetricKey * |
michael@0 | 1328 | NSSSymmetricKey_DeriveSymmetricKey |
michael@0 | 1329 | ( |
michael@0 | 1330 | NSSSymmetricKey *originalKey, |
michael@0 | 1331 | NSSAlgorithmAndParameters *apOpt, |
michael@0 | 1332 | NSSOID *target, |
michael@0 | 1333 | PRUint32 keySizeOpt, |
michael@0 | 1334 | NSSOperations operations, |
michael@0 | 1335 | NSSCallback *uhh |
michael@0 | 1336 | ); |
michael@0 | 1337 | |
michael@0 | 1338 | /* |
michael@0 | 1339 | * NSSSymmetricKey_CreateCryptoContext |
michael@0 | 1340 | * |
michael@0 | 1341 | * Create a crypto context, in this key's trust domain, |
michael@0 | 1342 | * with this as the distinguished symmetric key. |
michael@0 | 1343 | */ |
michael@0 | 1344 | |
michael@0 | 1345 | NSS_EXTERN NSSCryptoContext * |
michael@0 | 1346 | NSSSymmetricKey_CreateCryptoContext |
michael@0 | 1347 | ( |
michael@0 | 1348 | NSSSymmetricKey *mk, |
michael@0 | 1349 | NSSAlgorithmAndParameters *apOpt, |
michael@0 | 1350 | NSSCallback *uhh |
michael@0 | 1351 | ); |
michael@0 | 1352 | |
michael@0 | 1353 | /* |
michael@0 | 1354 | * NSSTrustDomain |
michael@0 | 1355 | * |
michael@0 | 1356 | */ |
michael@0 | 1357 | |
michael@0 | 1358 | /* |
michael@0 | 1359 | * NSSTrustDomain_Create |
michael@0 | 1360 | * |
michael@0 | 1361 | * This creates a trust domain, optionally with an initial cryptoki |
michael@0 | 1362 | * module. If the module name is not null, the module is loaded if |
michael@0 | 1363 | * needed (using the uriOpt argument), and initialized with the |
michael@0 | 1364 | * opaqueOpt argument. If mumble mumble priority settings, then |
michael@0 | 1365 | * module-specification objects in the module can cause the loading |
michael@0 | 1366 | * and initialization of further modules. |
michael@0 | 1367 | * |
michael@0 | 1368 | * The uriOpt is defined to take a URI. At present, we only |
michael@0 | 1369 | * support file: URLs pointing to platform-native shared libraries. |
michael@0 | 1370 | * However, by specifying this as a URI, this keeps open the |
michael@0 | 1371 | * possibility of supporting other, possibly remote, resources. |
michael@0 | 1372 | * |
michael@0 | 1373 | * The "reserved" arguments is held for when we figure out the |
michael@0 | 1374 | * module priority stuff. |
michael@0 | 1375 | */ |
michael@0 | 1376 | |
michael@0 | 1377 | NSS_EXTERN NSSTrustDomain * |
michael@0 | 1378 | NSSTrustDomain_Create |
michael@0 | 1379 | ( |
michael@0 | 1380 | NSSUTF8 *moduleOpt, |
michael@0 | 1381 | NSSUTF8 *uriOpt, |
michael@0 | 1382 | NSSUTF8 *opaqueOpt, |
michael@0 | 1383 | void *reserved |
michael@0 | 1384 | ); |
michael@0 | 1385 | |
michael@0 | 1386 | /* |
michael@0 | 1387 | * NSSTrustDomain_Destroy |
michael@0 | 1388 | * |
michael@0 | 1389 | */ |
michael@0 | 1390 | |
michael@0 | 1391 | NSS_EXTERN PRStatus |
michael@0 | 1392 | NSSTrustDomain_Destroy |
michael@0 | 1393 | ( |
michael@0 | 1394 | NSSTrustDomain *td |
michael@0 | 1395 | ); |
michael@0 | 1396 | |
michael@0 | 1397 | /* |
michael@0 | 1398 | * NSSTrustDomain_SetDefaultCallback |
michael@0 | 1399 | * |
michael@0 | 1400 | */ |
michael@0 | 1401 | |
michael@0 | 1402 | NSS_EXTERN PRStatus |
michael@0 | 1403 | NSSTrustDomain_SetDefaultCallback |
michael@0 | 1404 | ( |
michael@0 | 1405 | NSSTrustDomain *td, |
michael@0 | 1406 | NSSCallback *newCallback, |
michael@0 | 1407 | NSSCallback **oldCallbackOpt |
michael@0 | 1408 | ); |
michael@0 | 1409 | |
michael@0 | 1410 | /* |
michael@0 | 1411 | * NSSTrustDomain_GetDefaultCallback |
michael@0 | 1412 | * |
michael@0 | 1413 | */ |
michael@0 | 1414 | |
michael@0 | 1415 | NSS_EXTERN NSSCallback * |
michael@0 | 1416 | NSSTrustDomain_GetDefaultCallback |
michael@0 | 1417 | ( |
michael@0 | 1418 | NSSTrustDomain *td, |
michael@0 | 1419 | PRStatus *statusOpt |
michael@0 | 1420 | ); |
michael@0 | 1421 | |
michael@0 | 1422 | /* |
michael@0 | 1423 | * Default policies? |
michael@0 | 1424 | * Default usage? |
michael@0 | 1425 | * Default time, for completeness? |
michael@0 | 1426 | */ |
michael@0 | 1427 | |
michael@0 | 1428 | /* |
michael@0 | 1429 | * NSSTrustDomain_LoadModule |
michael@0 | 1430 | * |
michael@0 | 1431 | */ |
michael@0 | 1432 | |
michael@0 | 1433 | NSS_EXTERN PRStatus |
michael@0 | 1434 | NSSTrustDomain_LoadModule |
michael@0 | 1435 | ( |
michael@0 | 1436 | NSSTrustDomain *td, |
michael@0 | 1437 | NSSUTF8 *moduleOpt, |
michael@0 | 1438 | NSSUTF8 *uriOpt, |
michael@0 | 1439 | NSSUTF8 *opaqueOpt, |
michael@0 | 1440 | void *reserved |
michael@0 | 1441 | ); |
michael@0 | 1442 | |
michael@0 | 1443 | /* |
michael@0 | 1444 | * NSSTrustDomain_AddModule |
michael@0 | 1445 | * NSSTrustDomain_AddSlot |
michael@0 | 1446 | * NSSTrustDomain_UnloadModule |
michael@0 | 1447 | * Managing modules, slots, tokens; priorities; |
michael@0 | 1448 | * Traversing all of the above |
michael@0 | 1449 | * this needs more work |
michael@0 | 1450 | */ |
michael@0 | 1451 | |
michael@0 | 1452 | /* |
michael@0 | 1453 | * NSSTrustDomain_DisableToken |
michael@0 | 1454 | * |
michael@0 | 1455 | */ |
michael@0 | 1456 | |
michael@0 | 1457 | NSS_EXTERN PRStatus |
michael@0 | 1458 | NSSTrustDomain_DisableToken |
michael@0 | 1459 | ( |
michael@0 | 1460 | NSSTrustDomain *td, |
michael@0 | 1461 | NSSToken *token, |
michael@0 | 1462 | NSSError why |
michael@0 | 1463 | ); |
michael@0 | 1464 | |
michael@0 | 1465 | /* |
michael@0 | 1466 | * NSSTrustDomain_EnableToken |
michael@0 | 1467 | * |
michael@0 | 1468 | */ |
michael@0 | 1469 | |
michael@0 | 1470 | NSS_EXTERN PRStatus |
michael@0 | 1471 | NSSTrustDomain_EnableToken |
michael@0 | 1472 | ( |
michael@0 | 1473 | NSSTrustDomain *td, |
michael@0 | 1474 | NSSToken *token |
michael@0 | 1475 | ); |
michael@0 | 1476 | |
michael@0 | 1477 | /* |
michael@0 | 1478 | * NSSTrustDomain_IsTokenEnabled |
michael@0 | 1479 | * |
michael@0 | 1480 | * If disabled, "why" is always on the error stack. |
michael@0 | 1481 | * The optional argument is just for convenience. |
michael@0 | 1482 | */ |
michael@0 | 1483 | |
michael@0 | 1484 | NSS_EXTERN PRStatus |
michael@0 | 1485 | NSSTrustDomain_IsTokenEnabled |
michael@0 | 1486 | ( |
michael@0 | 1487 | NSSTrustDomain *td, |
michael@0 | 1488 | NSSToken *token, |
michael@0 | 1489 | NSSError *whyOpt |
michael@0 | 1490 | ); |
michael@0 | 1491 | |
michael@0 | 1492 | /* |
michael@0 | 1493 | * NSSTrustDomain_FindSlotByName |
michael@0 | 1494 | * |
michael@0 | 1495 | */ |
michael@0 | 1496 | |
michael@0 | 1497 | NSS_EXTERN NSSSlot * |
michael@0 | 1498 | NSSTrustDomain_FindSlotByName |
michael@0 | 1499 | ( |
michael@0 | 1500 | NSSTrustDomain *td, |
michael@0 | 1501 | NSSUTF8 *slotName |
michael@0 | 1502 | ); |
michael@0 | 1503 | |
michael@0 | 1504 | /* |
michael@0 | 1505 | * NSSTrustDomain_FindTokenByName |
michael@0 | 1506 | * |
michael@0 | 1507 | */ |
michael@0 | 1508 | |
michael@0 | 1509 | NSS_EXTERN NSSToken * |
michael@0 | 1510 | NSSTrustDomain_FindTokenByName |
michael@0 | 1511 | ( |
michael@0 | 1512 | NSSTrustDomain *td, |
michael@0 | 1513 | NSSUTF8 *tokenName |
michael@0 | 1514 | ); |
michael@0 | 1515 | |
michael@0 | 1516 | /* |
michael@0 | 1517 | * NSSTrustDomain_FindTokenBySlotName |
michael@0 | 1518 | * |
michael@0 | 1519 | */ |
michael@0 | 1520 | |
michael@0 | 1521 | NSS_EXTERN NSSToken * |
michael@0 | 1522 | NSSTrustDomain_FindTokenBySlotName |
michael@0 | 1523 | ( |
michael@0 | 1524 | NSSTrustDomain *td, |
michael@0 | 1525 | NSSUTF8 *slotName |
michael@0 | 1526 | ); |
michael@0 | 1527 | |
michael@0 | 1528 | /* |
michael@0 | 1529 | * NSSTrustDomain_FindBestTokenForAlgorithm |
michael@0 | 1530 | * |
michael@0 | 1531 | */ |
michael@0 | 1532 | |
michael@0 | 1533 | NSS_EXTERN NSSToken * |
michael@0 | 1534 | NSSTrustDomain_FindTokenForAlgorithm |
michael@0 | 1535 | ( |
michael@0 | 1536 | NSSTrustDomain *td, |
michael@0 | 1537 | NSSOID *algorithm |
michael@0 | 1538 | ); |
michael@0 | 1539 | |
michael@0 | 1540 | /* |
michael@0 | 1541 | * NSSTrustDomain_FindBestTokenForAlgorithms |
michael@0 | 1542 | * |
michael@0 | 1543 | */ |
michael@0 | 1544 | |
michael@0 | 1545 | NSS_EXTERN NSSToken * |
michael@0 | 1546 | NSSTrustDomain_FindBestTokenForAlgorithms |
michael@0 | 1547 | ( |
michael@0 | 1548 | NSSTrustDomain *td, |
michael@0 | 1549 | NSSOID *algorithms[], /* may be null-terminated */ |
michael@0 | 1550 | PRUint32 nAlgorithmsOpt /* limits the array if nonzero */ |
michael@0 | 1551 | ); |
michael@0 | 1552 | |
michael@0 | 1553 | /* |
michael@0 | 1554 | * NSSTrustDomain_Login |
michael@0 | 1555 | * |
michael@0 | 1556 | */ |
michael@0 | 1557 | |
michael@0 | 1558 | NSS_EXTERN PRStatus |
michael@0 | 1559 | NSSTrustDomain_Login |
michael@0 | 1560 | ( |
michael@0 | 1561 | NSSTrustDomain *td, |
michael@0 | 1562 | NSSCallback *uhhOpt |
michael@0 | 1563 | ); |
michael@0 | 1564 | |
michael@0 | 1565 | /* |
michael@0 | 1566 | * NSSTrustDomain_Logout |
michael@0 | 1567 | * |
michael@0 | 1568 | */ |
michael@0 | 1569 | |
michael@0 | 1570 | NSS_EXTERN PRStatus |
michael@0 | 1571 | NSSTrustDomain_Logout |
michael@0 | 1572 | ( |
michael@0 | 1573 | NSSTrustDomain *td |
michael@0 | 1574 | ); |
michael@0 | 1575 | |
michael@0 | 1576 | /* Importing things */ |
michael@0 | 1577 | |
michael@0 | 1578 | /* |
michael@0 | 1579 | * NSSTrustDomain_ImportCertificate |
michael@0 | 1580 | * |
michael@0 | 1581 | * The implementation will pull some data out of the certificate |
michael@0 | 1582 | * (e.g. e-mail address) for use in pkcs#11 object attributes. |
michael@0 | 1583 | */ |
michael@0 | 1584 | |
michael@0 | 1585 | NSS_EXTERN NSSCertificate * |
michael@0 | 1586 | NSSTrustDomain_ImportCertificate |
michael@0 | 1587 | ( |
michael@0 | 1588 | NSSTrustDomain *td, |
michael@0 | 1589 | NSSCertificate *c |
michael@0 | 1590 | ); |
michael@0 | 1591 | |
michael@0 | 1592 | /* |
michael@0 | 1593 | * NSSTrustDomain_ImportPKIXCertificate |
michael@0 | 1594 | * |
michael@0 | 1595 | */ |
michael@0 | 1596 | |
michael@0 | 1597 | NSS_EXTERN NSSCertificate * |
michael@0 | 1598 | NSSTrustDomain_ImportPKIXCertificate |
michael@0 | 1599 | ( |
michael@0 | 1600 | NSSTrustDomain *td, |
michael@0 | 1601 | /* declared as a struct until these "data types" are defined */ |
michael@0 | 1602 | struct NSSPKIXCertificateStr *pc |
michael@0 | 1603 | ); |
michael@0 | 1604 | |
michael@0 | 1605 | /* |
michael@0 | 1606 | * NSSTrustDomain_ImportEncodedCertificate |
michael@0 | 1607 | * |
michael@0 | 1608 | * Imports any type of certificate we support. |
michael@0 | 1609 | */ |
michael@0 | 1610 | |
michael@0 | 1611 | NSS_EXTERN NSSCertificate * |
michael@0 | 1612 | NSSTrustDomain_ImportEncodedCertificate |
michael@0 | 1613 | ( |
michael@0 | 1614 | NSSTrustDomain *td, |
michael@0 | 1615 | NSSBER *ber |
michael@0 | 1616 | ); |
michael@0 | 1617 | |
michael@0 | 1618 | /* |
michael@0 | 1619 | * NSSTrustDomain_ImportEncodedCertificateChain |
michael@0 | 1620 | * |
michael@0 | 1621 | * If you just want the leaf, pass in a maximum of one. |
michael@0 | 1622 | */ |
michael@0 | 1623 | |
michael@0 | 1624 | NSS_EXTERN NSSCertificate ** |
michael@0 | 1625 | NSSTrustDomain_ImportEncodedCertificateChain |
michael@0 | 1626 | ( |
michael@0 | 1627 | NSSTrustDomain *td, |
michael@0 | 1628 | NSSBER *ber, |
michael@0 | 1629 | NSSCertificate *rvOpt[], |
michael@0 | 1630 | PRUint32 maximumOpt, /* 0 for no max */ |
michael@0 | 1631 | NSSArena *arenaOpt |
michael@0 | 1632 | ); |
michael@0 | 1633 | |
michael@0 | 1634 | /* |
michael@0 | 1635 | * NSSTrustDomain_ImportEncodedPrivateKey |
michael@0 | 1636 | * |
michael@0 | 1637 | */ |
michael@0 | 1638 | |
michael@0 | 1639 | NSS_EXTERN NSSPrivateKey * |
michael@0 | 1640 | NSSTrustDomain_ImportEncodedPrivateKey |
michael@0 | 1641 | ( |
michael@0 | 1642 | NSSTrustDomain *td, |
michael@0 | 1643 | NSSBER *ber, |
michael@0 | 1644 | NSSItem *passwordOpt, /* NULL will cause a callback */ |
michael@0 | 1645 | NSSCallback *uhhOpt, |
michael@0 | 1646 | NSSToken *destination |
michael@0 | 1647 | ); |
michael@0 | 1648 | |
michael@0 | 1649 | /* |
michael@0 | 1650 | * NSSTrustDomain_ImportEncodedPublicKey |
michael@0 | 1651 | * |
michael@0 | 1652 | */ |
michael@0 | 1653 | |
michael@0 | 1654 | NSS_EXTERN NSSPublicKey * |
michael@0 | 1655 | NSSTrustDomain_ImportEncodedPublicKey |
michael@0 | 1656 | ( |
michael@0 | 1657 | NSSTrustDomain *td, |
michael@0 | 1658 | NSSBER *ber |
michael@0 | 1659 | ); |
michael@0 | 1660 | |
michael@0 | 1661 | /* Other importations: S/MIME capabilities */ |
michael@0 | 1662 | |
michael@0 | 1663 | /* |
michael@0 | 1664 | * NSSTrustDomain_FindBestCertificateByNickname |
michael@0 | 1665 | * |
michael@0 | 1666 | */ |
michael@0 | 1667 | |
michael@0 | 1668 | NSS_EXTERN NSSCertificate * |
michael@0 | 1669 | NSSTrustDomain_FindBestCertificateByNickname |
michael@0 | 1670 | ( |
michael@0 | 1671 | NSSTrustDomain *td, |
michael@0 | 1672 | const NSSUTF8 *name, |
michael@0 | 1673 | NSSTime *timeOpt, /* NULL for "now" */ |
michael@0 | 1674 | NSSUsage *usage, |
michael@0 | 1675 | NSSPolicies *policiesOpt /* NULL for none */ |
michael@0 | 1676 | ); |
michael@0 | 1677 | |
michael@0 | 1678 | /* |
michael@0 | 1679 | * NSSTrustDomain_FindCertificatesByNickname |
michael@0 | 1680 | * |
michael@0 | 1681 | */ |
michael@0 | 1682 | |
michael@0 | 1683 | NSS_EXTERN NSSCertificate ** |
michael@0 | 1684 | NSSTrustDomain_FindCertificatesByNickname |
michael@0 | 1685 | ( |
michael@0 | 1686 | NSSTrustDomain *td, |
michael@0 | 1687 | NSSUTF8 *name, |
michael@0 | 1688 | NSSCertificate *rvOpt[], |
michael@0 | 1689 | PRUint32 maximumOpt, /* 0 for no max */ |
michael@0 | 1690 | NSSArena *arenaOpt |
michael@0 | 1691 | ); |
michael@0 | 1692 | |
michael@0 | 1693 | /* |
michael@0 | 1694 | * NSSTrustDomain_FindCertificateByIssuerAndSerialNumber |
michael@0 | 1695 | * |
michael@0 | 1696 | */ |
michael@0 | 1697 | |
michael@0 | 1698 | NSS_EXTERN NSSCertificate * |
michael@0 | 1699 | NSSTrustDomain_FindCertificateByIssuerAndSerialNumber |
michael@0 | 1700 | ( |
michael@0 | 1701 | NSSTrustDomain *td, |
michael@0 | 1702 | NSSDER *issuer, |
michael@0 | 1703 | NSSDER *serialNumber |
michael@0 | 1704 | ); |
michael@0 | 1705 | |
michael@0 | 1706 | /* |
michael@0 | 1707 | * NSSTrustDomain_FindCertificatesByIssuerAndSerialNumber |
michael@0 | 1708 | * |
michael@0 | 1709 | * Theoretically, this should never happen. However, some companies |
michael@0 | 1710 | * we know have issued duplicate certificates with the same issuer |
michael@0 | 1711 | * and serial number. Do we just ignore them? I'm thinking yes. |
michael@0 | 1712 | */ |
michael@0 | 1713 | |
michael@0 | 1714 | /* |
michael@0 | 1715 | * NSSTrustDomain_FindBestCertificateBySubject |
michael@0 | 1716 | * |
michael@0 | 1717 | * This does not search through alternate names hidden in extensions. |
michael@0 | 1718 | */ |
michael@0 | 1719 | |
michael@0 | 1720 | NSS_EXTERN NSSCertificate * |
michael@0 | 1721 | NSSTrustDomain_FindBestCertificateBySubject |
michael@0 | 1722 | ( |
michael@0 | 1723 | NSSTrustDomain *td, |
michael@0 | 1724 | NSSDER /*NSSUTF8*/ *subject, |
michael@0 | 1725 | NSSTime *timeOpt, |
michael@0 | 1726 | NSSUsage *usage, |
michael@0 | 1727 | NSSPolicies *policiesOpt |
michael@0 | 1728 | ); |
michael@0 | 1729 | |
michael@0 | 1730 | /* |
michael@0 | 1731 | * NSSTrustDomain_FindCertificatesBySubject |
michael@0 | 1732 | * |
michael@0 | 1733 | * This does not search through alternate names hidden in extensions. |
michael@0 | 1734 | */ |
michael@0 | 1735 | |
michael@0 | 1736 | NSS_EXTERN NSSCertificate ** |
michael@0 | 1737 | NSSTrustDomain_FindCertificatesBySubject |
michael@0 | 1738 | ( |
michael@0 | 1739 | NSSTrustDomain *td, |
michael@0 | 1740 | NSSDER /*NSSUTF8*/ *subject, |
michael@0 | 1741 | NSSCertificate *rvOpt[], |
michael@0 | 1742 | PRUint32 maximumOpt, /* 0 for no max */ |
michael@0 | 1743 | NSSArena *arenaOpt |
michael@0 | 1744 | ); |
michael@0 | 1745 | |
michael@0 | 1746 | /* |
michael@0 | 1747 | * NSSTrustDomain_FindBestCertificateByNameComponents |
michael@0 | 1748 | * |
michael@0 | 1749 | * This call does try several tricks, including a pseudo pkcs#11 |
michael@0 | 1750 | * attribute for the ldap module to try as a query. Eventually |
michael@0 | 1751 | * this call falls back to a traversal if that's what's required. |
michael@0 | 1752 | * It will search through alternate names hidden in extensions. |
michael@0 | 1753 | */ |
michael@0 | 1754 | |
michael@0 | 1755 | NSS_EXTERN NSSCertificate * |
michael@0 | 1756 | NSSTrustDomain_FindBestCertificateByNameComponents |
michael@0 | 1757 | ( |
michael@0 | 1758 | NSSTrustDomain *td, |
michael@0 | 1759 | NSSUTF8 *nameComponents, |
michael@0 | 1760 | NSSTime *timeOpt, |
michael@0 | 1761 | NSSUsage *usage, |
michael@0 | 1762 | NSSPolicies *policiesOpt |
michael@0 | 1763 | ); |
michael@0 | 1764 | |
michael@0 | 1765 | /* |
michael@0 | 1766 | * NSSTrustDomain_FindCertificatesByNameComponents |
michael@0 | 1767 | * |
michael@0 | 1768 | * This call, too, tries several tricks. It will stop on the first |
michael@0 | 1769 | * attempt that generates results, so it won't e.g. traverse the |
michael@0 | 1770 | * entire ldap database. |
michael@0 | 1771 | */ |
michael@0 | 1772 | |
michael@0 | 1773 | NSS_EXTERN NSSCertificate ** |
michael@0 | 1774 | NSSTrustDomain_FindCertificatesByNameComponents |
michael@0 | 1775 | ( |
michael@0 | 1776 | NSSTrustDomain *td, |
michael@0 | 1777 | NSSUTF8 *nameComponents, |
michael@0 | 1778 | NSSCertificate *rvOpt[], |
michael@0 | 1779 | PRUint32 maximumOpt, /* 0 for no max */ |
michael@0 | 1780 | NSSArena *arenaOpt |
michael@0 | 1781 | ); |
michael@0 | 1782 | |
michael@0 | 1783 | /* |
michael@0 | 1784 | * NSSTrustDomain_FindCertificateByEncodedCertificate |
michael@0 | 1785 | * |
michael@0 | 1786 | */ |
michael@0 | 1787 | |
michael@0 | 1788 | NSS_EXTERN NSSCertificate * |
michael@0 | 1789 | NSSTrustDomain_FindCertificateByEncodedCertificate |
michael@0 | 1790 | ( |
michael@0 | 1791 | NSSTrustDomain *td, |
michael@0 | 1792 | NSSBER *encodedCertificate |
michael@0 | 1793 | ); |
michael@0 | 1794 | |
michael@0 | 1795 | /* |
michael@0 | 1796 | * NSSTrustDomain_FindBestCertificateByEmail |
michael@0 | 1797 | * |
michael@0 | 1798 | */ |
michael@0 | 1799 | |
michael@0 | 1800 | NSS_EXTERN NSSCertificate * |
michael@0 | 1801 | NSSTrustDomain_FindCertificateByEmail |
michael@0 | 1802 | ( |
michael@0 | 1803 | NSSTrustDomain *td, |
michael@0 | 1804 | NSSASCII7 *email, |
michael@0 | 1805 | NSSTime *timeOpt, |
michael@0 | 1806 | NSSUsage *usage, |
michael@0 | 1807 | NSSPolicies *policiesOpt |
michael@0 | 1808 | ); |
michael@0 | 1809 | |
michael@0 | 1810 | /* |
michael@0 | 1811 | * NSSTrustDomain_FindCertificatesByEmail |
michael@0 | 1812 | * |
michael@0 | 1813 | */ |
michael@0 | 1814 | |
michael@0 | 1815 | NSS_EXTERN NSSCertificate ** |
michael@0 | 1816 | NSSTrustDomain_FindCertificatesByEmail |
michael@0 | 1817 | ( |
michael@0 | 1818 | NSSTrustDomain *td, |
michael@0 | 1819 | NSSASCII7 *email, |
michael@0 | 1820 | NSSCertificate *rvOpt[], |
michael@0 | 1821 | PRUint32 maximumOpt, /* 0 for no max */ |
michael@0 | 1822 | NSSArena *arenaOpt |
michael@0 | 1823 | ); |
michael@0 | 1824 | |
michael@0 | 1825 | /* |
michael@0 | 1826 | * NSSTrustDomain_FindCertificateByOCSPHash |
michael@0 | 1827 | * |
michael@0 | 1828 | * There can be only one. |
michael@0 | 1829 | */ |
michael@0 | 1830 | |
michael@0 | 1831 | NSS_EXTERN NSSCertificate * |
michael@0 | 1832 | NSSTrustDomain_FindCertificateByOCSPHash |
michael@0 | 1833 | ( |
michael@0 | 1834 | NSSTrustDomain *td, |
michael@0 | 1835 | NSSItem *hash |
michael@0 | 1836 | ); |
michael@0 | 1837 | |
michael@0 | 1838 | /* |
michael@0 | 1839 | * NSSTrustDomain_TraverseCertificates |
michael@0 | 1840 | * |
michael@0 | 1841 | * This function descends from one in older versions of NSS which |
michael@0 | 1842 | * traverses the certs in the permanent database. That function |
michael@0 | 1843 | * was used to implement selection routines, but was directly |
michael@0 | 1844 | * available too. Trust domains are going to contain a lot more |
michael@0 | 1845 | * certs now (e.g., an ldap server), so we'd really like to |
michael@0 | 1846 | * discourage traversal. Thus for now, this is commented out. |
michael@0 | 1847 | * If it's needed, let's look at the situation more closely to |
michael@0 | 1848 | * find out what the actual requirements are. |
michael@0 | 1849 | */ |
michael@0 | 1850 | |
michael@0 | 1851 | /* For now, adding this function. This may only be for debugging |
michael@0 | 1852 | * purposes. |
michael@0 | 1853 | * Perhaps some equivalent function, on a specified token, will be |
michael@0 | 1854 | * needed in a "friend" header file? |
michael@0 | 1855 | */ |
michael@0 | 1856 | NSS_EXTERN PRStatus * |
michael@0 | 1857 | NSSTrustDomain_TraverseCertificates |
michael@0 | 1858 | ( |
michael@0 | 1859 | NSSTrustDomain *td, |
michael@0 | 1860 | PRStatus (*callback)(NSSCertificate *c, void *arg), |
michael@0 | 1861 | void *arg |
michael@0 | 1862 | ); |
michael@0 | 1863 | |
michael@0 | 1864 | /* |
michael@0 | 1865 | * NSSTrustDomain_FindBestUserCertificate |
michael@0 | 1866 | * |
michael@0 | 1867 | */ |
michael@0 | 1868 | |
michael@0 | 1869 | NSS_EXTERN NSSCertificate * |
michael@0 | 1870 | NSSTrustDomain_FindBestUserCertificate |
michael@0 | 1871 | ( |
michael@0 | 1872 | NSSTrustDomain *td, |
michael@0 | 1873 | NSSTime *timeOpt, |
michael@0 | 1874 | NSSUsage *usage, |
michael@0 | 1875 | NSSPolicies *policiesOpt |
michael@0 | 1876 | ); |
michael@0 | 1877 | |
michael@0 | 1878 | /* |
michael@0 | 1879 | * NSSTrustDomain_FindUserCertificates |
michael@0 | 1880 | * |
michael@0 | 1881 | */ |
michael@0 | 1882 | |
michael@0 | 1883 | NSS_EXTERN NSSCertificate ** |
michael@0 | 1884 | NSSTrustDomain_FindUserCertificates |
michael@0 | 1885 | ( |
michael@0 | 1886 | NSSTrustDomain *td, |
michael@0 | 1887 | NSSTime *timeOpt, |
michael@0 | 1888 | NSSUsage *usageOpt, |
michael@0 | 1889 | NSSPolicies *policiesOpt, |
michael@0 | 1890 | NSSCertificate **rvOpt, |
michael@0 | 1891 | PRUint32 rvLimit, /* zero for no limit */ |
michael@0 | 1892 | NSSArena *arenaOpt |
michael@0 | 1893 | ); |
michael@0 | 1894 | |
michael@0 | 1895 | /* |
michael@0 | 1896 | * NSSTrustDomain_FindBestUserCertificateForSSLClientAuth |
michael@0 | 1897 | * |
michael@0 | 1898 | */ |
michael@0 | 1899 | |
michael@0 | 1900 | NSS_EXTERN NSSCertificate * |
michael@0 | 1901 | NSSTrustDomain_FindBestUserCertificateForSSLClientAuth |
michael@0 | 1902 | ( |
michael@0 | 1903 | NSSTrustDomain *td, |
michael@0 | 1904 | NSSUTF8 *sslHostOpt, |
michael@0 | 1905 | NSSDER *rootCAsOpt[], /* null pointer for none */ |
michael@0 | 1906 | PRUint32 rootCAsMaxOpt, /* zero means list is null-terminated */ |
michael@0 | 1907 | NSSAlgorithmAndParameters *apOpt, |
michael@0 | 1908 | NSSPolicies *policiesOpt |
michael@0 | 1909 | ); |
michael@0 | 1910 | |
michael@0 | 1911 | /* |
michael@0 | 1912 | * NSSTrustDomain_FindUserCertificatesForSSLClientAuth |
michael@0 | 1913 | * |
michael@0 | 1914 | */ |
michael@0 | 1915 | |
michael@0 | 1916 | NSS_EXTERN NSSCertificate ** |
michael@0 | 1917 | NSSTrustDomain_FindUserCertificatesForSSLClientAuth |
michael@0 | 1918 | ( |
michael@0 | 1919 | NSSTrustDomain *td, |
michael@0 | 1920 | NSSUTF8 *sslHostOpt, |
michael@0 | 1921 | NSSDER *rootCAsOpt[], /* null pointer for none */ |
michael@0 | 1922 | PRUint32 rootCAsMaxOpt, /* zero means list is null-terminated */ |
michael@0 | 1923 | NSSAlgorithmAndParameters *apOpt, |
michael@0 | 1924 | NSSPolicies *policiesOpt, |
michael@0 | 1925 | NSSCertificate **rvOpt, |
michael@0 | 1926 | PRUint32 rvLimit, /* zero for no limit */ |
michael@0 | 1927 | NSSArena *arenaOpt |
michael@0 | 1928 | ); |
michael@0 | 1929 | |
michael@0 | 1930 | /* |
michael@0 | 1931 | * NSSTrustDomain_FindBestUserCertificateForEmailSigning |
michael@0 | 1932 | * |
michael@0 | 1933 | */ |
michael@0 | 1934 | |
michael@0 | 1935 | NSS_EXTERN NSSCertificate * |
michael@0 | 1936 | NSSTrustDomain_FindBestUserCertificateForEmailSigning |
michael@0 | 1937 | ( |
michael@0 | 1938 | NSSTrustDomain *td, |
michael@0 | 1939 | NSSASCII7 *signerOpt, |
michael@0 | 1940 | NSSASCII7 *recipientOpt, |
michael@0 | 1941 | /* anything more here? */ |
michael@0 | 1942 | NSSAlgorithmAndParameters *apOpt, |
michael@0 | 1943 | NSSPolicies *policiesOpt |
michael@0 | 1944 | ); |
michael@0 | 1945 | |
michael@0 | 1946 | /* |
michael@0 | 1947 | * NSSTrustDomain_FindUserCertificatesForEmailSigning |
michael@0 | 1948 | * |
michael@0 | 1949 | */ |
michael@0 | 1950 | |
michael@0 | 1951 | NSS_EXTERN NSSCertificate ** |
michael@0 | 1952 | NSSTrustDomain_FindUserCertificatesForEmailSigning |
michael@0 | 1953 | ( |
michael@0 | 1954 | NSSTrustDomain *td, |
michael@0 | 1955 | NSSASCII7 *signerOpt, |
michael@0 | 1956 | NSSASCII7 *recipientOpt, |
michael@0 | 1957 | /* anything more here? */ |
michael@0 | 1958 | NSSAlgorithmAndParameters *apOpt, |
michael@0 | 1959 | NSSPolicies *policiesOpt, |
michael@0 | 1960 | NSSCertificate **rvOpt, |
michael@0 | 1961 | PRUint32 rvLimit, /* zero for no limit */ |
michael@0 | 1962 | NSSArena *arenaOpt |
michael@0 | 1963 | ); |
michael@0 | 1964 | |
michael@0 | 1965 | /* |
michael@0 | 1966 | * Here is where we'd add more Find[Best]UserCertificate[s]For<usage> |
michael@0 | 1967 | * routines. |
michael@0 | 1968 | */ |
michael@0 | 1969 | |
michael@0 | 1970 | /* Private Keys */ |
michael@0 | 1971 | |
michael@0 | 1972 | /* |
michael@0 | 1973 | * NSSTrustDomain_GenerateKeyPair |
michael@0 | 1974 | * |
michael@0 | 1975 | * Creates persistant objects. If you want session objects, use |
michael@0 | 1976 | * NSSCryptoContext_GenerateKeyPair. The destination token is where |
michael@0 | 1977 | * the keys are stored. If that token can do the required math, then |
michael@0 | 1978 | * that's where the keys are generated too. Otherwise, the keys are |
michael@0 | 1979 | * generated elsewhere and moved to that token. |
michael@0 | 1980 | */ |
michael@0 | 1981 | |
michael@0 | 1982 | NSS_EXTERN PRStatus |
michael@0 | 1983 | NSSTrustDomain_GenerateKeyPair |
michael@0 | 1984 | ( |
michael@0 | 1985 | NSSTrustDomain *td, |
michael@0 | 1986 | NSSAlgorithmAndParameters *ap, |
michael@0 | 1987 | NSSPrivateKey **pvkOpt, |
michael@0 | 1988 | NSSPublicKey **pbkOpt, |
michael@0 | 1989 | PRBool privateKeyIsSensitive, |
michael@0 | 1990 | NSSToken *destination, |
michael@0 | 1991 | NSSCallback *uhhOpt |
michael@0 | 1992 | ); |
michael@0 | 1993 | |
michael@0 | 1994 | /* |
michael@0 | 1995 | * NSSTrustDomain_TraversePrivateKeys |
michael@0 | 1996 | * |
michael@0 | 1997 | * |
michael@0 | 1998 | * NSS_EXTERN PRStatus * |
michael@0 | 1999 | * NSSTrustDomain_TraversePrivateKeys |
michael@0 | 2000 | * ( |
michael@0 | 2001 | * NSSTrustDomain *td, |
michael@0 | 2002 | * PRStatus (*callback)(NSSPrivateKey *vk, void *arg), |
michael@0 | 2003 | * void *arg |
michael@0 | 2004 | * ); |
michael@0 | 2005 | */ |
michael@0 | 2006 | |
michael@0 | 2007 | /* Symmetric Keys */ |
michael@0 | 2008 | |
michael@0 | 2009 | /* |
michael@0 | 2010 | * NSSTrustDomain_GenerateSymmetricKey |
michael@0 | 2011 | * |
michael@0 | 2012 | */ |
michael@0 | 2013 | |
michael@0 | 2014 | NSS_EXTERN NSSSymmetricKey * |
michael@0 | 2015 | NSSTrustDomain_GenerateSymmetricKey |
michael@0 | 2016 | ( |
michael@0 | 2017 | NSSTrustDomain *td, |
michael@0 | 2018 | NSSAlgorithmAndParameters *ap, |
michael@0 | 2019 | PRUint32 keysize, |
michael@0 | 2020 | NSSToken *destination, |
michael@0 | 2021 | NSSCallback *uhhOpt |
michael@0 | 2022 | ); |
michael@0 | 2023 | |
michael@0 | 2024 | /* |
michael@0 | 2025 | * NSSTrustDomain_GenerateSymmetricKeyFromPassword |
michael@0 | 2026 | * |
michael@0 | 2027 | */ |
michael@0 | 2028 | |
michael@0 | 2029 | NSS_EXTERN NSSSymmetricKey * |
michael@0 | 2030 | NSSTrustDomain_GenerateSymmetricKeyFromPassword |
michael@0 | 2031 | ( |
michael@0 | 2032 | NSSTrustDomain *td, |
michael@0 | 2033 | NSSAlgorithmAndParameters *ap, |
michael@0 | 2034 | NSSUTF8 *passwordOpt, /* if null, prompt */ |
michael@0 | 2035 | NSSToken *destinationOpt, |
michael@0 | 2036 | NSSCallback *uhhOpt |
michael@0 | 2037 | ); |
michael@0 | 2038 | |
michael@0 | 2039 | /* |
michael@0 | 2040 | * NSSTrustDomain_FindSymmetricKeyByAlgorithm |
michael@0 | 2041 | * |
michael@0 | 2042 | * Is this still needed? |
michael@0 | 2043 | * |
michael@0 | 2044 | * NSS_EXTERN NSSSymmetricKey * |
michael@0 | 2045 | * NSSTrustDomain_FindSymmetricKeyByAlgorithm |
michael@0 | 2046 | * ( |
michael@0 | 2047 | * NSSTrustDomain *td, |
michael@0 | 2048 | * NSSOID *algorithm, |
michael@0 | 2049 | * NSSCallback *uhhOpt |
michael@0 | 2050 | * ); |
michael@0 | 2051 | */ |
michael@0 | 2052 | |
michael@0 | 2053 | /* |
michael@0 | 2054 | * NSSTrustDomain_FindSymmetricKeyByAlgorithmAndKeyID |
michael@0 | 2055 | * |
michael@0 | 2056 | */ |
michael@0 | 2057 | |
michael@0 | 2058 | NSS_EXTERN NSSSymmetricKey * |
michael@0 | 2059 | NSSTrustDomain_FindSymmetricKeyByAlgorithmAndKeyID |
michael@0 | 2060 | ( |
michael@0 | 2061 | NSSTrustDomain *td, |
michael@0 | 2062 | NSSOID *algorithm, |
michael@0 | 2063 | NSSItem *keyID, |
michael@0 | 2064 | NSSCallback *uhhOpt |
michael@0 | 2065 | ); |
michael@0 | 2066 | |
michael@0 | 2067 | /* |
michael@0 | 2068 | * NSSTrustDomain_TraverseSymmetricKeys |
michael@0 | 2069 | * |
michael@0 | 2070 | * |
michael@0 | 2071 | * NSS_EXTERN PRStatus * |
michael@0 | 2072 | * NSSTrustDomain_TraverseSymmetricKeys |
michael@0 | 2073 | * ( |
michael@0 | 2074 | * NSSTrustDomain *td, |
michael@0 | 2075 | * PRStatus (*callback)(NSSSymmetricKey *mk, void *arg), |
michael@0 | 2076 | * void *arg |
michael@0 | 2077 | * ); |
michael@0 | 2078 | */ |
michael@0 | 2079 | |
michael@0 | 2080 | /* |
michael@0 | 2081 | * NSSTrustDomain_CreateCryptoContext |
michael@0 | 2082 | * |
michael@0 | 2083 | * If a callback object is specified, it becomes the for the crypto |
michael@0 | 2084 | * context; otherwise, this trust domain's default (if any) is |
michael@0 | 2085 | * inherited. |
michael@0 | 2086 | */ |
michael@0 | 2087 | |
michael@0 | 2088 | NSS_EXTERN NSSCryptoContext * |
michael@0 | 2089 | NSSTrustDomain_CreateCryptoContext |
michael@0 | 2090 | ( |
michael@0 | 2091 | NSSTrustDomain *td, |
michael@0 | 2092 | NSSCallback *uhhOpt |
michael@0 | 2093 | ); |
michael@0 | 2094 | |
michael@0 | 2095 | /* |
michael@0 | 2096 | * NSSTrustDomain_CreateCryptoContextForAlgorithm |
michael@0 | 2097 | * |
michael@0 | 2098 | */ |
michael@0 | 2099 | |
michael@0 | 2100 | NSS_EXTERN NSSCryptoContext * |
michael@0 | 2101 | NSSTrustDomain_CreateCryptoContextForAlgorithm |
michael@0 | 2102 | ( |
michael@0 | 2103 | NSSTrustDomain *td, |
michael@0 | 2104 | NSSOID *algorithm |
michael@0 | 2105 | ); |
michael@0 | 2106 | |
michael@0 | 2107 | /* |
michael@0 | 2108 | * NSSTrustDomain_CreateCryptoContextForAlgorithmAndParameters |
michael@0 | 2109 | * |
michael@0 | 2110 | */ |
michael@0 | 2111 | |
michael@0 | 2112 | NSS_EXTERN NSSCryptoContext * |
michael@0 | 2113 | NSSTrustDomain_CreateCryptoContextForAlgorithmAndParameters |
michael@0 | 2114 | ( |
michael@0 | 2115 | NSSTrustDomain *td, |
michael@0 | 2116 | NSSAlgorithmAndParameters *ap |
michael@0 | 2117 | ); |
michael@0 | 2118 | |
michael@0 | 2119 | /* find/traverse other objects, e.g. s/mime profiles */ |
michael@0 | 2120 | |
michael@0 | 2121 | /* |
michael@0 | 2122 | * NSSCryptoContext |
michael@0 | 2123 | * |
michael@0 | 2124 | * A crypto context is sort of a short-term snapshot of a trust domain, |
michael@0 | 2125 | * used for the life of "one crypto operation." You can also think of |
michael@0 | 2126 | * it as a "temporary database." |
michael@0 | 2127 | * |
michael@0 | 2128 | * Just about all of the things you can do with a trust domain -- importing |
michael@0 | 2129 | * or creating certs, keys, etc. -- can be done with a crypto context. |
michael@0 | 2130 | * The difference is that the objects will be temporary ("session") objects. |
michael@0 | 2131 | * |
michael@0 | 2132 | * Also, if the context was created for a key, cert, and/or algorithm; or |
michael@0 | 2133 | * if such objects have been "associated" with the context, then the context |
michael@0 | 2134 | * can do everything the keys can, like crypto operations. |
michael@0 | 2135 | * |
michael@0 | 2136 | * And finally, because it keeps the state of the crypto operations, it |
michael@0 | 2137 | * can do streaming crypto ops. |
michael@0 | 2138 | */ |
michael@0 | 2139 | |
michael@0 | 2140 | /* |
michael@0 | 2141 | * NSSTrustDomain_Destroy |
michael@0 | 2142 | * |
michael@0 | 2143 | */ |
michael@0 | 2144 | |
michael@0 | 2145 | NSS_EXTERN PRStatus |
michael@0 | 2146 | NSSCryptoContext_Destroy |
michael@0 | 2147 | ( |
michael@0 | 2148 | NSSCryptoContext *cc |
michael@0 | 2149 | ); |
michael@0 | 2150 | |
michael@0 | 2151 | /* establishing a default callback */ |
michael@0 | 2152 | |
michael@0 | 2153 | /* |
michael@0 | 2154 | * NSSCryptoContext_SetDefaultCallback |
michael@0 | 2155 | * |
michael@0 | 2156 | */ |
michael@0 | 2157 | |
michael@0 | 2158 | NSS_EXTERN PRStatus |
michael@0 | 2159 | NSSCryptoContext_SetDefaultCallback |
michael@0 | 2160 | ( |
michael@0 | 2161 | NSSCryptoContext *cc, |
michael@0 | 2162 | NSSCallback *newCallback, |
michael@0 | 2163 | NSSCallback **oldCallbackOpt |
michael@0 | 2164 | ); |
michael@0 | 2165 | |
michael@0 | 2166 | /* |
michael@0 | 2167 | * NSSCryptoContext_GetDefaultCallback |
michael@0 | 2168 | * |
michael@0 | 2169 | */ |
michael@0 | 2170 | |
michael@0 | 2171 | NSS_EXTERN NSSCallback * |
michael@0 | 2172 | NSSCryptoContext_GetDefaultCallback |
michael@0 | 2173 | ( |
michael@0 | 2174 | NSSCryptoContext *cc, |
michael@0 | 2175 | PRStatus *statusOpt |
michael@0 | 2176 | ); |
michael@0 | 2177 | |
michael@0 | 2178 | /* |
michael@0 | 2179 | * NSSCryptoContext_GetTrustDomain |
michael@0 | 2180 | * |
michael@0 | 2181 | */ |
michael@0 | 2182 | |
michael@0 | 2183 | NSS_EXTERN NSSTrustDomain * |
michael@0 | 2184 | NSSCryptoContext_GetTrustDomain |
michael@0 | 2185 | ( |
michael@0 | 2186 | NSSCryptoContext *cc |
michael@0 | 2187 | ); |
michael@0 | 2188 | |
michael@0 | 2189 | /* AddModule, etc: should we allow "temporary" changes here? */ |
michael@0 | 2190 | /* DisableToken, etc: ditto */ |
michael@0 | 2191 | /* Ordering of tokens? */ |
michael@0 | 2192 | /* Finding slots+token etc. */ |
michael@0 | 2193 | /* login+logout */ |
michael@0 | 2194 | |
michael@0 | 2195 | /* Importing things */ |
michael@0 | 2196 | |
michael@0 | 2197 | /* |
michael@0 | 2198 | * NSSCryptoContext_FindOrImportCertificate |
michael@0 | 2199 | * |
michael@0 | 2200 | * If the certificate store already contains this DER cert, return the |
michael@0 | 2201 | * address of the matching NSSCertificate that is already in the store, |
michael@0 | 2202 | * and bump its reference count. |
michael@0 | 2203 | * |
michael@0 | 2204 | * If this DER cert is NOT already in the store, then add the new |
michael@0 | 2205 | * NSSCertificate to the store and bump its reference count, |
michael@0 | 2206 | * then return its address. |
michael@0 | 2207 | * |
michael@0 | 2208 | * if this DER cert is not in the store and cannot be added to it, |
michael@0 | 2209 | * return NULL; |
michael@0 | 2210 | * |
michael@0 | 2211 | * Record the associated crypto context in the certificate. |
michael@0 | 2212 | */ |
michael@0 | 2213 | |
michael@0 | 2214 | NSS_EXTERN NSSCertificate * |
michael@0 | 2215 | NSSCryptoContext_FindOrImportCertificate ( |
michael@0 | 2216 | NSSCryptoContext *cc, |
michael@0 | 2217 | NSSCertificate *c |
michael@0 | 2218 | ); |
michael@0 | 2219 | |
michael@0 | 2220 | /* |
michael@0 | 2221 | * NSSCryptoContext_ImportPKIXCertificate |
michael@0 | 2222 | * |
michael@0 | 2223 | */ |
michael@0 | 2224 | |
michael@0 | 2225 | NSS_EXTERN NSSCertificate * |
michael@0 | 2226 | NSSCryptoContext_ImportPKIXCertificate |
michael@0 | 2227 | ( |
michael@0 | 2228 | NSSCryptoContext *cc, |
michael@0 | 2229 | struct NSSPKIXCertificateStr *pc |
michael@0 | 2230 | ); |
michael@0 | 2231 | |
michael@0 | 2232 | /* |
michael@0 | 2233 | * NSSCryptoContext_ImportEncodedCertificate |
michael@0 | 2234 | * |
michael@0 | 2235 | */ |
michael@0 | 2236 | |
michael@0 | 2237 | NSS_EXTERN NSSCertificate * |
michael@0 | 2238 | NSSCryptoContext_ImportEncodedCertificate |
michael@0 | 2239 | ( |
michael@0 | 2240 | NSSCryptoContext *cc, |
michael@0 | 2241 | NSSBER *ber |
michael@0 | 2242 | ); |
michael@0 | 2243 | |
michael@0 | 2244 | /* |
michael@0 | 2245 | * NSSCryptoContext_ImportEncodedPKIXCertificateChain |
michael@0 | 2246 | * |
michael@0 | 2247 | */ |
michael@0 | 2248 | |
michael@0 | 2249 | NSS_EXTERN PRStatus |
michael@0 | 2250 | NSSCryptoContext_ImportEncodedPKIXCertificateChain |
michael@0 | 2251 | ( |
michael@0 | 2252 | NSSCryptoContext *cc, |
michael@0 | 2253 | NSSBER *ber |
michael@0 | 2254 | ); |
michael@0 | 2255 | |
michael@0 | 2256 | /* Other importations: S/MIME capabilities |
michael@0 | 2257 | */ |
michael@0 | 2258 | |
michael@0 | 2259 | /* |
michael@0 | 2260 | * NSSCryptoContext_FindBestCertificateByNickname |
michael@0 | 2261 | * |
michael@0 | 2262 | */ |
michael@0 | 2263 | |
michael@0 | 2264 | NSS_EXTERN NSSCertificate * |
michael@0 | 2265 | NSSCryptoContext_FindBestCertificateByNickname |
michael@0 | 2266 | ( |
michael@0 | 2267 | NSSCryptoContext *cc, |
michael@0 | 2268 | const NSSUTF8 *name, |
michael@0 | 2269 | NSSTime *timeOpt, /* NULL for "now" */ |
michael@0 | 2270 | NSSUsage *usage, |
michael@0 | 2271 | NSSPolicies *policiesOpt /* NULL for none */ |
michael@0 | 2272 | ); |
michael@0 | 2273 | |
michael@0 | 2274 | /* |
michael@0 | 2275 | * NSSCryptoContext_FindCertificatesByNickname |
michael@0 | 2276 | * |
michael@0 | 2277 | */ |
michael@0 | 2278 | |
michael@0 | 2279 | NSS_EXTERN NSSCertificate ** |
michael@0 | 2280 | NSSCryptoContext_FindCertificatesByNickname |
michael@0 | 2281 | ( |
michael@0 | 2282 | NSSCryptoContext *cc, |
michael@0 | 2283 | NSSUTF8 *name, |
michael@0 | 2284 | NSSCertificate *rvOpt[], |
michael@0 | 2285 | PRUint32 maximumOpt, /* 0 for no max */ |
michael@0 | 2286 | NSSArena *arenaOpt |
michael@0 | 2287 | ); |
michael@0 | 2288 | |
michael@0 | 2289 | /* |
michael@0 | 2290 | * NSSCryptoContext_FindCertificateByIssuerAndSerialNumber |
michael@0 | 2291 | * |
michael@0 | 2292 | */ |
michael@0 | 2293 | |
michael@0 | 2294 | NSS_EXTERN NSSCertificate * |
michael@0 | 2295 | NSSCryptoContext_FindCertificateByIssuerAndSerialNumber |
michael@0 | 2296 | ( |
michael@0 | 2297 | NSSCryptoContext *cc, |
michael@0 | 2298 | NSSDER *issuer, |
michael@0 | 2299 | NSSDER *serialNumber |
michael@0 | 2300 | ); |
michael@0 | 2301 | |
michael@0 | 2302 | /* |
michael@0 | 2303 | * NSSCryptoContext_FindBestCertificateBySubject |
michael@0 | 2304 | * |
michael@0 | 2305 | * This does not search through alternate names hidden in extensions. |
michael@0 | 2306 | */ |
michael@0 | 2307 | |
michael@0 | 2308 | NSS_EXTERN NSSCertificate * |
michael@0 | 2309 | NSSCryptoContext_FindBestCertificateBySubject |
michael@0 | 2310 | ( |
michael@0 | 2311 | NSSCryptoContext *cc, |
michael@0 | 2312 | NSSDER /*NSSUTF8*/ *subject, |
michael@0 | 2313 | NSSTime *timeOpt, |
michael@0 | 2314 | NSSUsage *usage, |
michael@0 | 2315 | NSSPolicies *policiesOpt |
michael@0 | 2316 | ); |
michael@0 | 2317 | |
michael@0 | 2318 | /* |
michael@0 | 2319 | * NSSCryptoContext_FindCertificatesBySubject |
michael@0 | 2320 | * |
michael@0 | 2321 | * This does not search through alternate names hidden in extensions. |
michael@0 | 2322 | */ |
michael@0 | 2323 | |
michael@0 | 2324 | NSS_EXTERN NSSCertificate ** |
michael@0 | 2325 | NSSCryptoContext_FindCertificatesBySubject |
michael@0 | 2326 | ( |
michael@0 | 2327 | NSSCryptoContext *cc, |
michael@0 | 2328 | NSSDER /*NSSUTF8*/ *subject, |
michael@0 | 2329 | NSSCertificate *rvOpt[], |
michael@0 | 2330 | PRUint32 maximumOpt, /* 0 for no max */ |
michael@0 | 2331 | NSSArena *arenaOpt |
michael@0 | 2332 | ); |
michael@0 | 2333 | |
michael@0 | 2334 | /* |
michael@0 | 2335 | * NSSCryptoContext_FindBestCertificateByNameComponents |
michael@0 | 2336 | * |
michael@0 | 2337 | * This call does try several tricks, including a pseudo pkcs#11 |
michael@0 | 2338 | * attribute for the ldap module to try as a query. Eventually |
michael@0 | 2339 | * this call falls back to a traversal if that's what's required. |
michael@0 | 2340 | * It will search through alternate names hidden in extensions. |
michael@0 | 2341 | */ |
michael@0 | 2342 | |
michael@0 | 2343 | NSS_EXTERN NSSCertificate * |
michael@0 | 2344 | NSSCryptoContext_FindBestCertificateByNameComponents |
michael@0 | 2345 | ( |
michael@0 | 2346 | NSSCryptoContext *cc, |
michael@0 | 2347 | NSSUTF8 *nameComponents, |
michael@0 | 2348 | NSSTime *timeOpt, |
michael@0 | 2349 | NSSUsage *usage, |
michael@0 | 2350 | NSSPolicies *policiesOpt |
michael@0 | 2351 | ); |
michael@0 | 2352 | |
michael@0 | 2353 | /* |
michael@0 | 2354 | * NSSCryptoContext_FindCertificatesByNameComponents |
michael@0 | 2355 | * |
michael@0 | 2356 | * This call, too, tries several tricks. It will stop on the first |
michael@0 | 2357 | * attempt that generates results, so it won't e.g. traverse the |
michael@0 | 2358 | * entire ldap database. |
michael@0 | 2359 | */ |
michael@0 | 2360 | |
michael@0 | 2361 | NSS_EXTERN NSSCertificate ** |
michael@0 | 2362 | NSSCryptoContext_FindCertificatesByNameComponents |
michael@0 | 2363 | ( |
michael@0 | 2364 | NSSCryptoContext *cc, |
michael@0 | 2365 | NSSUTF8 *nameComponents, |
michael@0 | 2366 | NSSCertificate *rvOpt[], |
michael@0 | 2367 | PRUint32 maximumOpt, /* 0 for no max */ |
michael@0 | 2368 | NSSArena *arenaOpt |
michael@0 | 2369 | ); |
michael@0 | 2370 | |
michael@0 | 2371 | /* |
michael@0 | 2372 | * NSSCryptoContext_FindCertificateByEncodedCertificate |
michael@0 | 2373 | * |
michael@0 | 2374 | */ |
michael@0 | 2375 | |
michael@0 | 2376 | NSS_EXTERN NSSCertificate * |
michael@0 | 2377 | NSSCryptoContext_FindCertificateByEncodedCertificate |
michael@0 | 2378 | ( |
michael@0 | 2379 | NSSCryptoContext *cc, |
michael@0 | 2380 | NSSBER *encodedCertificate |
michael@0 | 2381 | ); |
michael@0 | 2382 | |
michael@0 | 2383 | /* |
michael@0 | 2384 | * NSSCryptoContext_FindBestCertificateByEmail |
michael@0 | 2385 | * |
michael@0 | 2386 | */ |
michael@0 | 2387 | |
michael@0 | 2388 | NSS_EXTERN NSSCertificate * |
michael@0 | 2389 | NSSCryptoContext_FindBestCertificateByEmail |
michael@0 | 2390 | ( |
michael@0 | 2391 | NSSCryptoContext *cc, |
michael@0 | 2392 | NSSASCII7 *email, |
michael@0 | 2393 | NSSTime *timeOpt, |
michael@0 | 2394 | NSSUsage *usage, |
michael@0 | 2395 | NSSPolicies *policiesOpt |
michael@0 | 2396 | ); |
michael@0 | 2397 | |
michael@0 | 2398 | /* |
michael@0 | 2399 | * NSSCryptoContext_FindCertificatesByEmail |
michael@0 | 2400 | * |
michael@0 | 2401 | */ |
michael@0 | 2402 | |
michael@0 | 2403 | NSS_EXTERN NSSCertificate ** |
michael@0 | 2404 | NSSCryptoContext_FindCertificatesByEmail |
michael@0 | 2405 | ( |
michael@0 | 2406 | NSSCryptoContext *cc, |
michael@0 | 2407 | NSSASCII7 *email, |
michael@0 | 2408 | NSSCertificate *rvOpt[], |
michael@0 | 2409 | PRUint32 maximumOpt, /* 0 for no max */ |
michael@0 | 2410 | NSSArena *arenaOpt |
michael@0 | 2411 | ); |
michael@0 | 2412 | |
michael@0 | 2413 | /* |
michael@0 | 2414 | * NSSCryptoContext_FindCertificateByOCSPHash |
michael@0 | 2415 | * |
michael@0 | 2416 | */ |
michael@0 | 2417 | |
michael@0 | 2418 | NSS_EXTERN NSSCertificate * |
michael@0 | 2419 | NSSCryptoContext_FindCertificateByOCSPHash |
michael@0 | 2420 | ( |
michael@0 | 2421 | NSSCryptoContext *cc, |
michael@0 | 2422 | NSSItem *hash |
michael@0 | 2423 | ); |
michael@0 | 2424 | |
michael@0 | 2425 | /* |
michael@0 | 2426 | * NSSCryptoContext_TraverseCertificates |
michael@0 | 2427 | * |
michael@0 | 2428 | * |
michael@0 | 2429 | * NSS_EXTERN PRStatus * |
michael@0 | 2430 | * NSSCryptoContext_TraverseCertificates |
michael@0 | 2431 | * ( |
michael@0 | 2432 | * NSSCryptoContext *cc, |
michael@0 | 2433 | * PRStatus (*callback)(NSSCertificate *c, void *arg), |
michael@0 | 2434 | * void *arg |
michael@0 | 2435 | * ); |
michael@0 | 2436 | */ |
michael@0 | 2437 | |
michael@0 | 2438 | /* |
michael@0 | 2439 | * NSSCryptoContext_FindBestUserCertificate |
michael@0 | 2440 | * |
michael@0 | 2441 | */ |
michael@0 | 2442 | |
michael@0 | 2443 | NSS_EXTERN NSSCertificate * |
michael@0 | 2444 | NSSCryptoContext_FindBestUserCertificate |
michael@0 | 2445 | ( |
michael@0 | 2446 | NSSCryptoContext *cc, |
michael@0 | 2447 | NSSTime *timeOpt, |
michael@0 | 2448 | NSSUsage *usage, |
michael@0 | 2449 | NSSPolicies *policiesOpt |
michael@0 | 2450 | ); |
michael@0 | 2451 | |
michael@0 | 2452 | /* |
michael@0 | 2453 | * NSSCryptoContext_FindUserCertificates |
michael@0 | 2454 | * |
michael@0 | 2455 | */ |
michael@0 | 2456 | |
michael@0 | 2457 | NSS_EXTERN NSSCertificate ** |
michael@0 | 2458 | NSSCryptoContext_FindUserCertificates |
michael@0 | 2459 | ( |
michael@0 | 2460 | NSSCryptoContext *cc, |
michael@0 | 2461 | NSSTime *timeOpt, |
michael@0 | 2462 | NSSUsage *usageOpt, |
michael@0 | 2463 | NSSPolicies *policiesOpt, |
michael@0 | 2464 | NSSCertificate **rvOpt, |
michael@0 | 2465 | PRUint32 rvLimit, /* zero for no limit */ |
michael@0 | 2466 | NSSArena *arenaOpt |
michael@0 | 2467 | ); |
michael@0 | 2468 | |
michael@0 | 2469 | /* |
michael@0 | 2470 | * NSSCryptoContext_FindBestUserCertificateForSSLClientAuth |
michael@0 | 2471 | * |
michael@0 | 2472 | */ |
michael@0 | 2473 | |
michael@0 | 2474 | NSS_EXTERN NSSCertificate * |
michael@0 | 2475 | NSSCryptoContext_FindBestUserCertificateForSSLClientAuth |
michael@0 | 2476 | ( |
michael@0 | 2477 | NSSCryptoContext *cc, |
michael@0 | 2478 | NSSUTF8 *sslHostOpt, |
michael@0 | 2479 | NSSDER *rootCAsOpt[], /* null pointer for none */ |
michael@0 | 2480 | PRUint32 rootCAsMaxOpt, /* zero means list is null-terminated */ |
michael@0 | 2481 | NSSAlgorithmAndParameters *apOpt, |
michael@0 | 2482 | NSSPolicies *policiesOpt |
michael@0 | 2483 | ); |
michael@0 | 2484 | |
michael@0 | 2485 | /* |
michael@0 | 2486 | * NSSCryptoContext_FindUserCertificatesForSSLClientAuth |
michael@0 | 2487 | * |
michael@0 | 2488 | */ |
michael@0 | 2489 | |
michael@0 | 2490 | NSS_EXTERN NSSCertificate ** |
michael@0 | 2491 | NSSCryptoContext_FindUserCertificatesForSSLClientAuth |
michael@0 | 2492 | ( |
michael@0 | 2493 | NSSCryptoContext *cc, |
michael@0 | 2494 | NSSUTF8 *sslHostOpt, |
michael@0 | 2495 | NSSDER *rootCAsOpt[], /* null pointer for none */ |
michael@0 | 2496 | PRUint32 rootCAsMaxOpt, /* zero means list is null-terminated */ |
michael@0 | 2497 | NSSAlgorithmAndParameters *apOpt, |
michael@0 | 2498 | NSSPolicies *policiesOpt, |
michael@0 | 2499 | NSSCertificate **rvOpt, |
michael@0 | 2500 | PRUint32 rvLimit, /* zero for no limit */ |
michael@0 | 2501 | NSSArena *arenaOpt |
michael@0 | 2502 | ); |
michael@0 | 2503 | |
michael@0 | 2504 | /* |
michael@0 | 2505 | * NSSCryptoContext_FindBestUserCertificateForEmailSigning |
michael@0 | 2506 | * |
michael@0 | 2507 | */ |
michael@0 | 2508 | |
michael@0 | 2509 | NSS_EXTERN NSSCertificate * |
michael@0 | 2510 | NSSCryptoContext_FindBestUserCertificateForEmailSigning |
michael@0 | 2511 | ( |
michael@0 | 2512 | NSSCryptoContext *cc, |
michael@0 | 2513 | NSSASCII7 *signerOpt, |
michael@0 | 2514 | NSSASCII7 *recipientOpt, |
michael@0 | 2515 | /* anything more here? */ |
michael@0 | 2516 | NSSAlgorithmAndParameters *apOpt, |
michael@0 | 2517 | NSSPolicies *policiesOpt |
michael@0 | 2518 | ); |
michael@0 | 2519 | |
michael@0 | 2520 | /* |
michael@0 | 2521 | * NSSCryptoContext_FindUserCertificatesForEmailSigning |
michael@0 | 2522 | * |
michael@0 | 2523 | */ |
michael@0 | 2524 | |
michael@0 | 2525 | NSS_EXTERN NSSCertificate * |
michael@0 | 2526 | NSSCryptoContext_FindUserCertificatesForEmailSigning |
michael@0 | 2527 | ( |
michael@0 | 2528 | NSSCryptoContext *cc, |
michael@0 | 2529 | NSSASCII7 *signerOpt, /* fgmr or a more general name? */ |
michael@0 | 2530 | NSSASCII7 *recipientOpt, |
michael@0 | 2531 | /* anything more here? */ |
michael@0 | 2532 | NSSAlgorithmAndParameters *apOpt, |
michael@0 | 2533 | NSSPolicies *policiesOpt, |
michael@0 | 2534 | NSSCertificate **rvOpt, |
michael@0 | 2535 | PRUint32 rvLimit, /* zero for no limit */ |
michael@0 | 2536 | NSSArena *arenaOpt |
michael@0 | 2537 | ); |
michael@0 | 2538 | |
michael@0 | 2539 | /* Private Keys */ |
michael@0 | 2540 | |
michael@0 | 2541 | /* |
michael@0 | 2542 | * NSSCryptoContext_GenerateKeyPair |
michael@0 | 2543 | * |
michael@0 | 2544 | * Creates session objects. If you want persistant objects, use |
michael@0 | 2545 | * NSSTrustDomain_GenerateKeyPair. The destination token is where |
michael@0 | 2546 | * the keys are stored. If that token can do the required math, then |
michael@0 | 2547 | * that's where the keys are generated too. Otherwise, the keys are |
michael@0 | 2548 | * generated elsewhere and moved to that token. |
michael@0 | 2549 | */ |
michael@0 | 2550 | |
michael@0 | 2551 | NSS_EXTERN PRStatus |
michael@0 | 2552 | NSSCryptoContext_GenerateKeyPair |
michael@0 | 2553 | ( |
michael@0 | 2554 | NSSCryptoContext *cc, |
michael@0 | 2555 | NSSAlgorithmAndParameters *ap, |
michael@0 | 2556 | NSSPrivateKey **pvkOpt, |
michael@0 | 2557 | NSSPublicKey **pbkOpt, |
michael@0 | 2558 | PRBool privateKeyIsSensitive, |
michael@0 | 2559 | NSSToken *destination, |
michael@0 | 2560 | NSSCallback *uhhOpt |
michael@0 | 2561 | ); |
michael@0 | 2562 | |
michael@0 | 2563 | /* |
michael@0 | 2564 | * NSSCryptoContext_TraversePrivateKeys |
michael@0 | 2565 | * |
michael@0 | 2566 | * |
michael@0 | 2567 | * NSS_EXTERN PRStatus * |
michael@0 | 2568 | * NSSCryptoContext_TraversePrivateKeys |
michael@0 | 2569 | * ( |
michael@0 | 2570 | * NSSCryptoContext *cc, |
michael@0 | 2571 | * PRStatus (*callback)(NSSPrivateKey *vk, void *arg), |
michael@0 | 2572 | * void *arg |
michael@0 | 2573 | * ); |
michael@0 | 2574 | */ |
michael@0 | 2575 | |
michael@0 | 2576 | /* Symmetric Keys */ |
michael@0 | 2577 | |
michael@0 | 2578 | /* |
michael@0 | 2579 | * NSSCryptoContext_GenerateSymmetricKey |
michael@0 | 2580 | * |
michael@0 | 2581 | */ |
michael@0 | 2582 | |
michael@0 | 2583 | NSS_EXTERN NSSSymmetricKey * |
michael@0 | 2584 | NSSCryptoContext_GenerateSymmetricKey |
michael@0 | 2585 | ( |
michael@0 | 2586 | NSSCryptoContext *cc, |
michael@0 | 2587 | NSSAlgorithmAndParameters *ap, |
michael@0 | 2588 | PRUint32 keysize, |
michael@0 | 2589 | NSSToken *destination, |
michael@0 | 2590 | NSSCallback *uhhOpt |
michael@0 | 2591 | ); |
michael@0 | 2592 | |
michael@0 | 2593 | /* |
michael@0 | 2594 | * NSSCryptoContext_GenerateSymmetricKeyFromPassword |
michael@0 | 2595 | * |
michael@0 | 2596 | */ |
michael@0 | 2597 | |
michael@0 | 2598 | NSS_EXTERN NSSSymmetricKey * |
michael@0 | 2599 | NSSCryptoContext_GenerateSymmetricKeyFromPassword |
michael@0 | 2600 | ( |
michael@0 | 2601 | NSSCryptoContext *cc, |
michael@0 | 2602 | NSSAlgorithmAndParameters *ap, |
michael@0 | 2603 | NSSUTF8 *passwordOpt, /* if null, prompt */ |
michael@0 | 2604 | NSSToken *destinationOpt, |
michael@0 | 2605 | NSSCallback *uhhOpt |
michael@0 | 2606 | ); |
michael@0 | 2607 | |
michael@0 | 2608 | /* |
michael@0 | 2609 | * NSSCryptoContext_FindSymmetricKeyByAlgorithm |
michael@0 | 2610 | * |
michael@0 | 2611 | * |
michael@0 | 2612 | * NSS_EXTERN NSSSymmetricKey * |
michael@0 | 2613 | * NSSCryptoContext_FindSymmetricKeyByType |
michael@0 | 2614 | * ( |
michael@0 | 2615 | * NSSCryptoContext *cc, |
michael@0 | 2616 | * NSSOID *type, |
michael@0 | 2617 | * NSSCallback *uhhOpt |
michael@0 | 2618 | * ); |
michael@0 | 2619 | */ |
michael@0 | 2620 | |
michael@0 | 2621 | /* |
michael@0 | 2622 | * NSSCryptoContext_FindSymmetricKeyByAlgorithmAndKeyID |
michael@0 | 2623 | * |
michael@0 | 2624 | */ |
michael@0 | 2625 | |
michael@0 | 2626 | NSS_EXTERN NSSSymmetricKey * |
michael@0 | 2627 | NSSCryptoContext_FindSymmetricKeyByAlgorithmAndKeyID |
michael@0 | 2628 | ( |
michael@0 | 2629 | NSSCryptoContext *cc, |
michael@0 | 2630 | NSSOID *algorithm, |
michael@0 | 2631 | NSSItem *keyID, |
michael@0 | 2632 | NSSCallback *uhhOpt |
michael@0 | 2633 | ); |
michael@0 | 2634 | |
michael@0 | 2635 | /* |
michael@0 | 2636 | * NSSCryptoContext_TraverseSymmetricKeys |
michael@0 | 2637 | * |
michael@0 | 2638 | * |
michael@0 | 2639 | * NSS_EXTERN PRStatus * |
michael@0 | 2640 | * NSSCryptoContext_TraverseSymmetricKeys |
michael@0 | 2641 | * ( |
michael@0 | 2642 | * NSSCryptoContext *cc, |
michael@0 | 2643 | * PRStatus (*callback)(NSSSymmetricKey *mk, void *arg), |
michael@0 | 2644 | * void *arg |
michael@0 | 2645 | * ); |
michael@0 | 2646 | */ |
michael@0 | 2647 | |
michael@0 | 2648 | /* Crypto ops on distinguished keys */ |
michael@0 | 2649 | |
michael@0 | 2650 | /* |
michael@0 | 2651 | * NSSCryptoContext_Decrypt |
michael@0 | 2652 | * |
michael@0 | 2653 | */ |
michael@0 | 2654 | |
michael@0 | 2655 | NSS_EXTERN NSSItem * |
michael@0 | 2656 | NSSCryptoContext_Decrypt |
michael@0 | 2657 | ( |
michael@0 | 2658 | NSSCryptoContext *cc, |
michael@0 | 2659 | NSSAlgorithmAndParameters *apOpt, |
michael@0 | 2660 | NSSItem *encryptedData, |
michael@0 | 2661 | NSSCallback *uhhOpt, |
michael@0 | 2662 | NSSItem *rvOpt, |
michael@0 | 2663 | NSSArena *arenaOpt |
michael@0 | 2664 | ); |
michael@0 | 2665 | |
michael@0 | 2666 | /* |
michael@0 | 2667 | * NSSCryptoContext_BeginDecrypt |
michael@0 | 2668 | * |
michael@0 | 2669 | */ |
michael@0 | 2670 | |
michael@0 | 2671 | NSS_EXTERN PRStatus |
michael@0 | 2672 | NSSCryptoContext_BeginDecrypt |
michael@0 | 2673 | ( |
michael@0 | 2674 | NSSCryptoContext *cc, |
michael@0 | 2675 | NSSAlgorithmAndParameters *apOpt, |
michael@0 | 2676 | NSSCallback *uhhOpt |
michael@0 | 2677 | ); |
michael@0 | 2678 | |
michael@0 | 2679 | /* |
michael@0 | 2680 | * NSSCryptoContext_ContinueDecrypt |
michael@0 | 2681 | * |
michael@0 | 2682 | */ |
michael@0 | 2683 | |
michael@0 | 2684 | /* |
michael@0 | 2685 | * NSSItem semantics: |
michael@0 | 2686 | * |
michael@0 | 2687 | * If rvOpt is NULL, a new NSSItem and buffer are allocated. |
michael@0 | 2688 | * If rvOpt is not null, but the buffer pointer is null, |
michael@0 | 2689 | * then rvOpt is returned but a new buffer is allocated. |
michael@0 | 2690 | * In this case, if the length value is not zero, then |
michael@0 | 2691 | * no more than that much space will be allocated. |
michael@0 | 2692 | * If rvOpt is not null and the buffer pointer is not null, |
michael@0 | 2693 | * then that buffer is re-used. No more than the buffer |
michael@0 | 2694 | * length value will be used; if it's not enough, an |
michael@0 | 2695 | * error is returned. If less is used, the number is |
michael@0 | 2696 | * adjusted downwards. |
michael@0 | 2697 | * |
michael@0 | 2698 | * Note that although this is short of some ideal "Item" |
michael@0 | 2699 | * definition, we can usually tell how big these buffers |
michael@0 | 2700 | * have to be. |
michael@0 | 2701 | * |
michael@0 | 2702 | * Feedback is requested; and earlier is better than later. |
michael@0 | 2703 | */ |
michael@0 | 2704 | |
michael@0 | 2705 | NSS_EXTERN NSSItem * |
michael@0 | 2706 | NSSCryptoContext_ContinueDecrypt |
michael@0 | 2707 | ( |
michael@0 | 2708 | NSSCryptoContext *cc, |
michael@0 | 2709 | NSSItem *data, |
michael@0 | 2710 | NSSItem *rvOpt, |
michael@0 | 2711 | NSSArena *arenaOpt |
michael@0 | 2712 | ); |
michael@0 | 2713 | |
michael@0 | 2714 | /* |
michael@0 | 2715 | * NSSCryptoContext_FinishDecrypt |
michael@0 | 2716 | * |
michael@0 | 2717 | */ |
michael@0 | 2718 | |
michael@0 | 2719 | NSS_EXTERN NSSItem * |
michael@0 | 2720 | NSSCryptoContext_FinishDecrypt |
michael@0 | 2721 | ( |
michael@0 | 2722 | NSSCryptoContext *cc, |
michael@0 | 2723 | NSSItem *rvOpt, |
michael@0 | 2724 | NSSArena *arenaOpt |
michael@0 | 2725 | ); |
michael@0 | 2726 | |
michael@0 | 2727 | /* |
michael@0 | 2728 | * NSSCryptoContext_Sign |
michael@0 | 2729 | * |
michael@0 | 2730 | */ |
michael@0 | 2731 | |
michael@0 | 2732 | NSS_EXTERN NSSItem * |
michael@0 | 2733 | NSSCryptoContext_Sign |
michael@0 | 2734 | ( |
michael@0 | 2735 | NSSCryptoContext *cc, |
michael@0 | 2736 | NSSAlgorithmAndParameters *apOpt, |
michael@0 | 2737 | NSSItem *data, |
michael@0 | 2738 | NSSCallback *uhhOpt, |
michael@0 | 2739 | NSSItem *rvOpt, |
michael@0 | 2740 | NSSArena *arenaOpt |
michael@0 | 2741 | ); |
michael@0 | 2742 | |
michael@0 | 2743 | /* |
michael@0 | 2744 | * NSSCryptoContext_BeginSign |
michael@0 | 2745 | * |
michael@0 | 2746 | */ |
michael@0 | 2747 | |
michael@0 | 2748 | NSS_EXTERN PRStatus |
michael@0 | 2749 | NSSCryptoContext_BeginSign |
michael@0 | 2750 | ( |
michael@0 | 2751 | NSSCryptoContext *cc, |
michael@0 | 2752 | NSSAlgorithmAndParameters *apOpt, |
michael@0 | 2753 | NSSCallback *uhhOpt |
michael@0 | 2754 | ); |
michael@0 | 2755 | |
michael@0 | 2756 | /* |
michael@0 | 2757 | * NSSCryptoContext_ContinueSign |
michael@0 | 2758 | * |
michael@0 | 2759 | */ |
michael@0 | 2760 | |
michael@0 | 2761 | NSS_EXTERN PRStatus |
michael@0 | 2762 | NSSCryptoContext_ContinueSign |
michael@0 | 2763 | ( |
michael@0 | 2764 | NSSCryptoContext *cc, |
michael@0 | 2765 | NSSItem *data |
michael@0 | 2766 | ); |
michael@0 | 2767 | |
michael@0 | 2768 | /* |
michael@0 | 2769 | * NSSCryptoContext_FinishSign |
michael@0 | 2770 | * |
michael@0 | 2771 | */ |
michael@0 | 2772 | |
michael@0 | 2773 | NSS_EXTERN NSSItem * |
michael@0 | 2774 | NSSCryptoContext_FinishSign |
michael@0 | 2775 | ( |
michael@0 | 2776 | NSSCryptoContext *cc, |
michael@0 | 2777 | NSSItem *rvOpt, |
michael@0 | 2778 | NSSArena *arenaOpt |
michael@0 | 2779 | ); |
michael@0 | 2780 | |
michael@0 | 2781 | /* |
michael@0 | 2782 | * NSSCryptoContext_SignRecover |
michael@0 | 2783 | * |
michael@0 | 2784 | */ |
michael@0 | 2785 | |
michael@0 | 2786 | NSS_EXTERN NSSItem * |
michael@0 | 2787 | NSSCryptoContext_SignRecover |
michael@0 | 2788 | ( |
michael@0 | 2789 | NSSCryptoContext *cc, |
michael@0 | 2790 | NSSAlgorithmAndParameters *apOpt, |
michael@0 | 2791 | NSSItem *data, |
michael@0 | 2792 | NSSCallback *uhhOpt, |
michael@0 | 2793 | NSSItem *rvOpt, |
michael@0 | 2794 | NSSArena *arenaOpt |
michael@0 | 2795 | ); |
michael@0 | 2796 | |
michael@0 | 2797 | /* |
michael@0 | 2798 | * NSSCryptoContext_BeginSignRecover |
michael@0 | 2799 | * |
michael@0 | 2800 | */ |
michael@0 | 2801 | |
michael@0 | 2802 | NSS_EXTERN PRStatus |
michael@0 | 2803 | NSSCryptoContext_BeginSignRecover |
michael@0 | 2804 | ( |
michael@0 | 2805 | NSSCryptoContext *cc, |
michael@0 | 2806 | NSSAlgorithmAndParameters *apOpt, |
michael@0 | 2807 | NSSCallback *uhhOpt |
michael@0 | 2808 | ); |
michael@0 | 2809 | |
michael@0 | 2810 | /* |
michael@0 | 2811 | * NSSCryptoContext_ContinueSignRecover |
michael@0 | 2812 | * |
michael@0 | 2813 | */ |
michael@0 | 2814 | |
michael@0 | 2815 | NSS_EXTERN NSSItem * |
michael@0 | 2816 | NSSCryptoContext_ContinueSignRecover |
michael@0 | 2817 | ( |
michael@0 | 2818 | NSSCryptoContext *cc, |
michael@0 | 2819 | NSSItem *data, |
michael@0 | 2820 | NSSItem *rvOpt, |
michael@0 | 2821 | NSSArena *arenaOpt |
michael@0 | 2822 | ); |
michael@0 | 2823 | |
michael@0 | 2824 | /* |
michael@0 | 2825 | * NSSCryptoContext_FinishSignRecover |
michael@0 | 2826 | * |
michael@0 | 2827 | */ |
michael@0 | 2828 | |
michael@0 | 2829 | NSS_EXTERN NSSItem * |
michael@0 | 2830 | NSSCryptoContext_FinishSignRecover |
michael@0 | 2831 | ( |
michael@0 | 2832 | NSSCryptoContext *cc, |
michael@0 | 2833 | NSSItem *rvOpt, |
michael@0 | 2834 | NSSArena *arenaOpt |
michael@0 | 2835 | ); |
michael@0 | 2836 | |
michael@0 | 2837 | /* |
michael@0 | 2838 | * NSSCryptoContext_UnwrapSymmetricKey |
michael@0 | 2839 | * |
michael@0 | 2840 | */ |
michael@0 | 2841 | |
michael@0 | 2842 | NSS_EXTERN NSSSymmetricKey * |
michael@0 | 2843 | NSSCryptoContext_UnwrapSymmetricKey |
michael@0 | 2844 | ( |
michael@0 | 2845 | NSSCryptoContext *cc, |
michael@0 | 2846 | NSSAlgorithmAndParameters *apOpt, |
michael@0 | 2847 | NSSItem *wrappedKey, |
michael@0 | 2848 | NSSCallback *uhhOpt |
michael@0 | 2849 | ); |
michael@0 | 2850 | |
michael@0 | 2851 | /* |
michael@0 | 2852 | * NSSCryptoContext_DeriveSymmetricKey |
michael@0 | 2853 | * |
michael@0 | 2854 | */ |
michael@0 | 2855 | |
michael@0 | 2856 | NSS_EXTERN NSSSymmetricKey * |
michael@0 | 2857 | NSSCryptoContext_DeriveSymmetricKey |
michael@0 | 2858 | ( |
michael@0 | 2859 | NSSCryptoContext *cc, |
michael@0 | 2860 | NSSPublicKey *bk, |
michael@0 | 2861 | NSSAlgorithmAndParameters *apOpt, |
michael@0 | 2862 | NSSOID *target, |
michael@0 | 2863 | PRUint32 keySizeOpt, /* zero for best allowed */ |
michael@0 | 2864 | NSSOperations operations, |
michael@0 | 2865 | NSSCallback *uhhOpt |
michael@0 | 2866 | ); |
michael@0 | 2867 | |
michael@0 | 2868 | /* |
michael@0 | 2869 | * NSSCryptoContext_Encrypt |
michael@0 | 2870 | * |
michael@0 | 2871 | * Encrypt a single chunk of data with the distinguished public key |
michael@0 | 2872 | * of this crypto context. |
michael@0 | 2873 | */ |
michael@0 | 2874 | |
michael@0 | 2875 | NSS_EXTERN NSSItem * |
michael@0 | 2876 | NSSCryptoContext_Encrypt |
michael@0 | 2877 | ( |
michael@0 | 2878 | NSSCryptoContext *cc, |
michael@0 | 2879 | NSSAlgorithmAndParameters *apOpt, |
michael@0 | 2880 | NSSItem *data, |
michael@0 | 2881 | NSSCallback *uhhOpt, |
michael@0 | 2882 | NSSItem *rvOpt, |
michael@0 | 2883 | NSSArena *arenaOpt |
michael@0 | 2884 | ); |
michael@0 | 2885 | |
michael@0 | 2886 | /* |
michael@0 | 2887 | * NSSCryptoContext_BeginEncrypt |
michael@0 | 2888 | * |
michael@0 | 2889 | */ |
michael@0 | 2890 | |
michael@0 | 2891 | NSS_EXTERN PRStatus |
michael@0 | 2892 | NSSCryptoContext_BeginEncrypt |
michael@0 | 2893 | ( |
michael@0 | 2894 | NSSCryptoContext *cc, |
michael@0 | 2895 | NSSAlgorithmAndParameters *apOpt, |
michael@0 | 2896 | NSSCallback *uhhOpt |
michael@0 | 2897 | ); |
michael@0 | 2898 | |
michael@0 | 2899 | /* |
michael@0 | 2900 | * NSSCryptoContext_ContinueEncrypt |
michael@0 | 2901 | * |
michael@0 | 2902 | */ |
michael@0 | 2903 | |
michael@0 | 2904 | NSS_EXTERN NSSItem * |
michael@0 | 2905 | NSSCryptoContext_ContinueEncrypt |
michael@0 | 2906 | ( |
michael@0 | 2907 | NSSCryptoContext *cc, |
michael@0 | 2908 | NSSItem *data, |
michael@0 | 2909 | NSSItem *rvOpt, |
michael@0 | 2910 | NSSArena *arenaOpt |
michael@0 | 2911 | ); |
michael@0 | 2912 | |
michael@0 | 2913 | /* |
michael@0 | 2914 | * NSSCryptoContext_FinishEncrypt |
michael@0 | 2915 | * |
michael@0 | 2916 | */ |
michael@0 | 2917 | |
michael@0 | 2918 | NSS_EXTERN NSSItem * |
michael@0 | 2919 | NSSCryptoContext_FinishEncrypt |
michael@0 | 2920 | ( |
michael@0 | 2921 | NSSCryptoContext *cc, |
michael@0 | 2922 | NSSItem *rvOpt, |
michael@0 | 2923 | NSSArena *arenaOpt |
michael@0 | 2924 | ); |
michael@0 | 2925 | |
michael@0 | 2926 | /* |
michael@0 | 2927 | * NSSCryptoContext_Verify |
michael@0 | 2928 | * |
michael@0 | 2929 | */ |
michael@0 | 2930 | |
michael@0 | 2931 | NSS_EXTERN PRStatus |
michael@0 | 2932 | NSSCryptoContext_Verify |
michael@0 | 2933 | ( |
michael@0 | 2934 | NSSCryptoContext *cc, |
michael@0 | 2935 | NSSAlgorithmAndParameters *apOpt, |
michael@0 | 2936 | NSSItem *data, |
michael@0 | 2937 | NSSItem *signature, |
michael@0 | 2938 | NSSCallback *uhhOpt |
michael@0 | 2939 | ); |
michael@0 | 2940 | |
michael@0 | 2941 | /* |
michael@0 | 2942 | * NSSCryptoContext_BeginVerify |
michael@0 | 2943 | * |
michael@0 | 2944 | */ |
michael@0 | 2945 | |
michael@0 | 2946 | NSS_EXTERN PRStatus |
michael@0 | 2947 | NSSCryptoContext_BeginVerify |
michael@0 | 2948 | ( |
michael@0 | 2949 | NSSCryptoContext *cc, |
michael@0 | 2950 | NSSAlgorithmAndParameters *apOpt, |
michael@0 | 2951 | NSSItem *signature, |
michael@0 | 2952 | NSSCallback *uhhOpt |
michael@0 | 2953 | ); |
michael@0 | 2954 | |
michael@0 | 2955 | /* |
michael@0 | 2956 | * NSSCryptoContext_ContinueVerify |
michael@0 | 2957 | * |
michael@0 | 2958 | */ |
michael@0 | 2959 | |
michael@0 | 2960 | NSS_EXTERN PRStatus |
michael@0 | 2961 | NSSCryptoContext_ContinueVerify |
michael@0 | 2962 | ( |
michael@0 | 2963 | NSSCryptoContext *cc, |
michael@0 | 2964 | NSSItem *data |
michael@0 | 2965 | ); |
michael@0 | 2966 | |
michael@0 | 2967 | /* |
michael@0 | 2968 | * NSSCryptoContext_FinishVerify |
michael@0 | 2969 | * |
michael@0 | 2970 | */ |
michael@0 | 2971 | |
michael@0 | 2972 | NSS_EXTERN PRStatus |
michael@0 | 2973 | NSSCryptoContext_FinishVerify |
michael@0 | 2974 | ( |
michael@0 | 2975 | NSSCryptoContext *cc |
michael@0 | 2976 | ); |
michael@0 | 2977 | |
michael@0 | 2978 | /* |
michael@0 | 2979 | * NSSCryptoContext_VerifyRecover |
michael@0 | 2980 | * |
michael@0 | 2981 | */ |
michael@0 | 2982 | |
michael@0 | 2983 | NSS_EXTERN NSSItem * |
michael@0 | 2984 | NSSCryptoContext_VerifyRecover |
michael@0 | 2985 | ( |
michael@0 | 2986 | NSSCryptoContext *cc, |
michael@0 | 2987 | NSSAlgorithmAndParameters *apOpt, |
michael@0 | 2988 | NSSItem *signature, |
michael@0 | 2989 | NSSCallback *uhhOpt, |
michael@0 | 2990 | NSSItem *rvOpt, |
michael@0 | 2991 | NSSArena *arenaOpt |
michael@0 | 2992 | ); |
michael@0 | 2993 | |
michael@0 | 2994 | /* |
michael@0 | 2995 | * NSSCryptoContext_BeginVerifyRecover |
michael@0 | 2996 | * |
michael@0 | 2997 | */ |
michael@0 | 2998 | |
michael@0 | 2999 | NSS_EXTERN PRStatus |
michael@0 | 3000 | NSSCryptoContext_BeginVerifyRecover |
michael@0 | 3001 | ( |
michael@0 | 3002 | NSSCryptoContext *cc, |
michael@0 | 3003 | NSSAlgorithmAndParameters *apOpt, |
michael@0 | 3004 | NSSCallback *uhhOpt |
michael@0 | 3005 | ); |
michael@0 | 3006 | |
michael@0 | 3007 | /* |
michael@0 | 3008 | * NSSCryptoContext_ContinueVerifyRecover |
michael@0 | 3009 | * |
michael@0 | 3010 | */ |
michael@0 | 3011 | |
michael@0 | 3012 | NSS_EXTERN NSSItem * |
michael@0 | 3013 | NSSCryptoContext_ContinueVerifyRecover |
michael@0 | 3014 | ( |
michael@0 | 3015 | NSSCryptoContext *cc, |
michael@0 | 3016 | NSSItem *data, |
michael@0 | 3017 | NSSItem *rvOpt, |
michael@0 | 3018 | NSSArena *arenaOpt |
michael@0 | 3019 | ); |
michael@0 | 3020 | |
michael@0 | 3021 | /* |
michael@0 | 3022 | * NSSCryptoContext_FinishVerifyRecover |
michael@0 | 3023 | * |
michael@0 | 3024 | */ |
michael@0 | 3025 | |
michael@0 | 3026 | NSS_EXTERN NSSItem * |
michael@0 | 3027 | NSSCryptoContext_FinishVerifyRecover |
michael@0 | 3028 | ( |
michael@0 | 3029 | NSSCryptoContext *cc, |
michael@0 | 3030 | NSSItem *rvOpt, |
michael@0 | 3031 | NSSArena *arenaOpt |
michael@0 | 3032 | ); |
michael@0 | 3033 | |
michael@0 | 3034 | /* |
michael@0 | 3035 | * NSSCryptoContext_WrapSymmetricKey |
michael@0 | 3036 | * |
michael@0 | 3037 | */ |
michael@0 | 3038 | |
michael@0 | 3039 | NSS_EXTERN NSSItem * |
michael@0 | 3040 | NSSCryptoContext_WrapSymmetricKey |
michael@0 | 3041 | ( |
michael@0 | 3042 | NSSCryptoContext *cc, |
michael@0 | 3043 | NSSAlgorithmAndParameters *apOpt, |
michael@0 | 3044 | NSSSymmetricKey *keyToWrap, |
michael@0 | 3045 | NSSCallback *uhhOpt, |
michael@0 | 3046 | NSSItem *rvOpt, |
michael@0 | 3047 | NSSArena *arenaOpt |
michael@0 | 3048 | ); |
michael@0 | 3049 | |
michael@0 | 3050 | /* |
michael@0 | 3051 | * NSSCryptoContext_Digest |
michael@0 | 3052 | * |
michael@0 | 3053 | * Digest a single chunk of data with the distinguished digest key |
michael@0 | 3054 | * of this crypto context. |
michael@0 | 3055 | */ |
michael@0 | 3056 | |
michael@0 | 3057 | NSS_EXTERN NSSItem * |
michael@0 | 3058 | NSSCryptoContext_Digest |
michael@0 | 3059 | ( |
michael@0 | 3060 | NSSCryptoContext *cc, |
michael@0 | 3061 | NSSAlgorithmAndParameters *apOpt, |
michael@0 | 3062 | NSSItem *data, |
michael@0 | 3063 | NSSCallback *uhhOpt, |
michael@0 | 3064 | NSSItem *rvOpt, |
michael@0 | 3065 | NSSArena *arenaOpt |
michael@0 | 3066 | ); |
michael@0 | 3067 | |
michael@0 | 3068 | /* |
michael@0 | 3069 | * NSSCryptoContext_BeginDigest |
michael@0 | 3070 | * |
michael@0 | 3071 | */ |
michael@0 | 3072 | |
michael@0 | 3073 | NSS_EXTERN PRStatus |
michael@0 | 3074 | NSSCryptoContext_BeginDigest |
michael@0 | 3075 | ( |
michael@0 | 3076 | NSSCryptoContext *cc, |
michael@0 | 3077 | NSSAlgorithmAndParameters *apOpt, |
michael@0 | 3078 | NSSCallback *uhhOpt |
michael@0 | 3079 | ); |
michael@0 | 3080 | |
michael@0 | 3081 | /* |
michael@0 | 3082 | * NSSCryptoContext_ContinueDigest |
michael@0 | 3083 | * |
michael@0 | 3084 | */ |
michael@0 | 3085 | |
michael@0 | 3086 | NSS_EXTERN PRStatus |
michael@0 | 3087 | NSSCryptoContext_ContinueDigest |
michael@0 | 3088 | ( |
michael@0 | 3089 | NSSCryptoContext *cc, |
michael@0 | 3090 | NSSAlgorithmAndParameters *apOpt, |
michael@0 | 3091 | NSSItem *item |
michael@0 | 3092 | ); |
michael@0 | 3093 | |
michael@0 | 3094 | /* |
michael@0 | 3095 | * NSSCryptoContext_FinishDigest |
michael@0 | 3096 | * |
michael@0 | 3097 | */ |
michael@0 | 3098 | |
michael@0 | 3099 | NSS_EXTERN NSSItem * |
michael@0 | 3100 | NSSCryptoContext_FinishDigest |
michael@0 | 3101 | ( |
michael@0 | 3102 | NSSCryptoContext *cc, |
michael@0 | 3103 | NSSItem *rvOpt, |
michael@0 | 3104 | NSSArena *arenaOpt |
michael@0 | 3105 | ); |
michael@0 | 3106 | |
michael@0 | 3107 | /* |
michael@0 | 3108 | * tbd: Combination ops |
michael@0 | 3109 | */ |
michael@0 | 3110 | |
michael@0 | 3111 | /* |
michael@0 | 3112 | * NSSCryptoContext_Clone |
michael@0 | 3113 | * |
michael@0 | 3114 | */ |
michael@0 | 3115 | |
michael@0 | 3116 | NSS_EXTERN NSSCryptoContext * |
michael@0 | 3117 | NSSCryptoContext_Clone |
michael@0 | 3118 | ( |
michael@0 | 3119 | NSSCryptoContext *cc |
michael@0 | 3120 | ); |
michael@0 | 3121 | |
michael@0 | 3122 | /* |
michael@0 | 3123 | * NSSCryptoContext_Save |
michael@0 | 3124 | * NSSCryptoContext_Restore |
michael@0 | 3125 | * |
michael@0 | 3126 | * We need to be able to save and restore the state of contexts. |
michael@0 | 3127 | * Perhaps a mark-and-release mechanism would be better? |
michael@0 | 3128 | */ |
michael@0 | 3129 | |
michael@0 | 3130 | /* |
michael@0 | 3131 | * ..._SignTBSCertificate |
michael@0 | 3132 | * |
michael@0 | 3133 | * This requires feedback from the cert server team. |
michael@0 | 3134 | */ |
michael@0 | 3135 | |
michael@0 | 3136 | /* |
michael@0 | 3137 | * PRBool NSSCertificate_GetIsTrustedFor{xxx}(NSSCertificate *c); |
michael@0 | 3138 | * PRStatus NSSCertificate_SetIsTrustedFor{xxx}(NSSCertificate *c, PRBool trusted); |
michael@0 | 3139 | * |
michael@0 | 3140 | * These will be helper functions which get the trust object for a cert, |
michael@0 | 3141 | * and then call the corresponding function(s) on it. |
michael@0 | 3142 | * |
michael@0 | 3143 | * PKIX trust objects will have methods to manipulate the low-level trust |
michael@0 | 3144 | * bits (which are based on key usage and extended key usage), and also the |
michael@0 | 3145 | * conceptual high-level usages (e.g. ssl client auth, email encryption, etc.) |
michael@0 | 3146 | * |
michael@0 | 3147 | * Other types of trust objects (if any) might have different low-level |
michael@0 | 3148 | * representations, but hopefully high-level concepts would map. |
michael@0 | 3149 | * |
michael@0 | 3150 | * Only these high-level general routines would be promoted to the |
michael@0 | 3151 | * general certificate level here. Hence the {xxx} above would be things |
michael@0 | 3152 | * like "EmailSigning." |
michael@0 | 3153 | * |
michael@0 | 3154 | * |
michael@0 | 3155 | * NSSPKIXTrust *NSSCertificate_GetPKIXTrustObject(NSSCertificate *c); |
michael@0 | 3156 | * PRStatus NSSCertificate_SetPKIXTrustObject(NSSCertificate *c, NSPKIXTrust *t); |
michael@0 | 3157 | * |
michael@0 | 3158 | * I want to hold off on any general trust object until we've investigated |
michael@0 | 3159 | * other models more thoroughly. |
michael@0 | 3160 | */ |
michael@0 | 3161 | |
michael@0 | 3162 | PR_END_EXTERN_C |
michael@0 | 3163 | |
michael@0 | 3164 | #endif /* NSSPKI_H */ |