summaryrefslogtreecommitdiffstats
path: root/security/manager/ssl/nsILocalCertService.idl
blob: a452683d97f87ee11012aa7b89d5340aaa3512fa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

#include "nsISupports.idl"

interface nsIX509Cert;
interface nsILocalCertGetCallback;
interface nsILocalCertCallback;

[scriptable, uuid(9702fdd4-4c2c-439c-ba2e-19cda018eb99)]
interface nsILocalCertService : nsISupports
{
  /**
   * Get or create a new self-signed X.509 cert to represent this device over a
   * secure transport, like TLS.
   *
   * The cert is stored permanently in the profile's key store after first use,
   * and is valid for 1 year.  If an expired or otherwise invalid cert is found
   * with the nickname supplied here, it is removed and a new one is made.
   *
   * @param nickname Nickname that identifies the cert
   * @param cb       Callback to be notified with the result
   */
  void getOrCreateCert(in ACString nickname, in nsILocalCertGetCallback cb);

  /**
   * Remove a X.509 cert with the given nickname.
   *
   * @param nickname Nickname that identifies the cert
   * @param cb       Callback to be notified with the result
   */
  void removeCert(in ACString nickname, in nsILocalCertCallback cb);

  /**
   * Whether calling |getOrCreateCert| or |removeCert| will trigger a login
   * prompt to be displayed.  Generally this happens if the user has set a
   * master password, but has not yet logged in.
   */
  readonly attribute boolean loginPromptRequired;
};

[scriptable, uuid(cc09633e-7c70-4093-a9cf-79ab676ca8a9)]
interface nsILocalCertGetCallback : nsISupports
{
  /**
   * Called with the result of the getOrCreateCert operation above.
   *
   * @param cert   Requested cert, or null if some error
   * @param result Result code from the get operation
   */
  void handleCert(in nsIX509Cert cert, in nsresult result);
};

[scriptable, uuid(518124e9-55e6-4e23-97c0-4995b3a1bec6)]
interface nsILocalCertCallback : nsISupports
{
  /**
   * Called with the result of the removeCert operation above.
   *
   * @param result Result code from the operation
   */
  void handleResult(in nsresult result);
};

%{ C++
#define LOCALCERTSERVICE_CONTRACTID \
  "@mozilla.org/security/local-cert-service;1"
%}