Back to index

lightning-sunbird  0.9+nobinonly
nsIX509CertDB.idl
Go to the documentation of this file.
00001 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
00002  *
00003  * ***** BEGIN LICENSE BLOCK *****
00004  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
00005  *
00006  * The contents of this file are subject to the Mozilla Public License Version
00007  * 1.1 (the "License"); you may not use this file except in compliance with
00008  * the License. You may obtain a copy of the License at
00009  * http://www.mozilla.org/MPL/
00010  *
00011  * Software distributed under the License is distributed on an "AS IS" basis,
00012  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00013  * for the specific language governing rights and limitations under the
00014  * License.
00015  *
00016  * The Original Code is mozilla.org code.
00017  *
00018  * The Initial Developer of the Original Code is
00019  * Netscape Communications Corporation.
00020  * Portions created by the Initial Developer are Copyright (C) 1998
00021  * the Initial Developer. All Rights Reserved.
00022  *
00023  * Contributor(s):
00024  *   Javier Delgadillo <javi@netscape.com>
00025  *
00026  * Alternatively, the contents of this file may be used under the terms of
00027  * either the GNU General Public License Version 2 or later (the "GPL"), or
00028  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
00029  * in which case the provisions of the GPL or the LGPL are applicable instead
00030  * of those above. If you wish to allow use of your version of this file only
00031  * under the terms of either the GPL or the LGPL, and not to allow others to
00032  * use your version of this file under the terms of the MPL, indicate your
00033  * decision by deleting the provisions above and replace them with the notice
00034  * and other provisions required by the GPL or the LGPL. If you do not delete
00035  * the provisions above, a recipient may use your version of this file under
00036  * the terms of any one of the MPL, the GPL or the LGPL.
00037  *
00038  * ***** END LICENSE BLOCK ***** */
00039 
00040 #include "nsISupports.idl"
00041 
00042 interface nsIArray;
00043 interface nsIX509Cert;
00044 interface nsILocalFile;
00045 interface nsIInterfaceRequestor;
00046 
00047 %{C++
00048 #define NS_X509CERTDB_CONTRACTID "@mozilla.org/security/x509certdb;1"
00049 %}
00050 
00057 [scriptable, uuid(da48b3c0-1284-11d5-ac67-000064657374)]
00058 interface nsIX509CertDB : nsISupports {
00059 
00064   const unsigned long UNTRUSTED       =      0;
00065   const unsigned long TRUSTED_SSL     = 1 << 0;
00066   const unsigned long TRUSTED_EMAIL   = 1 << 1;
00067   const unsigned long TRUSTED_OBJSIGN = 1 << 2;
00068 
00081   nsIX509Cert findCertByNickname(in nsISupports aToken,
00082                                  in AString aNickname);
00083 
00095   nsIX509Cert findCertByDBKey(in string aDBkey, in nsISupports aToken);
00096 
00111   void findCertNicknames(in nsISupports aToken, 
00112                          in unsigned long aType,
00113                          out unsigned long count,
00114                          [array, size_is(count)] out wstring certNameList);
00115 
00124   nsIX509Cert findEmailEncryptionCert(in AString aNickname);
00125 
00134   nsIX509Cert findEmailSigningCert(in AString aNickname);
00135 
00147   nsIX509Cert findCertByEmailAddress(in nsISupports aToken,
00148                                      in string aEmailAddress);
00149 
00160   void importCertificates([array, size_is(length)] in octet data,
00161                           in unsigned long length,
00162                           in unsigned long type,
00163                           in nsIInterfaceRequestor ctx);
00164 
00172   void importEmailCertificate([array, size_is(length)] in octet data,
00173                               in unsigned long length,
00174                               in nsIInterfaceRequestor ctx);
00175 
00183   void importServerCertificate([array, size_is(length)] in octet data,
00184                                in unsigned long length,
00185                                in nsIInterfaceRequestor ctx);
00186 
00195   void importUserCertificate([array, size_is(length)] in octet data,
00196                              in unsigned long length,
00197                              in nsIInterfaceRequestor ctx);
00198 
00204   void deleteCertificate(in nsIX509Cert aCert);
00205 
00217   void setCertTrust(in nsIX509Cert cert,
00218                     in unsigned long type,
00219                     in unsigned long trust);
00220 
00231   boolean isCertTrusted(in nsIX509Cert cert,
00232                        in unsigned long certType,
00233                        in unsigned long trustType);
00234 
00246   void importCertsFromFile(in nsISupports aToken,
00247                          in nsILocalFile aFile,
00248                          in unsigned long aType);
00249 
00259   void importPKCS12File(in nsISupports aToken,
00260                         in nsILocalFile aFile);
00261 
00273   void exportPKCS12File(in nsISupports aToken,
00274                         in nsILocalFile aFile,
00275                         in unsigned long count,
00276                         [array, size_is(count)] in nsIX509Cert aCerts);
00277 
00284   nsIArray getOCSPResponders();
00285 
00289   readonly attribute boolean isOcspOn;
00290 
00291   /*
00292    *  Decode a raw data presentation and instantiate an object in memory.
00293    *
00294    *  @param base64 The raw representation of a certificate,
00295    *                encoded as Base 64.
00296    *  @return The new certificate object.
00297    */
00298   nsIX509Cert constructX509FromBase64(in string base64);
00299 };
00300