1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
|
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/**
* Functions related to the msgSecurityPane.inc.xhtml file, used in the message
* header to display S/MIME and OpenPGP encryption and signature info.
*/
/* import-globals-from ../../../mailnews/extensions/smime/msgReadSMIMEOverlay.js */
/* import-globals-from ../../extensions/openpgp/content/ui/enigmailMessengerOverlay.js */
/* import-globals-from aboutMessage.js */
var { XPCOMUtils } = ChromeUtils.importESModule(
"resource://gre/modules/XPCOMUtils.sys.mjs"
);
XPCOMUtils.defineLazyModuleGetters(this, {
EnigmailConstants: "chrome://openpgp/content/modules/constants.jsm",
EnigmailKeyRing: "chrome://openpgp/content/modules/keyRing.jsm",
EnigmailWindows: "chrome://openpgp/content/modules/windows.jsm",
});
var gSigKeyId = null;
var gEncKeyId = null;
/**
* Reveal message security popup panel with updated OpenPGP or S/MIME info.
*/
function showMessageReadSecurityInfo() {
// Interrupt if no message is selected or no encryption technology was used.
if (!gMessage || document.getElementById("cryptoBox").hidden) {
return;
}
// OpenPGP.
if (document.getElementById("cryptoBox").getAttribute("tech") === "OpenPGP") {
Enigmail.msg.loadOpenPgpMessageSecurityInfo();
showMessageSecurityPanel();
return;
}
// S/MIME.
if (gSignatureStatus === Ci.nsICMSMessageErrors.VERIFY_NOT_YET_ATTEMPTED) {
showImapSignatureUnknown();
return;
}
loadSmimeMessageSecurityInfo();
showMessageSecurityPanel();
}
/**
* Reveal the popup panel with the populated message security info.
*/
function showMessageSecurityPanel() {
document
.getElementById("messageSecurityPanel")
.openPopup(
document.getElementById("encryptionTechBtn"),
"bottomright topright",
0,
0,
false
);
}
/**
* Reset all values and clear the text of the message security popup panel.
*/
function onMessageSecurityPopupHidden() {
// Clear the variables for signature and encryption.
gSigKeyId = null;
gEncKeyId = null;
// Hide the UI elements.
document.getElementById("signatureHeader").collapsed = true;
document.getElementById("encryptionHeader").collapsed = true;
document.getElementById("signatureCert").collapsed = true;
document.getElementById("signatureKey").collapsed = true;
document.getElementById("viewSignatureKey").collapsed = true;
document.getElementById("encryptionKey").collapsed = true;
document.getElementById("encryptionCert").collapsed = true;
document.getElementById("viewEncryptionKey").collapsed = true;
document.getElementById("otherEncryptionKeys").collapsed = true;
let keyList = document.getElementById("otherEncryptionKeysList");
// Clear any possible existing key previously appended to the DOM.
for (let node of keyList.children) {
keyList.removeChild(node);
}
}
async function viewSignatureKey() {
if (!gSigKeyId) {
return;
}
// If the signature acceptance was edited, reload the current message.
if (await EnigmailWindows.openKeyDetails(window, gSigKeyId, false)) {
ReloadMessage();
}
}
function viewEncryptionKey() {
if (!gEncKeyId) {
return;
}
EnigmailWindows.openKeyDetails(window, gEncKeyId, false);
}
|