-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is Mozilla Communicator.
- *
- * The Initial Developer of the Original Code is
- * Netscape Communications Corp..
- * Portions created by the Initial Developer are Copyright (C) 2002
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- * Kai Engert <kaie@netscape.com>
- * Copyright (c) 2010 CASSIDIAN - All rights reserved
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 2 or later (the "GPL"), or
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-const nsIPKIParamBlock = Components.interfaces.nsIPKIParamBlock;
-const nsIDialogParamBlock = Components.interfaces.nsIDialogParamBlock;
-const nsIX509Cert = Components.interfaces.nsIX509Cert;
-const nsICMSMessageErrors = Components.interfaces.nsICMSMessageErrors;
-const nsICertificateDialogs = Components.interfaces.nsICertificateDialogs;
-const nsCertificateDialogs = "@mozilla.org/nsCertificateDialogs;1"
-
-var gSignerCert = null;
-var gEncryptionCert = null;
-
-var gSignatureStatus = -1;
-var gEncryptionStatus = -1;
-
-var gSecurityPolicyIdentifier = null;
-var gSecurityClassification = -1;
-var gPrivacyMark = null;
-var gSecurityCategories = null;
-
-var gSecurityLabelConf = null;
-
-var gSecureHeaders = "";
-var gSecureHeadersState = -1;
-var params = null;
-
-function setText(id, value) {
- var element = document.getElementById(id);
- if (!element)
- return;
- if (element.hasChildNodes())
- element.removeChild(element.firstChild);
- var textNode = document.createTextNode(value);
- element.appendChild(textNode);
-}
-
-function onLoad()
-{
- var pkiParams = window.arguments[0].QueryInterface(nsIPKIParamBlock);
- var isupport = pkiParams.getISupportAtIndex(1);
- if (isupport) {
- gSignerCert = isupport.QueryInterface(nsIX509Cert);
- }
- isupport = pkiParams.getISupportAtIndex(2);
- if (isupport) {
- gEncryptionCert = isupport.QueryInterface(nsIX509Cert);
- }
-
- params = pkiParams.QueryInterface(nsIDialogParamBlock);
-
- gSignatureStatus = params.GetInt(1);
- gEncryptionStatus = params.GetInt(2);
- gSecurityClassification = params.GetInt(3);
- gSecureHeadersState = params.GetInt(4);
-
- gSecurityPolicyIdentifier = params.GetString(0);
- gPrivacyMark = params.GetString(1);
- gSecurityCategories = params.GetString(2);
- gSecureHeaders = params.GetString(12);
-
- if (!gSecurityLabelConf)
- gSecurityLabelConf = new securityLabelConf();
-
- var bundle = document.getElementById("bundle_smime_read_info");
- var bundle_secure_headers = document.getElementById("bundle_smime_secure_headers");
-
- if (bundle) {
- var sigInfoLabel = null;
- var sigInfoHeader = null;
- var sigInfo = null;
- var sigInfo_clueless = false;
-
- switch (gSignatureStatus) {
- case -1:
- case nsICMSMessageErrors.VERIFY_NOT_SIGNED:
- sigInfoLabel = "SINoneLabel";
- sigInfo = "SINone";
- break;
-
- case nsICMSMessageErrors.SUCCESS:
- sigInfoLabel = "SIValidLabel";
- sigInfo = "SIValid";
- break;
-
-
- case nsICMSMessageErrors.VERIFY_BAD_SIGNATURE:
- case nsICMSMessageErrors.VERIFY_DIGEST_MISMATCH:
- sigInfoLabel = "SIInvalidLabel";
- sigInfoHeader = "SIInvalidHeader";
- sigInfo = "SIContentAltered";
- break;
-
- case nsICMSMessageErrors.VERIFY_UNKNOWN_ALGO:
- case nsICMSMessageErrors.VERIFY_UNSUPPORTED_ALGO:
- sigInfoLabel = "SIInvalidLabel";
- sigInfoHeader = "SIInvalidHeader";
- sigInfo = "SIInvalidCipher";
- break;
-
- case nsICMSMessageErrors.VERIFY_HEADER_MISMATCH:
- sigInfoLabel = "SIPartiallyValidLabel";
- sigInfoHeader = "SIPartiallyValidHeader";
- sigInfo = "SIHeaderMismatch";
- break;
-
- case nsICMSMessageErrors.VERIFY_CERT_WITHOUT_ADDRESS:
- sigInfoLabel = "SIPartiallyValidLabel";
- sigInfoHeader = "SIPartiallyValidHeader";
- sigInfo = "SICertWithoutAddress";
- break;
-
- case nsICMSMessageErrors.VERIFY_UNTRUSTED:
- sigInfoLabel = "SIInvalidLabel";
- sigInfoHeader = "SIInvalidHeader";
- sigInfo = "SIUntrustedCA";
- // XXX Need to extend to communicate better errors
- // might also be:
- // SIExpired SIRevoked SINotYetValid SIUnknownCA SIExpiredCA SIRevokedCA SINotYetValidCA
- break;
-
- case nsICMSMessageErrors.VERIFY_NOT_YET_ATTEMPTED:
- case nsICMSMessageErrors.GENERAL_ERROR:
- case nsICMSMessageErrors.VERIFY_NO_CONTENT_INFO:
- case nsICMSMessageErrors.VERIFY_BAD_DIGEST:
- case nsICMSMessageErrors.VERIFY_NOCERT:
- case nsICMSMessageErrors.VERIFY_ERROR_UNVERIFIED:
- case nsICMSMessageErrors.VERIFY_ERROR_PROCESSING:
- case nsICMSMessageErrors.VERIFY_MALFORMED_SIGNATURE:
- sigInfoLabel = "SIInvalidLabel";
- sigInfoHeader = "SIInvalidHeader";
- sigInfo_clueless = true;
- break;
- }
-
-
- document.getElementById("signatureLabel").value =
- bundle.getString(sigInfoLabel);
-
- var label;
- if (sigInfoHeader) {
- label = document.getElementById("signatureHeader");
- label.collapsed = false;
- label.value = bundle.getString(sigInfoHeader);
- }
-
- var str;
- if (sigInfo) {
- str = bundle.getString(sigInfo);
- }
- else if (sigInfo_clueless) {
- str = bundle.getString("SIClueless") + " (" + gSignatureStatus + ")";
- }
- setText("signatureExplanation", str);
-
-
- var encInfoLabel = null;
- var encInfoHeader = null;
- var encInfo = null;
- var encInfo_clueless = false;
-
- switch (gEncryptionStatus) {
- case -1:
- encInfoLabel = "EINoneLabel";
- encInfo = "EINone";
- break;
-
- case nsICMSMessageErrors.SUCCESS:
- encInfoLabel = "EIValidLabel";
- encInfo = "EIValid";
- break;
-
- case nsICMSMessageErrors.ENCRYPT_INCOMPLETE:
- encInfoLabel = "EIInvalidLabel";
- encInfo = "EIContentAltered";
- break;
-
- case nsICMSMessageErrors.GENERAL_ERROR:
- encInfoLabel = "EIInvalidLabel";
- encInfoHeader = "EIInvalidHeader";
- encInfo_clueless = 1;
- break;
- }
-
-
- document.getElementById("encryptionLabel").value =
- bundle.getString(encInfoLabel);
-
- if (encInfoHeader) {
- label = document.getElementById("encryptionHeader");
- label.collapsed = false;
- label.value = bundle.getString(encInfoHeader);
- }
-
- if (encInfo) {
- str = bundle.getString(encInfo);
- }
- else if (encInfo_clueless) {
- str = bundle.getString("EIClueless");
- }
- setText("encryptionExplanation", str);
- }
-
- if (gSignerCert) {
- document.getElementById("signatureCert").collapsed = false;
- if (gSignerCert.subjectName) {
- document.getElementById("signedBy").value = gSignerCert.commonName;
- }
- if (gSignerCert.emailAddress) {
- document.getElementById("signerEmail").value = gSignerCert.emailAddress;
- }
- if (gSignerCert.issuerName) {
- document.getElementById("sigCertIssuedBy").value = gSignerCert.issuerCommonName;
- }
- }
-
- if (gEncryptionCert) {
- document.getElementById("encryptionCert").collapsed = false;
- if (gEncryptionCert.subjectName) {
- document.getElementById("encryptedFor").value = gEncryptionCert.commonName;
- }
- if (gEncryptionCert.emailAddress) {
- document.getElementById("recipientEmail").value = gEncryptionCert.emailAddress;
- }
- if (gEncryptionCert.issuerName) {
- document.getElementById("encCertIssuedBy").value = gEncryptionCert.issuerCommonName;
- }
- }
-
-
- if(gSecureHeaders !="" &&
- gSignatureStatus != -1 &&
- gSignatureStatus != nsICMSMessageErrors.VERIFY_NOT_SIGNED){
- document.getElementById("secureHeaderBox").collapsed = false;
- label = document.getElementById("secureHeadersLabel");
- label.collapsed = false;
- label.value = bundle_secure_headers.getString("secureInfo.secureheaders.label");
-
- var secureStatelabel = document.getElementById("secureHeadersStateLabel");
- secureStatelabel.hidden = false;
- if(gSecureHeadersState>0)
- {
- secureStatelabel.value = bundle_secure_headers.getString("allsecureheaders.valid.label");
- }
- else{
- secureStatelabel.value = bundle_secure_headers.getString("allsecureheaders.invalid.label");
- }
- }
-
- if (gSecurityPolicyIdentifier != "") {
- document.getElementById("securityLabelBox").collapsed = false;
- document.getElementById("securityLabelSecurityPolicyIdentifierValue").value = gSecurityLabelConf.getSecurityPolicyIdentifierName(gSecurityPolicyIdentifier);
- if (gSecurityClassification != -1) {
- document.getElementById("securityLabelSecurityClassificationValue").value = gSecurityLabelConf.getSecurityClassificationName(gSecurityPolicyIdentifier, gSecurityClassification);
- document.getElementById("securityLabelSecurityClassificationRow").collapsed = false;
- }
- if (gPrivacyMark != "") {
- document.getElementById("securityLabelPrivacyMarkValue").value = gPrivacyMark;
- document.getElementById("securityLabelPrivacyMarkRow").collapsed = false;
- }
- if (gSecurityCategories != "") {
- var securityLabelSecurityCategoriesListBox = document.getElementById("securityLabelSecurityCategoriesListBox");
-
- securityCategoriesArray = gSecurityCategories.split("|");
- var listboxSize = securityCategoriesArray.length / 3;
- if (listboxSize > 5) listboxSize = 5;
- securityLabelSecurityCategoriesListBox.setAttribute("rows", listboxSize);
-
- for (var i = 0; i < securityCategoriesArray.length; i += 3) {
- var listitem = document.createElement("listitem");
- listitem.setAttribute("label", gSecurityLabelConf.getSecurityCategoryName(gSecurityPolicyIdentifier, gSecurityClassification, securityCategoriesArray[i], securityCategoriesArray[i + 1], securityCategoriesArray[i + 2]));
- securityLabelSecurityCategoriesListBox.appendChild(listitem);
- }
- document.getElementById("securityLabelSecurityCategoriesRow").collapsed = false;
- }
- }
-}
-
-function viewCertHelper(parent, cert) {
- var cd = Components.classes[nsCertificateDialogs].getService(nsICertificateDialogs);
- cd.viewCert(parent, cert);
-}
-
-function viewSignatureCert()
-{
- if (gSignerCert) {
- viewCertHelper(window, gSignerCert);
- }
-}
-
-function viewEncryptionCert()
-{
- if (gEncryptionCert) {
- viewCertHelper(window, gEncryptionCert);
- }
-}
-
-function doHelpButton()
-{
- openHelp('received_security');
-}
-
-function viewSecureHeaders(){
- if(gSecureHeaders!="")
- {
- window.openDialog('chrome://messenger-smime/content/msgReadSecureHeadersView.xul',
- '', 'chrome,resizable=1,modal=1,dialog=1', gSecureHeaders );
- }
-}
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */\r
+/* ***** BEGIN LICENSE BLOCK *****\r
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1\r
+ *\r
+ * The contents of this file are subject to the Mozilla Public License Version\r
+ * 1.1 (the "License"); you may not use this file except in compliance with\r
+ * the License. You may obtain a copy of the License at\r
+ * http://www.mozilla.org/MPL/\r
+ *\r
+ * Software distributed under the License is distributed on an "AS IS" basis,\r
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License\r
+ * for the specific language governing rights and limitations under the\r
+ * License.\r
+ *\r
+ * The Original Code is Mozilla Communicator.\r
+ *\r
+ * The Initial Developer of the Original Code is\r
+ * Netscape Communications Corp..\r
+ * Portions created by the Initial Developer are Copyright (C) 2002\r
+ * the Initial Developer. All Rights Reserved.\r
+ *\r
+ * Contributor(s):\r
+ * Kai Engert <kaie@netscape.com>\r
+ * Copyright (c) 2010 CASSIDIAN - All rights reserved\r
+ *\r
+ * Alternatively, the contents of this file may be used under the terms of\r
+ * either the GNU General Public License Version 2 or later (the "GPL"), or\r
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),\r
+ * in which case the provisions of the GPL or the LGPL are applicable instead\r
+ * of those above. If you wish to allow use of your version of this file only\r
+ * under the terms of either the GPL or the LGPL, and not to allow others to\r
+ * use your version of this file under the terms of the MPL, indicate your\r
+ * decision by deleting the provisions above and replace them with the notice\r
+ * and other provisions required by the GPL or the LGPL. If you do not delete\r
+ * the provisions above, a recipient may use your version of this file under\r
+ * the terms of any one of the MPL, the GPL or the LGPL.\r
+ *\r
+ * ***** END LICENSE BLOCK ***** */\r
+\r
+const nsIPKIParamBlock = Components.interfaces.nsIPKIParamBlock;\r
+const nsIDialogParamBlock = Components.interfaces.nsIDialogParamBlock;\r
+const nsIX509Cert = Components.interfaces.nsIX509Cert;\r
+const nsICMSMessageErrors = Components.interfaces.nsICMSMessageErrors;\r
+const nsICertificateDialogs = Components.interfaces.nsICertificateDialogs;\r
+const nsCertificateDialogs = "@mozilla.org/nsCertificateDialogs;1"\r
+\r
+var gSignerCert = null;\r
+var gEncryptionCert = null;\r
+\r
+var gSignatureStatus = -1;\r
+var gEncryptionStatus = -1;\r
+\r
+var gSecurityPolicyIdentifier = null;\r
+var gSecurityClassification = -1;\r
+var gPrivacyMark = null;\r
+var gSecurityCategories = null;\r
+\r
+var gSecurityLabelConf = null;\r
+\r
+var gSecureHeaders = "";\r
+var gSecureHeadersState = -1;\r
+var params = null;\r
+\r
+function setText(id, value) {\r
+ var element = document.getElementById(id);\r
+ if (!element)\r
+ return;\r
+ if (element.hasChildNodes())\r
+ element.removeChild(element.firstChild);\r
+ var textNode = document.createTextNode(value);\r
+ element.appendChild(textNode);\r
+}\r
+\r
+function onLoad()\r
+{\r
+ var pkiParams = window.arguments[0].QueryInterface(nsIPKIParamBlock);\r
+ var isupport = pkiParams.getISupportAtIndex(1);\r
+ if (isupport) {\r
+ gSignerCert = isupport.QueryInterface(nsIX509Cert);\r
+ }\r
+ isupport = pkiParams.getISupportAtIndex(2);\r
+ if (isupport) {\r
+ gEncryptionCert = isupport.QueryInterface(nsIX509Cert);\r
+ }\r
+ \r
+ params = pkiParams.QueryInterface(nsIDialogParamBlock);\r
+ \r
+ gSignatureStatus = params.GetInt(1);\r
+ gEncryptionStatus = params.GetInt(2);\r
+ gSecurityClassification = params.GetInt(3);\r
+ gSecureHeadersState = params.GetInt(4);\r
+\r
+ gSecurityPolicyIdentifier = params.GetString(0);\r
+ gPrivacyMark = params.GetString(1);\r
+ gSecurityCategories = params.GetString(2);\r
+ gSecureHeaders = params.GetString(12);\r
+ \r
+ if (!gSecurityLabelConf)\r
+ gSecurityLabelConf = new securityLabelConf();\r
+\r
+ var bundle = document.getElementById("bundle_smime_read_info");\r
+ var bundle_secure_headers = document.getElementById("bundle_smime_secure_headers");\r
+\r
+ if (bundle) {\r
+ var sigInfoLabel = null;\r
+ var sigInfoHeader = null;\r
+ var sigInfo = null;\r
+ var sigInfo_clueless = false;\r
+\r
+ switch (gSignatureStatus) {\r
+ case -1:\r
+ case nsICMSMessageErrors.VERIFY_NOT_SIGNED:\r
+ sigInfoLabel = "SINoneLabel";\r
+ sigInfo = "SINone";\r
+ break;\r
+\r
+ case nsICMSMessageErrors.SUCCESS:\r
+ sigInfoLabel = "SIValidLabel";\r
+ sigInfo = "SIValid";\r
+ break;\r
+\r
+\r
+ case nsICMSMessageErrors.VERIFY_BAD_SIGNATURE:\r
+ case nsICMSMessageErrors.VERIFY_DIGEST_MISMATCH:\r
+ sigInfoLabel = "SIInvalidLabel";\r
+ sigInfoHeader = "SIInvalidHeader";\r
+ sigInfo = "SIContentAltered";\r
+ break;\r
+\r
+ case nsICMSMessageErrors.VERIFY_UNKNOWN_ALGO:\r
+ case nsICMSMessageErrors.VERIFY_UNSUPPORTED_ALGO:\r
+ sigInfoLabel = "SIInvalidLabel";\r
+ sigInfoHeader = "SIInvalidHeader";\r
+ sigInfo = "SIInvalidCipher";\r
+ break;\r
+\r
+ case nsICMSMessageErrors.VERIFY_HEADER_MISMATCH:\r
+ sigInfoLabel = "SIPartiallyValidLabel";\r
+ sigInfoHeader = "SIPartiallyValidHeader";\r
+ sigInfo = "SIHeaderMismatch";\r
+ break;\r
+\r
+ case nsICMSMessageErrors.VERIFY_CERT_WITHOUT_ADDRESS:\r
+ sigInfoLabel = "SIPartiallyValidLabel";\r
+ sigInfoHeader = "SIPartiallyValidHeader";\r
+ sigInfo = "SICertWithoutAddress";\r
+ break;\r
+\r
+ case nsICMSMessageErrors.VERIFY_UNTRUSTED:\r
+ sigInfoLabel = "SIInvalidLabel";\r
+ sigInfoHeader = "SIInvalidHeader";\r
+ sigInfo = "SIUntrustedCA";\r
+ // XXX Need to extend to communicate better errors\r
+ // might also be:\r
+ // SIExpired SIRevoked SINotYetValid SIUnknownCA SIExpiredCA SIRevokedCA SINotYetValidCA\r
+ break;\r
+\r
+ case nsICMSMessageErrors.VERIFY_NOT_YET_ATTEMPTED:\r
+ case nsICMSMessageErrors.GENERAL_ERROR:\r
+ case nsICMSMessageErrors.VERIFY_NO_CONTENT_INFO:\r
+ case nsICMSMessageErrors.VERIFY_BAD_DIGEST:\r
+ case nsICMSMessageErrors.VERIFY_NOCERT:\r
+ case nsICMSMessageErrors.VERIFY_ERROR_UNVERIFIED:\r
+ case nsICMSMessageErrors.VERIFY_ERROR_PROCESSING:\r
+ case nsICMSMessageErrors.VERIFY_MALFORMED_SIGNATURE:\r
+ sigInfoLabel = "SIInvalidLabel";\r
+ sigInfoHeader = "SIInvalidHeader";\r
+ sigInfo_clueless = true;\r
+ break;\r
+ }\r
+\r
+ \r
+ document.getElementById("signatureLabel").value = \r
+ bundle.getString(sigInfoLabel);\r
+\r
+ var label;\r
+ if (sigInfoHeader) {\r
+ label = document.getElementById("signatureHeader");\r
+ label.collapsed = false;\r
+ label.value = bundle.getString(sigInfoHeader);\r
+ }\r
+ \r
+ var str;\r
+ if (sigInfo) {\r
+ str = bundle.getString(sigInfo);\r
+ }\r
+ else if (sigInfo_clueless) {\r
+ str = bundle.getString("SIClueless") + " (" + gSignatureStatus + ")";\r
+ }\r
+ setText("signatureExplanation", str);\r
+ \r
+\r
+ var encInfoLabel = null;\r
+ var encInfoHeader = null;\r
+ var encInfo = null;\r
+ var encInfo_clueless = false;\r
+\r
+ switch (gEncryptionStatus) {\r
+ case -1:\r
+ encInfoLabel = "EINoneLabel";\r
+ encInfo = "EINone";\r
+ break;\r
+\r
+ case nsICMSMessageErrors.SUCCESS:\r
+ encInfoLabel = "EIValidLabel";\r
+ encInfo = "EIValid";\r
+ break;\r
+\r
+ case nsICMSMessageErrors.ENCRYPT_INCOMPLETE:\r
+ encInfoLabel = "EIInvalidLabel";\r
+ encInfo = "EIContentAltered";\r
+ break;\r
+\r
+ case nsICMSMessageErrors.GENERAL_ERROR:\r
+ encInfoLabel = "EIInvalidLabel";\r
+ encInfoHeader = "EIInvalidHeader";\r
+ encInfo_clueless = 1;\r
+ break;\r
+ }\r
+\r
+\r
+ document.getElementById("encryptionLabel").value = \r
+ bundle.getString(encInfoLabel);\r
+\r
+ if (encInfoHeader) {\r
+ label = document.getElementById("encryptionHeader");\r
+ label.collapsed = false;\r
+ label.value = bundle.getString(encInfoHeader);\r
+ }\r
+ \r
+ if (encInfo) {\r
+ str = bundle.getString(encInfo);\r
+ }\r
+ else if (encInfo_clueless) {\r
+ str = bundle.getString("EIClueless");\r
+ }\r
+ setText("encryptionExplanation", str);\r
+ }\r
+ \r
+ if (gSignerCert) {\r
+ document.getElementById("signatureCert").collapsed = false;\r
+ if (gSignerCert.subjectName) {\r
+ document.getElementById("signedBy").value = gSignerCert.commonName;\r
+ }\r
+ if (gSignerCert.emailAddress) {\r
+ document.getElementById("signerEmail").value = gSignerCert.emailAddress;\r
+ }\r
+ if (gSignerCert.issuerName) {\r
+ document.getElementById("sigCertIssuedBy").value = gSignerCert.issuerCommonName;\r
+ }\r
+ }\r
+\r
+ if (gEncryptionCert) {\r
+ document.getElementById("encryptionCert").collapsed = false;\r
+ if (gEncryptionCert.subjectName) {\r
+ document.getElementById("encryptedFor").value = gEncryptionCert.commonName;\r
+ }\r
+ if (gEncryptionCert.emailAddress) {\r
+ document.getElementById("recipientEmail").value = gEncryptionCert.emailAddress;\r
+ }\r
+ if (gEncryptionCert.issuerName) {\r
+ document.getElementById("encCertIssuedBy").value = gEncryptionCert.issuerCommonName;\r
+ }\r
+ }\r
+\r
+ \r
+ if(gSecureHeaders !="" &&\r
+ gSignatureStatus != -1 && \r
+ gSignatureStatus != nsICMSMessageErrors.VERIFY_NOT_SIGNED){\r
+ document.getElementById("secureHeaderBox").collapsed = false;\r
+ label = document.getElementById("secureHeadersLabel");\r
+ label.collapsed = false;\r
+ label.value = bundle_secure_headers.getString("secureInfo.secureheaders.label");\r
+\r
+ var secureStatelabel = document.getElementById("secureHeadersStateLabel");\r
+ secureStatelabel.hidden = false;\r
+ if(gSecureHeadersState>0)\r
+ {\r
+ secureStatelabel.value = bundle_secure_headers.getString("allsecureheaders.valid.label");\r
+ }\r
+ else{\r
+ secureStatelabel.value = bundle_secure_headers.getString("allsecureheaders.invalid.label");\r
+ }\r
+ }\r
+ \r
+ if (gSecurityPolicyIdentifier != "") {\r
+ document.getElementById("securityLabelBox").collapsed = false;\r
+ document.getElementById("securityLabelSecurityPolicyIdentifierValue").value = gSecurityLabelConf.getSecurityPolicyIdentifierName(gSecurityPolicyIdentifier);\r
+ if (gSecurityClassification != -1) {\r
+ document.getElementById("securityLabelSecurityClassificationValue").value = gSecurityLabelConf.getSecurityClassificationName(gSecurityPolicyIdentifier, gSecurityClassification);\r
+ document.getElementById("securityLabelSecurityClassificationRow").collapsed = false;\r
+ }\r
+ if (gPrivacyMark != "") {\r
+ document.getElementById("securityLabelPrivacyMarkValue").value = gPrivacyMark;\r
+ document.getElementById("securityLabelPrivacyMarkRow").collapsed = false;\r
+ }\r
+ if (gSecurityCategories != "") {\r
+ var securityLabelSecurityCategoriesListBox = document.getElementById("securityLabelSecurityCategoriesListBox");\r
+\r
+ securityCategoriesArray = gSecurityCategories.split("|");\r
+ var listboxSize = securityCategoriesArray.length / 3;\r
+ if (listboxSize > 5) listboxSize = 5;\r
+ securityLabelSecurityCategoriesListBox.setAttribute("rows", listboxSize);\r
+\r
+ for (var i = 0; i < securityCategoriesArray.length; i += 3) {\r
+ var listitem = document.createElement("listitem");\r
+ listitem.setAttribute("label", gSecurityLabelConf.getSecurityCategoryName(gSecurityPolicyIdentifier, gSecurityClassification, securityCategoriesArray[i], securityCategoriesArray[i + 1], securityCategoriesArray[i + 2]));\r
+ securityLabelSecurityCategoriesListBox.appendChild(listitem);\r
+ }\r
+ document.getElementById("securityLabelSecurityCategoriesRow").collapsed = false;\r
+ }\r
+ }\r
+}\r
+\r
+function viewCertHelper(parent, cert) {\r
+ var cd = Components.classes[nsCertificateDialogs].getService(nsICertificateDialogs);\r
+ cd.viewCert(parent, cert);\r
+}\r
+\r
+function viewSignatureCert()\r
+{\r
+ if (gSignerCert) {\r
+ viewCertHelper(window, gSignerCert);\r
+ }\r
+}\r
+\r
+function viewEncryptionCert()\r
+{\r
+ if (gEncryptionCert) {\r
+ viewCertHelper(window, gEncryptionCert);\r
+ }\r
+}\r
+\r
+function doHelpButton()\r
+{\r
+ openHelp('received_security');\r
+}\r
+\r
+function viewSecureHeaders(){\r
+ if(gSecureHeaders!="")\r
+ {\r
+ window.openDialog('chrome://messenger-smime/content/msgReadSecureHeadersView.xul',\r
+ '', 'chrome,resizable=1,modal=1,dialog=1', params.GetString(13) );\r
+ }\r
+}\r