Bug 1845134 - Part 4: Update existing ui-icons to use the latest source from acorn...
[gecko.git] / netwerk / base / nsITLSServerSocket.idl
blobe944f23af72cd92180fbf9f0d73827fde1081c4b
1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 #include "nsIServerSocket.idl"
7 interface nsIX509Cert;
8 interface nsITLSServerSecurityObserver;
9 interface nsISocketTransport;
11 [scriptable, uuid(cc2c30f9-cfaa-4b8a-bd44-c24881981b74)]
12 interface nsITLSServerSocket : nsIServerSocket
14 /**
15 * serverCert
17 * The server's certificate that is presented to the client during the TLS
18 * handshake. This is required to be set before calling |asyncListen|.
20 attribute nsIX509Cert serverCert;
22 /**
23 * setSessionTickets
25 * Whether the server should support session tickets. Defaults to true. This
26 * should be set before calling |asyncListen| if you wish to change the
27 * default.
29 void setSessionTickets(in boolean aSessionTickets);
31 /**
32 * Values for setRequestClientCertificate
34 // Never request
35 const unsigned long REQUEST_NEVER = 0;
36 // Request (but do not require) during the first handshake only
37 const unsigned long REQUEST_FIRST_HANDSHAKE = 1;
38 // Request (but do not require) during each handshake
39 const unsigned long REQUEST_ALWAYS = 2;
40 // Require during the first handshake only
41 const unsigned long REQUIRE_FIRST_HANDSHAKE = 3;
42 // Require during each handshake
43 const unsigned long REQUIRE_ALWAYS = 4;
45 /**
46 * setRequestClientCertificate
48 * Whether the server should request and/or require a client auth certificate
49 * from the client. Defaults to REQUEST_NEVER. See the possible options
50 * above. This should be set before calling |asyncListen| if you wish to
51 * change the default.
53 void setRequestClientCertificate(in unsigned long aRequestClientCert);
55 /**
56 * setVersionRange
58 * The server's TLS versions that is used by the TLS handshake.
59 * This is required to be set before calling |asyncListen|.
61 * aMinVersion and aMaxVersion is a TLS version value from
62 * |nsITLSClientStatus| constants.
64 void setVersionRange(in unsigned short aMinVersion,
65 in unsigned short aMaxVersion);
68 /**
69 * Security summary for a given TLS client connection being handled by a
70 * |nsITLSServerSocket| server.
72 * This is accessible through the security info object on the transport, which
73 * will be an instance of |nsITLSServerConnectionInfo| (see below).
75 * The values of these attributes are available once the |onHandshakeDone|
76 * method of the security observer has been called (see
77 * |nsITLSServerSecurityObserver| below).
79 [scriptable, uuid(19668ea4-e5ad-4182-9698-7e890d48f327)]
80 interface nsITLSClientStatus : nsISupports
82 /**
83 * peerCert
85 * The client's certificate, if one was requested via |requestCertificate|
86 * above and supplied by the client.
88 readonly attribute nsIX509Cert peerCert;
90 /**
91 * Values for tlsVersionUsed, as defined by TLS
93 const short SSL_VERSION_3 = 0x0300;
94 const short TLS_VERSION_1 = 0x0301;
95 const short TLS_VERSION_1_1 = 0x0302;
96 const short TLS_VERSION_1_2 = 0x0303;
97 const short TLS_VERSION_1_3 = 0x0304;
98 const short TLS_VERSION_UNKNOWN = -1;
101 * tlsVersionUsed
103 * The version of TLS used by the connection. See values above.
105 readonly attribute short tlsVersionUsed;
108 * cipherName
110 * Name of the cipher suite used, such as
111 * "TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256".
112 * See security/nss/lib/ssl/sslinfo.c for the possible values.
114 readonly attribute ACString cipherName;
117 * keyLength
119 * The "effective" key size of the symmetric key in bits.
121 readonly attribute unsigned long keyLength;
124 * macLength
126 * The size of the MAC in bits.
128 readonly attribute unsigned long macLength;
132 * Connection info for a given TLS client connection being handled by a
133 * |nsITLSServerSocket| server. This object is thread-safe.
135 * This is exposed as the security info object on the transport, so it can be
136 * accessed via |transport.securityInfo|.
138 * This interface is available by the time the |onSocketAttached| is called,
139 * which is the first time the TLS server consumer is notified of a new client.
141 [scriptable, uuid(8a93f5d5-eddd-4c62-a4bd-bfd297653184)]
142 interface nsITLSServerConnectionInfo : nsISupports
145 * setSecurityObserver
147 * Set the security observer to be notified when the TLS handshake has
148 * completed.
150 void setSecurityObserver(in nsITLSServerSecurityObserver observer);
153 * serverSocket
155 * The nsITLSServerSocket instance that accepted this client connection.
157 readonly attribute nsITLSServerSocket serverSocket;
160 * status
162 * Security summary for this TLS client connection. Note that the values of
163 * this interface are not available until the TLS handshake has completed.
164 * See |nsITLSClientStatus| above for more details.
166 readonly attribute nsITLSClientStatus status;
169 [scriptable, uuid(1f62e1ae-e546-4a38-8917-d428472ed736)]
170 interface nsITLSServerSecurityObserver : nsISupports
173 * onHandsakeDone
175 * This method is called once the TLS handshake is completed. This takes
176 * place after |onSocketAccepted| has been called, which typically opens the
177 * streams to keep things moving along. It's important to be aware that the
178 * handshake has not completed at the point that |onSocketAccepted| is called,
179 * so no security verification can be done until this method is called.
181 void onHandshakeDone(in nsITLSServerSocket aServer,
182 in nsITLSClientStatus aStatus);