2001-01-30 21:34:22 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
|
|
|
*
|
|
|
|
* The contents of this file are subject to the Mozilla Public
|
|
|
|
* License Version 1.1 (the "License"); you may not use this file
|
|
|
|
* except in compliance with the License. You may obtain a copy of
|
|
|
|
* the License at http://www.mozilla.org/MPL/
|
|
|
|
*
|
|
|
|
* Software distributed under the License is distributed on an "AS
|
|
|
|
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
|
|
|
* implied. See the License for the specific language governing
|
|
|
|
* rights and limitations under the License.
|
|
|
|
*
|
|
|
|
* The Original Code is mozilla.org code.
|
|
|
|
*
|
|
|
|
* The Initial Developer of the Original Code is Netscape
|
|
|
|
* Communications Corporation. Portions created by Netscape are
|
|
|
|
* Copyright (C) 1998 Netscape Communications Corporation. All
|
|
|
|
* Rights Reserved.
|
|
|
|
*
|
|
|
|
* Contributor(s):
|
|
|
|
* Javier Delgadillo <javi@netscape.com>
|
|
|
|
*
|
|
|
|
* Alternatively, the contents of this file may be used under the
|
|
|
|
* terms of the GNU General Public License Version 2 or later (the
|
|
|
|
* "GPL"), in which case the provisions of the GPL are applicable
|
|
|
|
* instead of those above. If you wish to allow use of your
|
|
|
|
* version of this file only under the terms of the GPL and not to
|
|
|
|
* allow others to use your version of this file under the MPL,
|
|
|
|
* indicate your decision by deleting the provisions above and
|
|
|
|
* replace them with the notice and other provisions required by
|
|
|
|
* the GPL. If you do not delete the provisions above, a recipient
|
|
|
|
* may use your version of this file under either the MPL or the
|
|
|
|
* GPL.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "nsISupports.idl"
|
|
|
|
|
2001-05-02 03:23:23 +04:00
|
|
|
interface nsISupportsArray;
|
2001-02-27 00:50:54 +03:00
|
|
|
interface nsIX509Cert;
|
2001-03-20 21:00:44 +03:00
|
|
|
interface nsILocalFile;
|
2001-05-03 05:00:56 +04:00
|
|
|
interface nsIInterfaceRequestor;
|
2001-03-07 22:24:12 +03:00
|
|
|
|
2001-05-02 03:23:23 +04:00
|
|
|
%{C++
|
|
|
|
#define NS_X509CERTDB_CONTRACTID "@mozilla.org/security/x509certdb;1"
|
|
|
|
%}
|
|
|
|
|
2001-03-07 22:24:12 +03:00
|
|
|
[scriptable, uuid(da48b3c0-1284-11d5-ac67-000064657374)]
|
2001-01-30 21:34:22 +03:00
|
|
|
interface nsIX509CertDB : nsISupports {
|
2001-02-27 00:50:54 +03:00
|
|
|
|
2001-03-22 19:48:19 +03:00
|
|
|
/* the database is responsible for managing cert trust */
|
|
|
|
const unsigned long UNTRUSTED = 0;
|
|
|
|
const unsigned long TRUSTED_SSL = 1 << 0;
|
|
|
|
const unsigned long TRUSTED_EMAIL = 1 << 1;
|
|
|
|
const unsigned long TRUSTED_OBJSIGN = 1 << 2;
|
2001-03-07 22:24:12 +03:00
|
|
|
|
2002-09-17 22:51:22 +04:00
|
|
|
nsIX509Cert getCertByNickname(in nsISupports aToken,
|
2002-09-24 00:17:16 +04:00
|
|
|
in AString aNickname);
|
2001-03-07 22:24:12 +03:00
|
|
|
|
2001-03-21 06:37:49 +03:00
|
|
|
/*
|
2001-03-30 23:55:00 +04:00
|
|
|
* getCertByDBKey
|
2001-03-21 06:37:49 +03:00
|
|
|
*
|
|
|
|
* Will find a certificate based on its dbkey
|
|
|
|
* retrieved by getting the dbKey attribute of
|
|
|
|
* the certificate.
|
|
|
|
*/
|
2002-09-17 22:51:22 +04:00
|
|
|
nsIX509Cert getCertByDBKey(in string aDBkey, in nsISupports aToken);
|
2001-03-07 22:24:12 +03:00
|
|
|
|
|
|
|
/*
|
2001-03-22 19:48:19 +03:00
|
|
|
* getCertNicknames
|
2001-03-07 22:24:12 +03:00
|
|
|
*
|
2001-03-22 19:48:19 +03:00
|
|
|
* Obtain a list of certificate nicknames from the database.
|
2001-03-07 22:24:12 +03:00
|
|
|
* What the name is depends on type:
|
|
|
|
* user, ca, or server cert - the nickname
|
|
|
|
* email cert - the email address
|
|
|
|
*
|
|
|
|
* aToken - PKCS#11 token to get certs from (null for all tokens)
|
|
|
|
* aType - type of certificate to obtain (see nsIX509Cert)
|
2001-03-22 19:48:19 +03:00
|
|
|
* count, certNameList - the returned array of names
|
2001-03-07 22:24:12 +03:00
|
|
|
*/
|
2002-09-17 22:51:22 +04:00
|
|
|
void getCertNicknames(in nsISupports aToken,
|
2001-03-22 19:48:19 +03:00
|
|
|
in unsigned long aType,
|
|
|
|
out unsigned long count,
|
|
|
|
[array, size_is(count)] out wstring certNameList);
|
2001-03-07 22:24:12 +03:00
|
|
|
|
2001-10-31 02:52:01 +03:00
|
|
|
/* Get the user encryption cert */
|
2002-09-24 00:17:16 +04:00
|
|
|
nsIX509Cert getEmailEncryptionCert(in AString aNickname);
|
2001-10-31 02:52:01 +03:00
|
|
|
|
|
|
|
/* Get the user signing cert */
|
2002-09-24 00:17:16 +04:00
|
|
|
nsIX509Cert getEmailSigningCert(in AString aNickname);
|
2001-10-31 02:52:01 +03:00
|
|
|
|
|
|
|
/* Get a cert by email address */
|
2002-09-17 22:51:22 +04:00
|
|
|
nsIX509Cert getCertByEmailAddress(in nsISupports aToken,
|
2001-10-31 02:52:01 +03:00
|
|
|
in string aEmailAddress);
|
|
|
|
|
2001-03-07 22:24:12 +03:00
|
|
|
/*
|
2001-08-22 08:05:45 +04:00
|
|
|
* importCertificates
|
|
|
|
* Use this to import a stream sent down as a mime type into
|
|
|
|
* the default cert db. The stream may consist of one or more
|
|
|
|
* certificates.
|
|
|
|
* XXX We may want to add a parameter for a PK11 Token where
|
|
|
|
* the certs will utlimtately live. Currently, they'll
|
|
|
|
* be placed in the default token.
|
2001-03-07 22:24:12 +03:00
|
|
|
*/
|
2002-09-17 22:51:22 +04:00
|
|
|
void importCertificates([array, size_is(length)] in octet data,
|
|
|
|
in unsigned long length,
|
|
|
|
in unsigned long type,
|
|
|
|
in nsIInterfaceRequestor ctx);
|
2002-08-06 17:11:15 +04:00
|
|
|
|
2002-06-14 06:10:02 +04:00
|
|
|
/*
|
2002-09-17 22:51:22 +04:00
|
|
|
* importEmailCertificate
|
2002-06-14 06:10:02 +04:00
|
|
|
*
|
|
|
|
* Import a user certificate into the database.
|
|
|
|
*
|
|
|
|
* @param length - The number of bytes contained in the data array.
|
|
|
|
*
|
|
|
|
* @param data - Raw certificate data, containing the certificate to import.
|
|
|
|
*/
|
2002-09-17 22:51:22 +04:00
|
|
|
void importEmailCertificate([array, size_is(length)] in octet data,
|
|
|
|
in unsigned long length,
|
|
|
|
in nsIInterfaceRequestor ctx);
|
|
|
|
|
|
|
|
void importServerCertificate([array, size_is(length)] in octet data,
|
|
|
|
in unsigned long length,
|
|
|
|
in nsIInterfaceRequestor ctx);
|
2002-06-14 06:10:02 +04:00
|
|
|
|
2001-05-03 05:00:56 +04:00
|
|
|
/*
|
|
|
|
* importCertificate
|
|
|
|
*
|
|
|
|
* Import a user certificate into the database.
|
|
|
|
* XXX This method and the importCertificate should be merged into one.
|
|
|
|
*/
|
2002-09-17 22:51:22 +04:00
|
|
|
void importUserCertificate([array, size_is(length)] in octet data,
|
|
|
|
in unsigned long length,
|
|
|
|
in nsIInterfaceRequestor ctx);
|
2001-03-30 23:55:00 +04:00
|
|
|
/*
|
|
|
|
* deleteCertificate
|
|
|
|
*
|
|
|
|
* Remove a certificate from the database.
|
|
|
|
*/
|
|
|
|
void deleteCertificate(in nsIX509Cert aCert);
|
|
|
|
|
2001-03-20 21:00:44 +03:00
|
|
|
/*
|
|
|
|
* setCertTrust
|
|
|
|
*
|
|
|
|
* The certificate database is responsible for managing cert trust. This
|
|
|
|
* function allows clients to set the trust settings for a cert.
|
|
|
|
*/
|
|
|
|
void setCertTrust(in nsIX509Cert cert,
|
|
|
|
in unsigned long type,
|
|
|
|
in unsigned long trust);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* getCertTrust
|
|
|
|
*
|
|
|
|
* Get the trust settings for this certificate.
|
|
|
|
*
|
|
|
|
* trustType = TRUSTED_SSL => returns true if cert is trusted SSL cert
|
|
|
|
* trustType = TRUSTED_EMAIL => returns true if cert is trusted email cert
|
|
|
|
* trustType = TRUSTED_OBJSIGN => returns true if cert is trusted
|
|
|
|
* object signing cert
|
|
|
|
*/
|
|
|
|
boolean getCertTrust(in nsIX509Cert cert,
|
2001-05-23 03:02:49 +04:00
|
|
|
in unsigned long certType,
|
2001-03-20 21:00:44 +03:00
|
|
|
in unsigned long trustType);
|
|
|
|
|
2002-08-06 17:11:15 +04:00
|
|
|
/*
|
|
|
|
* importCertsFromFile
|
|
|
|
*
|
|
|
|
* Import certificate(s) from file
|
|
|
|
*/
|
2002-09-17 22:51:22 +04:00
|
|
|
void importCertsFromFile(in nsISupports aToken,
|
2002-08-06 17:11:15 +04:00
|
|
|
in nsILocalFile aFile,
|
|
|
|
in unsigned long aType);
|
|
|
|
|
2001-03-20 21:00:44 +03:00
|
|
|
/*
|
|
|
|
* importPKCS12File
|
|
|
|
*
|
|
|
|
* Import a PKCS#12 file contain cert(s) and key(s) into the database.
|
|
|
|
*/
|
2002-09-17 22:51:22 +04:00
|
|
|
void importPKCS12File(in nsISupports aToken,
|
2001-03-20 21:00:44 +03:00
|
|
|
in nsILocalFile aFile);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* exportPKCS12File
|
|
|
|
*
|
|
|
|
* Export a set of certs and keys from the database to a PKCS#12 file.
|
|
|
|
*/
|
2002-09-17 22:51:22 +04:00
|
|
|
void exportPKCS12File(in nsISupports aToken,
|
2001-03-20 21:00:44 +03:00
|
|
|
in nsILocalFile aFile,
|
2002-09-18 21:15:58 +04:00
|
|
|
in unsigned long count,
|
2001-03-30 23:55:00 +04:00
|
|
|
[array, size_is(count)] in nsIX509Cert aCerts);
|
2002-09-24 00:17:16 +04:00
|
|
|
//[array, size_is(count)] in AString aCertNames);
|
2001-05-15 21:35:35 +04:00
|
|
|
/*
|
|
|
|
* getOCSPResponders
|
|
|
|
*
|
|
|
|
* Export a set of OCSP responders i.e. CA names and (optional) URLs.
|
|
|
|
*/
|
|
|
|
nsISupportsArray getOCSPResponders();
|
2001-03-20 21:00:44 +03:00
|
|
|
|
2001-08-10 05:05:57 +04:00
|
|
|
/*
|
|
|
|
* Query about the status of OCSP
|
|
|
|
*/
|
|
|
|
readonly attribute boolean ocspOn;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Use this to temporarily disable OCSP checking.
|
|
|
|
* Needed if OCSP checks slow down UI rendering too much.
|
|
|
|
* A call to this should be followed with a call to
|
|
|
|
* enableOCSP soon afterwards.
|
|
|
|
*/
|
|
|
|
void disableOCSP();
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Sets the OCSP options to correspond with the preferences
|
|
|
|
* values.
|
|
|
|
*/
|
|
|
|
void enableOCSP();
|
2001-10-31 02:52:01 +03:00
|
|
|
|
|
|
|
/*
|
|
|
|
* decode base64 certificate and return a new nsIX509Cert instance
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
nsIX509Cert constructX509FromBase64(in string base64);
|
|
|
|
};
|
2001-01-30 21:34:22 +03:00
|
|
|
|