michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: michael@0: #include "nsISupports.idl" michael@0: michael@0: [scriptable, uuid(2030770e-542e-40cd-8061-cd9d4ad4227f)] michael@0: michael@0: interface nsILoginManagerCrypto : nsISupports { michael@0: michael@0: const unsigned long ENCTYPE_BASE64 = 0; // obsolete michael@0: const unsigned long ENCTYPE_SDR = 1; michael@0: michael@0: /** michael@0: * encrypt michael@0: * michael@0: * @param plainText michael@0: * The string to be encrypted. michael@0: * michael@0: * Encrypts the specified string, returning the ciphertext value. michael@0: * michael@0: * NOTE: The current implemention of this inferface simply uses NSS/PSM's michael@0: * "Secret Decoder Ring" service. It is not recommended for general michael@0: * purpose encryption/decryption. michael@0: * michael@0: * Can throw if the user cancels entry of their master password. michael@0: */ michael@0: AString encrypt(in AString plainText); michael@0: michael@0: /** michael@0: * decrypt michael@0: * michael@0: * @param cipherText michael@0: * The string to be decrypted. michael@0: * michael@0: * Decrypts the specified string, returning the plaintext value. michael@0: * michael@0: * Can throw if the user cancels entry of their master password, or if the michael@0: * cipherText value can not be successfully decrypted (eg, if it was michael@0: * encrypted with some other key). michael@0: */ michael@0: AString decrypt(in AString cipherText); michael@0: michael@0: /** michael@0: * uiBusy michael@0: * michael@0: * True when a master password prompt is being displayed. michael@0: */ michael@0: readonly attribute boolean uiBusy; michael@0: michael@0: /** michael@0: * isLoggedIn michael@0: * michael@0: * Current login state of the token used for encryption. If the user is michael@0: * not logged in, performing a crypto operation will result in a master michael@0: * password prompt. michael@0: */ michael@0: readonly attribute boolean isLoggedIn; michael@0: michael@0: /** michael@0: * defaultEncType michael@0: * michael@0: * Default encryption type used by an implementation of this interface. michael@0: */ michael@0: readonly attribute unsigned long defaultEncType; michael@0: };