nsISecretDecoderRing.idl 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
  2. /* This Source Code Form is subject to the terms of the Mozilla Public
  3. * License, v. 2.0. If a copy of the MPL was not distributed with this
  4. * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
  5. #include "nsISupports.idl"
  6. [scriptable, uuid(0EC80360-075C-11d4-9FD4-00C04F1B83D8)]
  7. interface nsISecretDecoderRing: nsISupports {
  8. /**
  9. * Encrypt to Base64 output.
  10. * Note that the input must basically be a byte array (i.e. the code points
  11. * must be within the range [0, 255]). Hence, using this method directly to
  12. * encrypt passwords (or any text, really) won't work as expected.
  13. * Instead, use something like nsIScriptableUnicodeConverter to first convert
  14. * the desired password or text to UTF-8, then encrypt that. Remember to
  15. * convert back when calling decryptString().
  16. *
  17. * @param text The text to encrypt.
  18. * @return The encrypted text, encoded as Base64.
  19. */
  20. ACString encryptString(in ACString text);
  21. /**
  22. * Decrypt Base64 input.
  23. * See the encryptString() documentation - this method has basically the same
  24. * limitations.
  25. *
  26. * @param encryptedBase64Text Encrypted input text, encoded as Base64.
  27. * @return The decoded text.
  28. */
  29. ACString decryptString(in ACString encryptedBase64Text);
  30. /**
  31. * Prompt the user to change the password on the SDR key.
  32. */
  33. void changePassword();
  34. /**
  35. * Logout of the security device that protects the SDR key.
  36. */
  37. void logout();
  38. /**
  39. * Logout of the security device that protects the SDR key and tear
  40. * down authenticated objects.
  41. */
  42. void logoutAndTeardown();
  43. };