Back to index

enigmail  1.4.3
nsIEnigmail.idl
Go to the documentation of this file.
00001 /* ***** BEGIN LICENSE BLOCK *****
00002  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
00003  *
00004  * The contents of this file are subject to the Mozilla Public
00005  * License Version 1.1 (the "MPL"); you may not use this file
00006  * except in compliance with the MPL. You may obtain a copy of
00007  * the MPL at http://www.mozilla.org/MPL/
00008  *
00009  * Software distributed under the MPL is distributed on an "AS
00010  * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
00011  * implied. See the MPL for the specific language governing
00012  * rights and limitations under the MPL.
00013  *
00014  * The Original Code is Enigmail.
00015  *
00016  * The Initial Developer of the Original Code is Ramalingam Saravanan.
00017  * Portions created by Ramalingam Saravanan <svn@xmlterm.org> are
00018  * Copyright (C) 2001 Ramalingam Saravanan. All Rights Reserved.
00019  *
00020  * Contributor(s):
00021  * Patrick Brunschwig <patrick@mozilla-enigmail.org>
00022  *
00023  * Alternatively, the contents of this file may be used under the terms of
00024  * either the GNU General Public License Version 2 or later (the "GPL"), or
00025  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
00026  * in which case the provisions of the GPL or the LGPL are applicable instead
00027  * of those above. If you wish to allow use of your version of this file only
00028  * under the terms of either the GPL or the LGPL, and not to allow others to
00029  * use your version of this file under the terms of the MPL, indicate your
00030  * decision by deleting the provisions above and replace them with the notice
00031  * and other provisions required by the GPL or the LGPL. If you do not delete
00032  * the provisions above, a recipient may use your version of this file under
00033  * the terms of any one of the MPL, the GPL or the LGPL.
00034  * ***** END LICENSE BLOCK ***** */
00035 
00036 #include "nsISupports.idl"
00037 #include "nsIIPCBuffer.idl"
00038 
00039 interface nsIDOMWindow;
00040 interface nsIDOMDocument;
00041 interface nsIMsgWindow;
00042 interface nsIPrompt;
00043 interface nsIPrefBranch;
00044 interface nsIStreamListener;
00045 interface nsIPipeTransport;
00046 interface nsIIPCRequest;
00047 interface nsIRequestObserver;
00048 interface nsIFileOutputStream;
00049 interface nsIIPCBuffer;
00050 interface nsIEnigMimeReadCallback;
00051 interface nsIFile;
00052 interface nsIFile;
00053 
00057 [scriptable, uuid(847b3a00-7ab1-11d4-8f02-006008948af5)]
00058 interface nsIEnigmail : nsISupports
00059 {
00060   readonly attribute string agentType;        /* always "gpg" */
00061   readonly attribute string agentVersion;     /* version string */
00062 
00063   readonly attribute nsIFile agentPath;        /* executable path */
00064 
00065   readonly attribute boolean isWin32;         /* Win32 system */
00066   readonly attribute boolean isDosLike;       /* DOS-like system (Win32, OS/2) */
00067 
00068   readonly attribute nsIIPCRequest keygenRequest;
00069 
00070   readonly attribute long maxIdleMinutes;
00071 
00072   readonly attribute boolean initialized;
00073   attribute boolean initializationAttempted;
00074   readonly attribute string initializationError;
00075 
00076   readonly attribute boolean composeSecure;
00077   readonly attribute nsIFileOutputStream logFileStream;
00078 
00079   void initialize(in nsIDOMWindow domWindow, in string version,
00080                   in nsIPrefBranch enigmailPrefs);
00081   void reinitialize();
00082   void finalize();
00083   boolean mimeInitialized();
00084   boolean useGpgAgent();     /* is gpg-agent used */
00085 
00086   void stillActive();
00087 
00088   string getLogDirectoryPrefix();
00089 
00090   nsIPipeTransport encryptMessageStart(in nsIDOMWindow parent,
00091                                        in nsIPrompt prompter,
00092                                        in unsigned long uiFlags,
00093                                        in string  fromMailAddr,
00094                                        in string  toMailAddr,
00095                                        in string  bccMailAddr,
00096                                        in string  hashAlgorithm,
00097                                        in unsigned long sendFlags,
00098                                        in nsIStreamListener listener,
00099                                        out unsigned long statusFlags,
00100                                        out wstring errorMsg);
00101 
00102   long encryptMessageEnd(in nsIDOMWindow parent,
00103                          in nsIPrompt prompter,
00104                          in unsigned long uiFlags,
00105                          in unsigned long sendFlags,
00106                          in unsigned long outputLen,
00107                          in nsIPipeTransport pipeTransport,
00108                          out unsigned long statusFlags,
00109                          out wstring errorMsg);
00110 
00111   nsIPipeTransport decryptMessageStart(in nsIDOMWindow parent,
00112                                        in nsIPrompt prompter,
00113                                        in boolean verifyOnly,
00114                                        in boolean noOutput,
00115                                        in nsIStreamListener listener,
00116                                        out unsigned long statusFlags,
00117                                        out wstring errorMsg);
00118 
00119   long decryptMessageEnd(in unsigned long uiFlags,
00120                          in unsigned long outputLen,
00121                          in nsIPipeTransport pipeTransport,
00122                          in boolean verifyOnly,
00123                          in boolean noOutput,
00124                          out unsigned long statusFlags,
00125                          out wstring keyId,
00126                          out wstring userId,
00127                          out wstring sigDetails,
00128                          out wstring errorMsg,
00129                          out wstring blockSeparation);
00130 
00131   boolean stripWhitespace(in unsigned long sendFlags);
00132 
00133   string locateArmoredBlock(in string text,
00134                             in long offset,
00135                             in string indentStr,
00136                             out long beginIndex,
00137                             out long endIndex,
00138                             out string foundIndentStr);
00139 
00140   long determineHashAlgorithm(in nsIPrompt prompter,
00141                               in unsigned long uiFlags,
00142                               in string  fromMailAddr,
00143                               out wstring hashAlgorithm);
00144 
00145   /* Cleartext signature parts */
00146   const long SIGNATURE_TEXT    = 1;
00147   const long SIGNATURE_HEADERS = 2;
00148   const long SIGNATURE_ARMOR   = 3;
00149 
00150   string extractSignaturePart(in string signatureBlock,
00151                               in long part);
00152 
00153   /* User interaction flags */
00154   const long UI_INTERACTIVE           = 0x01;
00155   const long UI_ALLOW_KEY_IMPORT      = 0x02;
00156   const long UI_UNVERIFIED_ENC_OK     = 0x04;
00157   const long UI_PGP_MIME              = 0x08;
00158   const long UI_TEST                  = 0x10;
00159   const long UI_RESTORE_STRICTLY_MIME = 0x20;
00160 
00161   /* Send message flags */
00162   const long SEND_SIGNED           = 0x001;
00163   const long SEND_ENCRYPTED        = 0x002;
00164   const long SEND_DEFAULT          = 0x004;
00165   const long SEND_LATER            = 0x008;
00166   const long SEND_WITH_CHECK       = 0x010;
00167   const long SEND_ALWAYS_TRUST     = 0x020;
00168   const long SEND_ENCRYPT_TO_SELF  = 0x040;
00169   const long SEND_PGP_MIME         = 0x080;
00170   const long SEND_TEST             = 0x100;
00171   const long SAVE_MESSAGE          = 0x200;
00172   const long SEND_STRIP_WHITESPACE = 0x400;
00173   const long SEND_ATTACHMENT       = 0x800;
00174 
00175   wstring encryptMessage(in nsIDOMWindow parent,
00176                         in unsigned long uiFlags,
00177                         in string hashAlgorithm,
00178                         in string  plainText,
00179                         in string  fromMailAddr,
00180                         in string  toMailAddr,
00181                         in string  bccMailAddr,
00182                         in unsigned long sendFlags,
00183                         out long exitCode,
00184                         out unsigned long statusFlags,
00185                         out wstring errorMsg);
00186 
00187   /* Status flags */
00188   const long GOOD_SIGNATURE       = 0x000001;
00189   const long BAD_SIGNATURE        = 0x000002;
00190   const long UNVERIFIED_SIGNATURE = 0x000004;
00191   const long EXPIRED_SIGNATURE    = 0x000008;
00192   const long EXPIRED_KEY_SIGNATURE= 0x000010;
00193   const long EXPIRED_KEY          = 0x000020;
00194   const long REVOKED_KEY          = 0x000040;
00195   const long NO_PUBKEY            = 0x000080;
00196   const long NO_SECKEY            = 0x000100;
00197   const long IMPORTED_KEY         = 0x000200;
00198   const long INVALID_RECIPIENT    = 0x000400;
00199   const long MISSING_PASSPHRASE   = 0x000800;
00200   const long BAD_PASSPHRASE       = 0x001000;
00201   const long BAD_ARMOR            = 0x002000;
00202   const long NODATA               = 0x004000;
00203   const long DECRYPTION_INCOMPLETE= 0x008000;
00204   const long DECRYPTION_FAILED    = 0x010000;
00205   const long DECRYPTION_OKAY      = 0x020000;
00206   const long UNTRUSTED_IDENTITY   = 0x040000;
00207   const long TRUSTED_IDENTITY     = 0x00080000;
00208   const long PGP_MIME_SIGNED      = 0x00100000;
00209   const long PGP_MIME_ENCRYPTED   = 0x00200000;
00210   const long DISPLAY_MESSAGE      = 0x00400000;
00211   const long INLINE_KEY           = 0x00800000;
00212   const long PARTIALLY_PGP        = 0x01000000;
00213   const long PHOTO_AVAILABLE      = 0x02000000;
00214   const long OVERFLOWED           = 0x04000000;
00215   const long CARDCTRL             = 0x08000000;
00216   const long SC_OP_FAILURE        = 0x10000000;
00217   const long UNKNOWN_ALGO         = 0x20000000;
00218   const long SIG_CREATED          = 0x40000000;
00219   const unsigned long END_ENCRYPTION       = 0x80000000;
00220 
00221   wstring decryptMessage(in nsIDOMWindow parent,
00222                         in unsigned long uiFlags,
00223                         in string  cipherText,
00224                         inout string signature,
00225                         out long exitCode,
00226                         out unsigned long statusFlags,
00227                         out wstring keyId,
00228                         out wstring userId,
00229                         out wstring sigDetails,
00230                         out wstring errorMsg,
00231                         out wstring blockSeparation);
00232 
00233   boolean deleteMessageURI(in string uri);
00234 
00235   boolean selectPanel(in string url);
00236 
00237   string getGnupgConfig (out long exitCodeObj, out wstring errorMsgObj);
00238 
00239 /*** key handling functions ***/
00240 
00241   long addPhoto (in nsIDOMWindow parent,
00242                   in string keyId,
00243                   in nsIFile photoFile,
00244                   out wstring errorMsg);
00245 
00246   string getKeySig (in string keyId,
00247                     out long exitCode,
00248                     out wstring errorMsg);
00249 
00250   string getKeyDetails (in string keyId,
00251                         in boolean uidOnly);
00252 
00253   string showKeyPhoto (in string keyId,
00254                        in long photoNumber,
00255                        out long exitCode,
00256                        out wstring errorMsg);
00257 
00258   const long EXTRACT_SECRET_KEY = 0x01;
00259 
00260   string extractKey(in nsIDOMWindow parent,
00261                     in unsigned long exportFlags,
00262                     in string userId,
00263                     in nsIFile outputFile,
00264                     out long   exitCode,
00265                     out wstring errorMsg);
00266 
00267   long importKey(in nsIDOMWindow parent,
00268                  in unsigned long uiFlags,
00269                  in string msgText,
00270                  in string keyId,
00271                  out wstring errorMsg);
00272 
00273   long importKeyFromFile(in nsIDOMWindow parent,
00274                  in nsIFile inputFile,
00275                  out string errorMsg,
00276                  out wstring importedKeys);
00277 
00278   /* Receive flags */
00279   const long SEARCH_KEY       = 0x01;
00280   const long DOWNLOAD_KEY     = 0x02;
00281   const long UPLOAD_KEY       = 0x04;
00282   const long REFRESH_KEY      = 0x08;
00283 
00284   string createMessageURI(in string originalUrl,
00285                           in string contentType,
00286                           in string contentCharset,
00287                           in string contentData,
00288                           in boolean persist);
00289 
00290   /* manage GPG key list cache */
00291 
00292   string getUserIdList (in boolean secretOnly,
00293                         in boolean refresh,
00294                         out long exitCode,
00295                         out unsigned long statusFlags,
00296                         out wstring errorMsg);
00297 
00298   void invalidateUserIdList();
00299 
00300 
00301   /* attachment handling */
00302 
00303   string encryptAttachment (in nsIDOMWindow parent,
00304                             in string fromMailAddr,
00305                             in string toMailAddr,
00306                             in string bccMailAddr,
00307                             in unsigned long sendFlags,
00308                             in nsIFile inFile,
00309                             in nsIFile outFile,
00310                             out long exitCode,
00311                             out unsigned long statusFlags,
00312                             out wstring errorMsg);
00313 
00314   wstring getAttachmentFileName(in nsIDOMWindow parent,
00315                                in nsIIPCBuffer ipcBuffer);
00316 
00317   boolean decryptAttachment (in nsIDOMWindow parent,
00318                              in nsIFile outFile,
00319                              in string displayName,
00320                              in nsIIPCBuffer ipcBuffer,
00321                              out long exitCode,
00322                              out unsigned long statusFlags,
00323                              out wstring errorMsg);
00324 
00325   long verifyAttachment (in nsIDOMWindow parent,
00326                          in nsIFile verifyFile,
00327                          in nsIFile sigFile,
00328                          out unsigned long statusFlags,
00329                          out wstring errorMsg);
00330 
00331   /* per-recipient rules */
00332 
00333   boolean getRulesData(out nsIDOMDocument rulesList);
00334 
00335   void addRule(in boolean appendToEnd,
00336                in string toAddress,
00337                in string keyList,
00338                in long sign,
00339                in long encrypt,
00340                in long pgpMime,
00341                in long flags);
00342 
00343   boolean saveRulesFile();
00344   void clearRules();
00345 
00346   /* smartcard functions */
00347   string getCardStatus (out long exitCode,
00348                         out wstring errorMsg);
00349 
00350   long genCardKey (in nsIDOMWindow parent,
00351                    in string name,
00352                    in string email,
00353                    in string comment,
00354                    in string expiry,
00355                    in string backupPasswd,
00356                    in nsIEnigMimeReadCallback requestObserver,
00357                    out wstring errorMsg);
00358 
00359   long cardAdminData(in nsIDOMWindow parent,
00360                      in string name,
00361                      in string firstname,
00362                      in string lang,
00363                      in string sex,
00364                      in string url,
00365                      in string login,
00366                      in long forcepin,
00367                      out wstring errorMsg);
00368 
00369   const long CARD_PIN_CHANGE       = 1;
00370   const long CARD_PIN_UNBLOCK      = 2;
00371   const long CARD_ADMIN_PIN_CHANGE = 3;
00372 
00373   long cardChangePin(in nsIDOMWindow parent,
00374                      in long action,
00375                      in string oldPin,
00376                      in string newPin,
00377                      in string adminPin,
00378                      in nsIEnigMimeReadCallback requestObserver,
00379                      out wstring errorMsg);
00380 
00381 };
00382 
00383 %{C++
00384 
00385 #define NS_ENIGMAIL_CLASSNAME  "Enigmail"
00386 #define NS_ENIGMAIL_CONTRACTID "@mozdev.org/enigmail/enigmail;1"
00387 
00388 #define NS_ENIGMAIL_CID                          \
00389 { /* 847b3a01-7ab1-11d4-8f02-006008948af5 */     \
00390    0x847b3a01, 0x7ab1, 0x11d4,                   \
00391 {0x8f, 0x02, 0x00, 0x60, 0x08, 0x94, 0x8a, 0xf5} }
00392 
00393 %}
00394