Bug 1928997: Update tabs icon in Unified Search popup r=desktop-theme-reviewers,daleh...
[gecko.git] / security / manager / ssl / nsIX509Cert.idl
blobba14cc898e6551c8585b010a16238e8162d25e6a
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"
9 interface nsIArray;
10 interface nsIX509CertValidity;
11 interface nsICertVerificationListener;
13 %{ C++
14 namespace IPC {
15 class MessageReader;
16 class MessageWriter;
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);
27 /**
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 {
38 /**
39 * The primary email address of the certificate, if present.
41 readonly attribute AString emailAddress;
43 /**
44 * Obtain a list of all email addresses
45 * contained in the certificate.
47 * @return An array of email addresses.
49 [must_use]
50 Array<AString> getEmailAddresses();
52 /**
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.
61 [must_use]
62 boolean containsEmailAddress(in AString aEmailAddress);
64 /**
65 * The subject owning the certificate.
67 readonly attribute AString subjectName;
69 /**
70 * The subject's common name.
72 readonly attribute AString commonName;
74 /**
75 * The subject's organization.
77 readonly attribute AString organization;
79 /**
80 * The subject's organizational unit.
82 [must_use]
83 readonly attribute AString organizationalUnit;
85 /**
86 * The fingerprint of the certificate's DER encoding,
87 * calculated using the SHA-256 algorithm.
89 readonly attribute AString sha256Fingerprint;
91 /**
92 * The fingerprint of the certificate's DER encoding,
93 * calculated using the SHA1 algorithm.
95 [must_use]
96 readonly attribute AString sha1Fingerprint;
98 /**
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.
112 [must_use]
113 readonly attribute AString serialNumber;
116 * The issuer subject's common name.
118 [must_use]
119 readonly attribute AString issuerCommonName;
122 * The issuer subject's organization.
124 readonly attribute AString issuerOrganization;
127 * The issuer subject's organizational unit.
129 [must_use]
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.
140 [must_use]
141 readonly attribute ACString dbKey;
144 * A human readable identifier to label this certificate.
146 [must_use]
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
166 * in DER format.
168 * @return The bytes representing the DER encoded certificate.
170 [must_use]
171 Array<octet> getRawDER();
174 * Obtain a base 64 string representation of this certificate
175 * in DER format.
177 * @return The DER encoded certificate as a string.
179 [must_use]
180 ACString getBase64DERString();
183 * The base64 encoding of the DER encoded public key info using the specified
184 * digest.
186 [must_use]
187 readonly attribute ACString sha256SubjectPublicKeyInfoDigest;
190 * Retrieves the NSS certificate object wrapped by this interface
192 [notxpcom, noscript, must_use]
193 CERTCertificatePtr getCert();
195 [notxpcom, noscript]
196 void SerializeToIPC(in IpcMessageWriterPtr aWriter);
198 [notxpcom, noscript]
199 boolean DeserializeFromIPC(in IpcMessageReaderPtr aReader);