Back to index

lightning-sunbird  0.9+nobinonly
cryptocontext.c
Go to the documentation of this file.
00001 /* ***** BEGIN LICENSE BLOCK *****
00002  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
00003  *
00004  * The contents of this file are subject to the Mozilla Public License Version
00005  * 1.1 (the "License"); you may not use this file except in compliance with
00006  * the License. You may obtain a copy of the License at
00007  * http://www.mozilla.org/MPL/
00008  *
00009  * Software distributed under the License is distributed on an "AS IS" basis,
00010  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00011  * for the specific language governing rights and limitations under the
00012  * License.
00013  *
00014  * The Original Code is the Netscape security libraries.
00015  *
00016  * The Initial Developer of the Original Code is
00017  * Netscape Communications Corporation.
00018  * Portions created by the Initial Developer are Copyright (C) 1994-2000
00019  * the Initial Developer. All Rights Reserved.
00020  *
00021  * Contributor(s):
00022  *
00023  * Alternatively, the contents of this file may be used under the terms of
00024  * either the GNU General Public License Version 2 or later (the "GPL"), or
00025  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
00026  * in which case the provisions of the GPL or the LGPL are applicable instead
00027  * of those above. If you wish to allow use of your version of this file only
00028  * under the terms of either the GPL or the LGPL, and not to allow others to
00029  * use your version of this file under the terms of the MPL, indicate your
00030  * decision by deleting the provisions above and replace them with the notice
00031  * and other provisions required by the GPL or the LGPL. If you do not delete
00032  * the provisions above, a recipient may use your version of this file under
00033  * the terms of any one of the MPL, the GPL or the LGPL.
00034  *
00035  * ***** END LICENSE BLOCK ***** */
00036 
00037 #ifdef DEBUG
00038 static const char CVS_ID[] = "@(#) $RCSfile: cryptocontext.c,v $ $Revision: 1.14.28.3 $ $Date: 2007/11/16 05:25:08 $";
00039 #endif /* DEBUG */
00040 
00041 #ifndef DEV_H
00042 #include "dev.h"
00043 #endif /* DEV_H */
00044 
00045 #ifndef PKIM_H
00046 #include "pkim.h"
00047 #endif /* PKIM_H */
00048 
00049 #ifndef PKISTORE_H
00050 #include "pkistore.h"
00051 #endif /* PKISTORE_H */
00052 
00053 #include "pki1t.h"
00054 
00055 extern const NSSError NSS_ERROR_NOT_FOUND;
00056 extern const NSSError NSS_ERROR_INVALID_ARGUMENT;
00057 
00058 NSS_IMPLEMENT NSSCryptoContext *
00059 nssCryptoContext_Create (
00060   NSSTrustDomain *td,
00061   NSSCallback *uhhOpt
00062 )
00063 {
00064     NSSArena *arena;
00065     NSSCryptoContext *rvCC;
00066     arena = NSSArena_Create();
00067     if (!arena) {
00068        return NULL;
00069     }
00070     rvCC = nss_ZNEW(arena, NSSCryptoContext);
00071     if (!rvCC) {
00072        return NULL;
00073     }
00074     rvCC->td = td;
00075     rvCC->arena = arena;
00076     rvCC->certStore = nssCertificateStore_Create(rvCC->arena);
00077     if (!rvCC->certStore) {
00078        nssArena_Destroy(arena);
00079        return NULL;
00080     }
00081 
00082     return rvCC;
00083 }
00084 
00085 NSS_IMPLEMENT PRStatus
00086 NSSCryptoContext_Destroy (
00087   NSSCryptoContext *cc
00088 )
00089 {
00090     PRStatus status = PR_SUCCESS;
00091     PORT_Assert(cc->certStore);
00092     if (cc->certStore) {
00093        status = nssCertificateStore_Destroy(cc->certStore);
00094        if (status == PR_FAILURE) {
00095            return status;
00096        }
00097     } else {
00098        status = PR_FAILURE;
00099     }
00100     nssArena_Destroy(cc->arena);
00101     return status;
00102 }
00103 
00104 NSS_IMPLEMENT PRStatus
00105 NSSCryptoContext_SetDefaultCallback (
00106   NSSCryptoContext *td,
00107   NSSCallback *newCallback,
00108   NSSCallback **oldCallbackOpt
00109 )
00110 {
00111     nss_SetError(NSS_ERROR_NOT_FOUND);
00112     return PR_FAILURE;
00113 }
00114 
00115 NSS_IMPLEMENT NSSCallback *
00116 NSSCryptoContext_GetDefaultCallback (
00117   NSSCryptoContext *td,
00118   PRStatus *statusOpt
00119 )
00120 {
00121     nss_SetError(NSS_ERROR_NOT_FOUND);
00122     return NULL;
00123 }
00124 
00125 NSS_IMPLEMENT NSSTrustDomain *
00126 NSSCryptoContext_GetTrustDomain (
00127   NSSCryptoContext *td
00128 )
00129 {
00130     nss_SetError(NSS_ERROR_NOT_FOUND);
00131     return NULL;
00132 }
00133 
00134 
00135 NSS_IMPLEMENT NSSCertificate *
00136 NSSCryptoContext_FindOrImportCertificate (
00137   NSSCryptoContext *cc,
00138   NSSCertificate *c
00139 )
00140 {
00141     NSSCertificate *rvCert = NULL;
00142 
00143     PORT_Assert(cc->certStore);
00144     if (!cc->certStore) {
00145        nss_SetError(NSS_ERROR_INVALID_ARGUMENT);
00146        return rvCert;
00147     }
00148     rvCert = nssCertificateStore_FindOrAdd(cc->certStore, c);
00149     if (rvCert == c && c->object.cryptoContext != cc) {
00150        PORT_Assert(!c->object.cryptoContext);
00151        c->object.cryptoContext = cc;
00152     } 
00153     if (rvCert) {
00154        /* an NSSCertificate cannot be part of two crypto contexts
00155        ** simultaneously.  If this assertion fails, then there is 
00156        ** a serious Stan design flaw.
00157        */
00158        PORT_Assert(cc == c->object.cryptoContext);
00159     }
00160     return rvCert;
00161 }
00162 
00163 NSS_IMPLEMENT NSSCertificate *
00164 NSSCryptoContext_ImportPKIXCertificate (
00165   NSSCryptoContext *cc,
00166   struct NSSPKIXCertificateStr *pc
00167 )
00168 {
00169     nss_SetError(NSS_ERROR_NOT_FOUND);
00170     return NULL;
00171 }
00172 
00173 NSS_IMPLEMENT NSSCertificate *
00174 NSSCryptoContext_ImportEncodedCertificate (
00175   NSSCryptoContext *cc,
00176   NSSBER *ber
00177 )
00178 {
00179     nss_SetError(NSS_ERROR_NOT_FOUND);
00180     return NULL;
00181 }
00182 
00183 NSS_IMPLEMENT PRStatus
00184 NSSCryptoContext_ImportEncodedPKIXCertificateChain (
00185   NSSCryptoContext *cc,
00186   NSSBER *ber
00187 )
00188 {
00189     nss_SetError(NSS_ERROR_NOT_FOUND);
00190     return PR_FAILURE;
00191 }
00192 
00193 NSS_IMPLEMENT PRStatus
00194 nssCryptoContext_ImportTrust (
00195   NSSCryptoContext *cc,
00196   NSSTrust *trust
00197 )
00198 {
00199     PRStatus nssrv;
00200     PORT_Assert(cc->certStore);
00201     if (!cc->certStore) {
00202        return PR_FAILURE;
00203     }
00204     nssrv = nssCertificateStore_AddTrust(cc->certStore, trust);
00205 #if 0
00206     if (nssrv == PR_SUCCESS) {
00207        trust->object.cryptoContext = cc;
00208     }
00209 #endif
00210     return nssrv;
00211 }
00212 
00213 NSS_IMPLEMENT PRStatus
00214 nssCryptoContext_ImportSMIMEProfile (
00215   NSSCryptoContext *cc,
00216   nssSMIMEProfile *profile
00217 )
00218 {
00219     PRStatus nssrv;
00220     PORT_Assert(cc->certStore);
00221     if (!cc->certStore) {
00222        return PR_FAILURE;
00223     }
00224     nssrv = nssCertificateStore_AddSMIMEProfile(cc->certStore, profile);
00225 #if 0
00226     if (nssrv == PR_SUCCESS) {
00227        profile->object.cryptoContext = cc;
00228     }
00229 #endif
00230     return nssrv;
00231 }
00232 
00233 NSS_IMPLEMENT NSSCertificate *
00234 NSSCryptoContext_FindBestCertificateByNickname (
00235   NSSCryptoContext *cc,
00236   NSSUTF8 *name,
00237   NSSTime *timeOpt, /* NULL for "now" */
00238   NSSUsage *usage,
00239   NSSPolicies *policiesOpt /* NULL for none */
00240 )
00241 {
00242     NSSCertificate **certs;
00243     NSSCertificate *rvCert = NULL;
00244     PORT_Assert(cc->certStore);
00245     if (!cc->certStore) {
00246        return NULL;
00247     }
00248     certs = nssCertificateStore_FindCertificatesByNickname(cc->certStore,
00249                                                            name,
00250                                                            NULL, 0, NULL);
00251     if (certs) {
00252        rvCert = nssCertificateArray_FindBestCertificate(certs,
00253                                                         timeOpt,
00254                                                         usage,
00255                                                         policiesOpt);
00256        nssCertificateArray_Destroy(certs);
00257     }
00258     return rvCert;
00259 }
00260 
00261 NSS_IMPLEMENT NSSCertificate **
00262 NSSCryptoContext_FindCertificatesByNickname (
00263   NSSCryptoContext *cc,
00264   NSSUTF8 *name,
00265   NSSCertificate *rvOpt[],
00266   PRUint32 maximumOpt, /* 0 for no max */
00267   NSSArena *arenaOpt
00268 )
00269 {
00270     NSSCertificate **rvCerts;
00271     PORT_Assert(cc->certStore);
00272     if (!cc->certStore) {
00273        return NULL;
00274     }
00275     rvCerts = nssCertificateStore_FindCertificatesByNickname(cc->certStore,
00276                                                              name,
00277                                                              rvOpt,
00278                                                              maximumOpt,
00279                                                              arenaOpt);
00280     return rvCerts;
00281 }
00282 
00283 NSS_IMPLEMENT NSSCertificate *
00284 NSSCryptoContext_FindCertificateByIssuerAndSerialNumber (
00285   NSSCryptoContext *cc,
00286   NSSDER *issuer,
00287   NSSDER *serialNumber
00288 )
00289 {
00290     PORT_Assert(cc->certStore);
00291     if (!cc->certStore) {
00292        return NULL;
00293     }
00294     return nssCertificateStore_FindCertificateByIssuerAndSerialNumber(
00295                                                                cc->certStore,
00296                                                                issuer,
00297                                                                serialNumber);
00298 }
00299 
00300 NSS_IMPLEMENT NSSCertificate *
00301 NSSCryptoContext_FindBestCertificateBySubject (
00302   NSSCryptoContext *cc,
00303   NSSDER *subject,
00304   NSSTime *timeOpt,
00305   NSSUsage *usage,
00306   NSSPolicies *policiesOpt
00307 )
00308 {
00309     NSSCertificate **certs;
00310     NSSCertificate *rvCert = NULL;
00311     PORT_Assert(cc->certStore);
00312     if (!cc->certStore) {
00313        return NULL;
00314     }
00315     certs = nssCertificateStore_FindCertificatesBySubject(cc->certStore,
00316                                                           subject,
00317                                                           NULL, 0, NULL);
00318     if (certs) {
00319        rvCert = nssCertificateArray_FindBestCertificate(certs,
00320                                                         timeOpt,
00321                                                         usage,
00322                                                         policiesOpt);
00323        nssCertificateArray_Destroy(certs);
00324     }
00325     return rvCert;
00326 }
00327 
00328 NSS_IMPLEMENT NSSCertificate **
00329 nssCryptoContext_FindCertificatesBySubject (
00330   NSSCryptoContext *cc,
00331   NSSDER *subject,
00332   NSSCertificate *rvOpt[],
00333   PRUint32 maximumOpt, /* 0 for no max */
00334   NSSArena *arenaOpt
00335 )
00336 {
00337     NSSCertificate **rvCerts;
00338     PORT_Assert(cc->certStore);
00339     if (!cc->certStore) {
00340        return NULL;
00341     }
00342     rvCerts = nssCertificateStore_FindCertificatesBySubject(cc->certStore,
00343                                                             subject,
00344                                                             rvOpt,
00345                                                             maximumOpt,
00346                                                             arenaOpt);
00347     return rvCerts;
00348 }
00349 
00350 NSS_IMPLEMENT NSSCertificate **
00351 NSSCryptoContext_FindCertificatesBySubject (
00352   NSSCryptoContext *cc,
00353   NSSDER *subject,
00354   NSSCertificate *rvOpt[],
00355   PRUint32 maximumOpt, /* 0 for no max */
00356   NSSArena *arenaOpt
00357 )
00358 {
00359     return nssCryptoContext_FindCertificatesBySubject(cc, subject,
00360                                                       rvOpt, maximumOpt,
00361                                                       arenaOpt);
00362 }
00363 
00364 NSS_IMPLEMENT NSSCertificate *
00365 NSSCryptoContext_FindBestCertificateByNameComponents (
00366   NSSCryptoContext *cc,
00367   NSSUTF8 *nameComponents,
00368   NSSTime *timeOpt,
00369   NSSUsage *usage,
00370   NSSPolicies *policiesOpt
00371 )
00372 {
00373     nss_SetError(NSS_ERROR_NOT_FOUND);
00374     return NULL;
00375 }
00376 
00377 NSS_IMPLEMENT NSSCertificate **
00378 NSSCryptoContext_FindCertificatesByNameComponents (
00379   NSSCryptoContext *cc,
00380   NSSUTF8 *nameComponents,
00381   NSSCertificate *rvOpt[],
00382   PRUint32 maximumOpt, /* 0 for no max */
00383   NSSArena *arenaOpt
00384 )
00385 {
00386     nss_SetError(NSS_ERROR_NOT_FOUND);
00387     return NULL;
00388 }
00389 
00390 NSS_IMPLEMENT NSSCertificate *
00391 NSSCryptoContext_FindCertificateByEncodedCertificate (
00392   NSSCryptoContext *cc,
00393   NSSBER *encodedCertificate
00394 )
00395 {
00396     PORT_Assert(cc->certStore);
00397     if (!cc->certStore) {
00398        return NULL;
00399     }
00400     return nssCertificateStore_FindCertificateByEncodedCertificate(
00401                                                            cc->certStore,
00402                                                            encodedCertificate);
00403 }
00404 
00405 NSS_IMPLEMENT NSSCertificate *
00406 NSSCryptoContext_FindBestCertificateByEmail (
00407   NSSCryptoContext *cc,
00408   NSSASCII7 *email,
00409   NSSTime *timeOpt,
00410   NSSUsage *usage,
00411   NSSPolicies *policiesOpt
00412 )
00413 {
00414     NSSCertificate **certs;
00415     NSSCertificate *rvCert = NULL;
00416 
00417     PORT_Assert(cc->certStore);
00418     if (!cc->certStore) {
00419        return NULL;
00420     }
00421     certs = nssCertificateStore_FindCertificatesByEmail(cc->certStore,
00422                                                         email,
00423                                                         NULL, 0, NULL);
00424     if (certs) {
00425        rvCert = nssCertificateArray_FindBestCertificate(certs,
00426                                                         timeOpt,
00427                                                         usage,
00428                                                         policiesOpt);
00429        nssCertificateArray_Destroy(certs);
00430     }
00431     return rvCert;
00432 }
00433 
00434 NSS_IMPLEMENT NSSCertificate **
00435 NSSCryptoContext_FindCertificatesByEmail (
00436   NSSCryptoContext *cc,
00437   NSSASCII7 *email,
00438   NSSCertificate *rvOpt[],
00439   PRUint32 maximumOpt, /* 0 for no max */
00440   NSSArena *arenaOpt
00441 )
00442 {
00443     NSSCertificate **rvCerts;
00444     PORT_Assert(cc->certStore);
00445     if (!cc->certStore) {
00446        return NULL;
00447     }
00448     rvCerts = nssCertificateStore_FindCertificatesByEmail(cc->certStore,
00449                                                           email,
00450                                                           rvOpt,
00451                                                           maximumOpt,
00452                                                           arenaOpt);
00453     return rvCerts;
00454 }
00455 
00456 NSS_IMPLEMENT NSSCertificate *
00457 NSSCryptoContext_FindCertificateByOCSPHash (
00458   NSSCryptoContext *cc,
00459   NSSItem *hash
00460 )
00461 {
00462     nss_SetError(NSS_ERROR_NOT_FOUND);
00463     return NULL;
00464 }
00465 
00466 NSS_IMPLEMENT NSSCertificate *
00467 NSSCryptoContext_FindBestUserCertificate (
00468   NSSCryptoContext *cc,
00469   NSSTime *timeOpt,
00470   NSSUsage *usage,
00471   NSSPolicies *policiesOpt
00472 )
00473 {
00474     nss_SetError(NSS_ERROR_NOT_FOUND);
00475     return NULL;
00476 }
00477 
00478 NSS_IMPLEMENT NSSCertificate **
00479 NSSCryptoContext_FindUserCertificates (
00480   NSSCryptoContext *cc,
00481   NSSTime *timeOpt,
00482   NSSUsage *usageOpt,
00483   NSSPolicies *policiesOpt,
00484   NSSCertificate **rvOpt,
00485   PRUint32 rvLimit, /* zero for no limit */
00486   NSSArena *arenaOpt
00487 )
00488 {
00489     nss_SetError(NSS_ERROR_NOT_FOUND);
00490     return NULL;
00491 }
00492 
00493 NSS_IMPLEMENT NSSCertificate *
00494 NSSCryptoContext_FindBestUserCertificateForSSLClientAuth (
00495   NSSCryptoContext *cc,
00496   NSSUTF8 *sslHostOpt,
00497   NSSDER *rootCAsOpt[], /* null pointer for none */
00498   PRUint32 rootCAsMaxOpt, /* zero means list is null-terminated */
00499   NSSAlgorithmAndParameters *apOpt,
00500   NSSPolicies *policiesOpt
00501 )
00502 {
00503     nss_SetError(NSS_ERROR_NOT_FOUND);
00504     return NULL;
00505 }
00506 
00507 NSS_IMPLEMENT NSSCertificate **
00508 NSSCryptoContext_FindUserCertificatesForSSLClientAuth (
00509   NSSCryptoContext *cc,
00510   NSSUTF8 *sslHostOpt,
00511   NSSDER *rootCAsOpt[], /* null pointer for none */
00512   PRUint32 rootCAsMaxOpt, /* zero means list is null-terminated */
00513   NSSAlgorithmAndParameters *apOpt,
00514   NSSPolicies *policiesOpt,
00515   NSSCertificate **rvOpt,
00516   PRUint32 rvLimit, /* zero for no limit */
00517   NSSArena *arenaOpt
00518 )
00519 {
00520     nss_SetError(NSS_ERROR_NOT_FOUND);
00521     return NULL;
00522 }
00523 
00524 NSS_IMPLEMENT NSSCertificate *
00525 NSSCryptoContext_FindBestUserCertificateForEmailSigning (
00526   NSSCryptoContext *cc,
00527   NSSASCII7 *signerOpt,
00528   NSSASCII7 *recipientOpt,
00529   /* anything more here? */
00530   NSSAlgorithmAndParameters *apOpt,
00531   NSSPolicies *policiesOpt
00532 )
00533 {
00534     nss_SetError(NSS_ERROR_NOT_FOUND);
00535     return NULL;
00536 }
00537 
00538 NSS_IMPLEMENT NSSCertificate *
00539 NSSCryptoContext_FindUserCertificatesForEmailSigning (
00540   NSSCryptoContext *cc,
00541   NSSASCII7 *signerOpt, /* fgmr or a more general name? */
00542   NSSASCII7 *recipientOpt,
00543   /* anything more here? */
00544   NSSAlgorithmAndParameters *apOpt,
00545   NSSPolicies *policiesOpt,
00546   NSSCertificate **rvOpt,
00547   PRUint32 rvLimit, /* zero for no limit */
00548   NSSArena *arenaOpt
00549 )
00550 {
00551     nss_SetError(NSS_ERROR_NOT_FOUND);
00552     return NULL;
00553 }
00554 
00555 NSS_IMPLEMENT NSSTrust *
00556 nssCryptoContext_FindTrustForCertificate (
00557   NSSCryptoContext *cc,
00558   NSSCertificate *cert
00559 )
00560 {
00561     PORT_Assert(cc->certStore);
00562     if (!cc->certStore) {
00563        return NULL;
00564     }
00565     return nssCertificateStore_FindTrustForCertificate(cc->certStore, cert);
00566 }
00567 
00568 NSS_IMPLEMENT nssSMIMEProfile *
00569 nssCryptoContext_FindSMIMEProfileForCertificate (
00570   NSSCryptoContext *cc,
00571   NSSCertificate *cert
00572 )
00573 {
00574     PORT_Assert(cc->certStore);
00575     if (!cc->certStore) {
00576        return NULL;
00577     }
00578     return nssCertificateStore_FindSMIMEProfileForCertificate(cc->certStore, 
00579                                                               cert);
00580 }
00581 
00582 NSS_IMPLEMENT PRStatus
00583 NSSCryptoContext_GenerateKeyPair (
00584   NSSCryptoContext *cc,
00585   NSSAlgorithmAndParameters *ap,
00586   NSSPrivateKey **pvkOpt,
00587   NSSPublicKey **pbkOpt,
00588   PRBool privateKeyIsSensitive,
00589   NSSToken *destination,
00590   NSSCallback *uhhOpt
00591 )
00592 {
00593     nss_SetError(NSS_ERROR_NOT_FOUND);
00594     return PR_FAILURE;
00595 }
00596 
00597 NSS_IMPLEMENT NSSSymmetricKey *
00598 NSSCryptoContext_GenerateSymmetricKey (
00599   NSSCryptoContext *cc,
00600   NSSAlgorithmAndParameters *ap,
00601   PRUint32 keysize,
00602   NSSToken *destination,
00603   NSSCallback *uhhOpt
00604 )
00605 {
00606     nss_SetError(NSS_ERROR_NOT_FOUND);
00607     return NULL;
00608 }
00609 
00610 NSS_IMPLEMENT NSSSymmetricKey *
00611 NSSCryptoContext_GenerateSymmetricKeyFromPassword (
00612   NSSCryptoContext *cc,
00613   NSSAlgorithmAndParameters *ap,
00614   NSSUTF8 *passwordOpt, /* if null, prompt */
00615   NSSToken *destinationOpt,
00616   NSSCallback *uhhOpt
00617 )
00618 {
00619     nss_SetError(NSS_ERROR_NOT_FOUND);
00620     return NULL;
00621 }
00622 
00623 NSS_IMPLEMENT NSSSymmetricKey *
00624 NSSCryptoContext_FindSymmetricKeyByAlgorithmAndKeyID (
00625   NSSCryptoContext *cc,
00626   NSSOID *algorithm,
00627   NSSItem *keyID,
00628   NSSCallback *uhhOpt
00629 )
00630 {
00631     nss_SetError(NSS_ERROR_NOT_FOUND);
00632     return NULL;
00633 }
00634 
00635 struct token_session_str {
00636     NSSToken *token;
00637     nssSession *session;
00638 };
00639 
00640 NSS_IMPLEMENT NSSItem *
00641 NSSCryptoContext_Decrypt (
00642   NSSCryptoContext *cc,
00643   NSSAlgorithmAndParameters *apOpt,
00644   NSSItem *encryptedData,
00645   NSSCallback *uhhOpt,
00646   NSSItem *rvOpt,
00647   NSSArena *arenaOpt
00648 )
00649 {
00650     nss_SetError(NSS_ERROR_NOT_FOUND);
00651     return NULL;
00652 }
00653 
00654 NSS_IMPLEMENT PRStatus
00655 NSSCryptoContext_BeginDecrypt (
00656   NSSCryptoContext *cc,
00657   NSSAlgorithmAndParameters *apOpt,
00658   NSSCallback *uhhOpt
00659 )
00660 {
00661     nss_SetError(NSS_ERROR_NOT_FOUND);
00662     return PR_FAILURE;
00663 }
00664 
00665 NSS_IMPLEMENT NSSItem *
00666 NSSCryptoContext_ContinueDecrypt (
00667   NSSCryptoContext *cc,
00668   NSSItem *data,
00669   NSSItem *rvOpt,
00670   NSSArena *arenaOpt
00671 )
00672 {
00673     nss_SetError(NSS_ERROR_NOT_FOUND);
00674     return NULL;
00675 }
00676 
00677 NSS_IMPLEMENT NSSItem *
00678 NSSCryptoContext_FinishDecrypt (
00679   NSSCryptoContext *cc,
00680   NSSItem *rvOpt,
00681   NSSArena *arenaOpt
00682 )
00683 {
00684     nss_SetError(NSS_ERROR_NOT_FOUND);
00685     return NULL;
00686 }
00687 
00688 NSS_IMPLEMENT NSSItem *
00689 NSSCryptoContext_Sign (
00690   NSSCryptoContext *cc,
00691   NSSAlgorithmAndParameters *apOpt,
00692   NSSItem *data,
00693   NSSCallback *uhhOpt,
00694   NSSItem *rvOpt,
00695   NSSArena *arenaOpt
00696 )
00697 {
00698     nss_SetError(NSS_ERROR_NOT_FOUND);
00699     return NULL;
00700 }
00701 
00702 NSS_IMPLEMENT PRStatus
00703 NSSCryptoContext_BeginSign (
00704   NSSCryptoContext *cc,
00705   NSSAlgorithmAndParameters *apOpt,
00706   NSSCallback *uhhOpt
00707 )
00708 {
00709     nss_SetError(NSS_ERROR_NOT_FOUND);
00710     return PR_FAILURE;
00711 }
00712 
00713 NSS_IMPLEMENT PRStatus
00714 NSSCryptoContext_ContinueSign (
00715   NSSCryptoContext *cc,
00716   NSSItem *data
00717 )
00718 {
00719     nss_SetError(NSS_ERROR_NOT_FOUND);
00720     return PR_FAILURE;
00721 }
00722 
00723 NSS_IMPLEMENT NSSItem *
00724 NSSCryptoContext_FinishSign (
00725   NSSCryptoContext *cc,
00726   NSSItem *rvOpt,
00727   NSSArena *arenaOpt
00728 )
00729 {
00730     nss_SetError(NSS_ERROR_NOT_FOUND);
00731     return NULL;
00732 }
00733 
00734 NSS_IMPLEMENT NSSItem *
00735 NSSCryptoContext_SignRecover (
00736   NSSCryptoContext *cc,
00737   NSSAlgorithmAndParameters *apOpt,
00738   NSSItem *data,
00739   NSSCallback *uhhOpt,
00740   NSSItem *rvOpt,
00741   NSSArena *arenaOpt
00742 )
00743 {
00744     nss_SetError(NSS_ERROR_NOT_FOUND);
00745     return NULL;
00746 }
00747 
00748 NSS_IMPLEMENT PRStatus
00749 NSSCryptoContext_BeginSignRecover (
00750   NSSCryptoContext *cc,
00751   NSSAlgorithmAndParameters *apOpt,
00752   NSSCallback *uhhOpt
00753 )
00754 {
00755     nss_SetError(NSS_ERROR_NOT_FOUND);
00756     return PR_FAILURE;
00757 }
00758 
00759 NSS_IMPLEMENT NSSItem *
00760 NSSCryptoContext_ContinueSignRecover (
00761   NSSCryptoContext *cc,
00762   NSSItem *data,
00763   NSSItem *rvOpt,
00764   NSSArena *arenaOpt
00765 )
00766 {
00767     nss_SetError(NSS_ERROR_NOT_FOUND);
00768     return NULL;
00769 }
00770 
00771 NSS_IMPLEMENT NSSItem *
00772 NSSCryptoContext_FinishSignRecover (
00773   NSSCryptoContext *cc,
00774   NSSItem *rvOpt,
00775   NSSArena *arenaOpt
00776 )
00777 {
00778     nss_SetError(NSS_ERROR_NOT_FOUND);
00779     return NULL;
00780 }
00781 
00782 NSS_IMPLEMENT NSSSymmetricKey *
00783 NSSCryptoContext_UnwrapSymmetricKey (
00784   NSSCryptoContext *cc,
00785   NSSAlgorithmAndParameters *apOpt,
00786   NSSItem *wrappedKey,
00787   NSSCallback *uhhOpt
00788 )
00789 {
00790     nss_SetError(NSS_ERROR_NOT_FOUND);
00791     return NULL;
00792 }
00793 
00794 NSS_IMPLEMENT NSSSymmetricKey *
00795 NSSCryptoContext_DeriveSymmetricKey (
00796   NSSCryptoContext *cc,
00797   NSSPublicKey *bk,
00798   NSSAlgorithmAndParameters *apOpt,
00799   NSSOID *target,
00800   PRUint32 keySizeOpt, /* zero for best allowed */
00801   NSSOperations operations,
00802   NSSCallback *uhhOpt
00803 )
00804 {
00805     nss_SetError(NSS_ERROR_NOT_FOUND);
00806     return NULL;
00807 }
00808 
00809 NSS_IMPLEMENT NSSItem *
00810 NSSCryptoContext_Encrypt (
00811   NSSCryptoContext *cc,
00812   NSSAlgorithmAndParameters *apOpt,
00813   NSSItem *data,
00814   NSSCallback *uhhOpt,
00815   NSSItem *rvOpt,
00816   NSSArena *arenaOpt
00817 )
00818 {
00819     nss_SetError(NSS_ERROR_NOT_FOUND);
00820     return NULL;
00821 }
00822 
00823 NSS_IMPLEMENT PRStatus
00824 NSSCryptoContext_BeginEncrypt (
00825   NSSCryptoContext *cc,
00826   NSSAlgorithmAndParameters *apOpt,
00827   NSSCallback *uhhOpt
00828 )
00829 {
00830     nss_SetError(NSS_ERROR_NOT_FOUND);
00831     return PR_FAILURE;
00832 }
00833 
00834 NSS_IMPLEMENT NSSItem *
00835 NSSCryptoContext_ContinueEncrypt (
00836   NSSCryptoContext *cc,
00837   NSSItem *data,
00838   NSSItem *rvOpt,
00839   NSSArena *arenaOpt
00840 )
00841 {
00842     nss_SetError(NSS_ERROR_NOT_FOUND);
00843     return NULL;
00844 }
00845 
00846 NSS_IMPLEMENT NSSItem *
00847 NSSCryptoContext_FinishEncrypt (
00848   NSSCryptoContext *cc,
00849   NSSItem *rvOpt,
00850   NSSArena *arenaOpt
00851 )
00852 {
00853     nss_SetError(NSS_ERROR_NOT_FOUND);
00854     return NULL;
00855 }
00856 
00857 NSS_IMPLEMENT PRStatus
00858 NSSCryptoContext_Verify (
00859   NSSCryptoContext *cc,
00860   NSSAlgorithmAndParameters *apOpt,
00861   NSSItem *data,
00862   NSSItem *signature,
00863   NSSCallback *uhhOpt
00864 )
00865 {
00866     nss_SetError(NSS_ERROR_NOT_FOUND);
00867     return PR_FAILURE;
00868 }
00869 
00870 NSS_IMPLEMENT PRStatus
00871 NSSCryptoContext_BeginVerify (
00872   NSSCryptoContext *cc,
00873   NSSAlgorithmAndParameters *apOpt,
00874   NSSItem *signature,
00875   NSSCallback *uhhOpt
00876 )
00877 {
00878     nss_SetError(NSS_ERROR_NOT_FOUND);
00879     return PR_FAILURE;
00880 }
00881 
00882 NSS_IMPLEMENT PRStatus
00883 NSSCryptoContext_ContinueVerify (
00884   NSSCryptoContext *cc,
00885   NSSItem *data
00886 )
00887 {
00888     nss_SetError(NSS_ERROR_NOT_FOUND);
00889     return PR_FAILURE;
00890 }
00891 
00892 NSS_IMPLEMENT PRStatus
00893 NSSCryptoContext_FinishVerify (
00894   NSSCryptoContext *cc
00895 )
00896 {
00897     nss_SetError(NSS_ERROR_NOT_FOUND);
00898     return PR_FAILURE;
00899 }
00900 
00901 NSS_IMPLEMENT NSSItem *
00902 NSSCryptoContext_VerifyRecover (
00903   NSSCryptoContext *cc,
00904   NSSAlgorithmAndParameters *apOpt,
00905   NSSItem *signature,
00906   NSSCallback *uhhOpt,
00907   NSSItem *rvOpt,
00908   NSSArena *arenaOpt
00909 )
00910 {
00911     nss_SetError(NSS_ERROR_NOT_FOUND);
00912     return NULL;
00913 }
00914 
00915 NSS_IMPLEMENT PRStatus
00916 NSSCryptoContext_BeginVerifyRecover (
00917   NSSCryptoContext *cc,
00918   NSSAlgorithmAndParameters *apOpt,
00919   NSSCallback *uhhOpt
00920 )
00921 {
00922     nss_SetError(NSS_ERROR_NOT_FOUND);
00923     return PR_FAILURE;
00924 }
00925 
00926 NSS_IMPLEMENT NSSItem *
00927 NSSCryptoContext_ContinueVerifyRecover (
00928   NSSCryptoContext *cc,
00929   NSSItem *data,
00930   NSSItem *rvOpt,
00931   NSSArena *arenaOpt
00932 )
00933 {
00934     nss_SetError(NSS_ERROR_NOT_FOUND);
00935     return NULL;
00936 }
00937 
00938 NSS_IMPLEMENT NSSItem *
00939 NSSCryptoContext_FinishVerifyRecover (
00940   NSSCryptoContext *cc,
00941   NSSItem *rvOpt,
00942   NSSArena *arenaOpt
00943 )
00944 {
00945     nss_SetError(NSS_ERROR_NOT_FOUND);
00946     return NULL;
00947 }
00948 
00949 NSS_IMPLEMENT NSSItem *
00950 NSSCryptoContext_WrapSymmetricKey (
00951   NSSCryptoContext *cc,
00952   NSSAlgorithmAndParameters *apOpt,
00953   NSSSymmetricKey *keyToWrap,
00954   NSSCallback *uhhOpt,
00955   NSSItem *rvOpt,
00956   NSSArena *arenaOpt
00957 )
00958 {
00959     nss_SetError(NSS_ERROR_NOT_FOUND);
00960     return NULL;
00961 }
00962 
00963 NSS_IMPLEMENT NSSItem *
00964 NSSCryptoContext_Digest (
00965   NSSCryptoContext *cc,
00966   NSSAlgorithmAndParameters *apOpt,
00967   NSSItem *data,
00968   NSSCallback *uhhOpt,
00969   NSSItem *rvOpt,
00970   NSSArena *arenaOpt
00971 )
00972 {
00973     return nssToken_Digest(cc->token, cc->session, apOpt, 
00974                            data, rvOpt, arenaOpt);
00975 }
00976 
00977 NSS_IMPLEMENT PRStatus
00978 NSSCryptoContext_BeginDigest (
00979   NSSCryptoContext *cc,
00980   NSSAlgorithmAndParameters *apOpt,
00981   NSSCallback *uhhOpt
00982 )
00983 {
00984     return nssToken_BeginDigest(cc->token, cc->session, apOpt);
00985 }
00986 
00987 NSS_IMPLEMENT PRStatus
00988 NSSCryptoContext_ContinueDigest (
00989   NSSCryptoContext *cc,
00990   NSSAlgorithmAndParameters *apOpt,
00991   NSSItem *item
00992 )
00993 {
00994        /*
00995     NSSAlgorithmAndParameters *ap;
00996     ap = (apOpt) ? apOpt : cc->ap;
00997     */
00998        /* why apOpt?  can't change it at this point... */
00999     return nssToken_ContinueDigest(cc->token, cc->session, item);
01000 }
01001 
01002 NSS_IMPLEMENT NSSItem *
01003 NSSCryptoContext_FinishDigest (
01004   NSSCryptoContext *cc,
01005   NSSItem *rvOpt,
01006   NSSArena *arenaOpt
01007 )
01008 {
01009     return nssToken_FinishDigest(cc->token, cc->session, rvOpt, arenaOpt);
01010 }
01011 
01012 NSS_IMPLEMENT NSSCryptoContext *
01013 NSSCryptoContext_Clone (
01014   NSSCryptoContext *cc
01015 )
01016 {
01017     nss_SetError(NSS_ERROR_NOT_FOUND);
01018     return NULL;
01019 }
01020