1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
3 * This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #include
"nsISupports.idl"
10 interface nsIX509CertValidity
;
11 interface nsICertVerificationListener
;
19 /* forward declaration */
20 typedef struct CERTCertificateStr CERTCertificate
;
23 [ptr] native CERTCertificatePtr
(CERTCertificate
);
24 [ptr] native IpcMessageReaderPtr
(IPC
::MessageReader
);
25 [ptr] native IpcMessageWriterPtr
(IPC
::MessageWriter
);
28 * This represents a X.509 certificate.
30 * NOTE: Service workers persist x.509 certs in object form on disk. If you
31 * change this uuid you probably need a hack in nsBinaryInputStream to
32 * read the old uuid. If you change the format of the object
33 * serialization then more complex changes will be needed.
35 [scriptable
, builtinclass
, uuid(bdc3979a
-5422-4cd5
-8589-696b6e96ea83
)]
36 interface nsIX509Cert
: nsISupports
{
39 * The primary email address of the certificate, if present.
41 readonly attribute AString emailAddress
;
44 * Obtain a list of all email addresses
45 * contained in the certificate.
47 * @return An array of email addresses.
50 Array
<AString
> getEmailAddresses
();
53 * Check whether a given address is contained in the certificate.
54 * The comparison will convert the email address to lowercase.
55 * The behaviour for non ASCII characters is undefined.
57 * @param aEmailAddress The address to search for.
59 * @return True if the address is contained in the certificate.
62 boolean containsEmailAddress
(in AString aEmailAddress
);
65 * The subject owning the certificate.
67 readonly attribute AString subjectName
;
70 * The subject's common name.
72 readonly attribute AString commonName
;
75 * The subject's organization.
77 readonly attribute AString organization
;
80 * The subject's organizational unit.
83 readonly attribute AString organizationalUnit
;
86 * The fingerprint of the certificate's DER encoding,
87 * calculated using the SHA-256 algorithm.
89 readonly attribute AString sha256Fingerprint
;
92 * The fingerprint of the certificate's DER encoding,
93 * calculated using the SHA1 algorithm.
96 readonly attribute AString sha1Fingerprint
;
99 * A human readable name identifying the hardware or
100 * software token the certificate is stored on.
102 readonly attribute AString tokenName
;
105 * The subject identifying the issuer certificate.
107 readonly attribute AString issuerName
;
110 * The serial number the issuer assigned to this certificate.
113 readonly attribute AString serialNumber
;
116 * The issuer subject's common name.
119 readonly attribute AString issuerCommonName
;
122 * The issuer subject's organization.
124 readonly attribute AString issuerOrganization
;
127 * The issuer subject's organizational unit.
130 readonly attribute AString issuerOrganizationUnit
;
133 * This certificate's validity period.
135 readonly attribute nsIX509CertValidity validity
;
138 * A unique identifier of this certificate within the local storage.
141 readonly attribute ACString dbKey
;
144 * A human readable identifier to label this certificate.
147 readonly attribute AString displayName
;
150 * Constants to classify the type of a certificate.
152 const unsigned long UNKNOWN_CERT
= 0;
153 const unsigned long CA_CERT
= 1 << 0;
154 const unsigned long USER_CERT
= 1 << 1;
155 const unsigned long EMAIL_CERT
= 1 << 2;
156 const unsigned long SERVER_CERT
= 1 << 3;
157 const unsigned long ANY_CERT
= 0xffff;
160 * Type of this certificate
162 readonly attribute
unsigned long certType
;
165 * Obtain a raw binary encoding of this certificate
168 * @return The bytes representing the DER encoded certificate.
171 Array
<octet
> getRawDER
();
174 * Obtain a base 64 string representation of this certificate
177 * @return The DER encoded certificate as a string.
180 ACString getBase64DERString
();
183 * The base64 encoding of the DER encoded public key info using the specified
187 readonly attribute ACString sha256SubjectPublicKeyInfoDigest
;
190 * Retrieves the NSS certificate object wrapped by this interface
192 [notxpcom
, noscript
, must_use
]
193 CERTCertificatePtr getCert
();
196 void SerializeToIPC
(in IpcMessageWriterPtr aWriter
);
199 boolean DeserializeFromIPC
(in IpcMessageReaderPtr aReader
);