|
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/. */ |
|
4 |
|
5 |
|
6 #include "nsISupports.idl" |
|
7 |
|
8 [scriptable, uuid(2030770e-542e-40cd-8061-cd9d4ad4227f)] |
|
9 |
|
10 interface nsILoginManagerCrypto : nsISupports { |
|
11 |
|
12 const unsigned long ENCTYPE_BASE64 = 0; // obsolete |
|
13 const unsigned long ENCTYPE_SDR = 1; |
|
14 |
|
15 /** |
|
16 * encrypt |
|
17 * |
|
18 * @param plainText |
|
19 * The string to be encrypted. |
|
20 * |
|
21 * Encrypts the specified string, returning the ciphertext value. |
|
22 * |
|
23 * NOTE: The current implemention of this inferface simply uses NSS/PSM's |
|
24 * "Secret Decoder Ring" service. It is not recommended for general |
|
25 * purpose encryption/decryption. |
|
26 * |
|
27 * Can throw if the user cancels entry of their master password. |
|
28 */ |
|
29 AString encrypt(in AString plainText); |
|
30 |
|
31 /** |
|
32 * decrypt |
|
33 * |
|
34 * @param cipherText |
|
35 * The string to be decrypted. |
|
36 * |
|
37 * Decrypts the specified string, returning the plaintext value. |
|
38 * |
|
39 * Can throw if the user cancels entry of their master password, or if the |
|
40 * cipherText value can not be successfully decrypted (eg, if it was |
|
41 * encrypted with some other key). |
|
42 */ |
|
43 AString decrypt(in AString cipherText); |
|
44 |
|
45 /** |
|
46 * uiBusy |
|
47 * |
|
48 * True when a master password prompt is being displayed. |
|
49 */ |
|
50 readonly attribute boolean uiBusy; |
|
51 |
|
52 /** |
|
53 * isLoggedIn |
|
54 * |
|
55 * Current login state of the token used for encryption. If the user is |
|
56 * not logged in, performing a crypto operation will result in a master |
|
57 * password prompt. |
|
58 */ |
|
59 readonly attribute boolean isLoggedIn; |
|
60 |
|
61 /** |
|
62 * defaultEncType |
|
63 * |
|
64 * Default encryption type used by an implementation of this interface. |
|
65 */ |
|
66 readonly attribute unsigned long defaultEncType; |
|
67 }; |