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