Bug 1891241 - Remove EnigmailCryptoAPI indirection. r=mkmelin

Differential Revision: https://phabricator.services.mozilla.com/D211271

--HG--
extra : amend_source : 8e559b4628db8e4bbebd79b74265f8cacdcb0623
This commit is contained in:
Kai Engert 2024-05-24 09:20:50 +12:00
Родитель 5e7817a193
Коммит 7f2fdb39c0
17 изменённых файлов: 45 добавлений и 304 удалений

Просмотреть файл

@ -28,9 +28,6 @@ var { EnigmailKeyserverURIs } = ChromeUtils.importESModule(
var { EnigmailKeyServer } = ChromeUtils.importESModule(
"chrome://openpgp/content/modules/keyserver.sys.mjs"
);
var { EnigmailCryptoAPI } = ChromeUtils.importESModule(
"chrome://openpgp/content/modules/cryptoAPI.sys.mjs"
);
var { PgpSqliteDb2 } = ChromeUtils.importESModule(
"chrome://openpgp/content/modules/sqliteDb.sys.mjs"
);
@ -1189,8 +1186,7 @@ async function enigmailDeleteKey(key) {
return;
}
const cApi = EnigmailCryptoAPI();
await cApi.deleteKey(key.fpr, key.secretAvailable);
await RNP.deleteKey(key.fpr, key.secretAvailable);
await PgpSqliteDb2.deleteAcceptance(key.fpr);
EnigmailKeyRing.clearCache();

Просмотреть файл

@ -1540,6 +1540,7 @@ export var RNP = {
return is_revoked.value;
},
/* unused
getKeySignatures(keyId, ignoreUnknownUid) {
const handle = this.getKeyHandleByKeyIdOrFingerprint(
RNPLib.ffi,
@ -1563,6 +1564,7 @@ export var RNP = {
RNPLib.rnp_key_handle_destroy(handle);
return result;
},
*/
getKeyObjSignatures(keyObj, ignoreUnknownUid) {
const handle = this.getKeyHandleByKeyIdOrFingerprint(
@ -5136,4 +5138,8 @@ export var RNP = {
return unsupportedFeatures != 0;
},
async verifyAttachment(_dataFile, _sigFile) {
throw new Error("verifyAttachment not implemented");
},
};

Просмотреть файл

@ -1,17 +0,0 @@
/*
* 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/.
*/
var gCurrentApi = null;
export function EnigmailCryptoAPI() {
if (!gCurrentApi) {
const { getRNPAPI } = ChromeUtils.importESModule(
"chrome://openpgp/content/modules/cryptoAPI/RNPCryptoAPI.sys.mjs"
);
gCurrentApi = getRNPAPI();
}
return gCurrentApi;
}

Просмотреть файл

@ -1,215 +0,0 @@
/*
* 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/.
*/
import { RNP } from "chrome://openpgp/content/modules/RNP.sys.mjs";
import { EnigmailConstants } from "chrome://openpgp/content/modules/constants.sys.mjs";
class RNPCryptoAPI {
constructor() {}
/**
* Get the list of all known keys (including their secret keys).
*
* @param {string[]} [onlyKeys] - Only load data for these specified key IDs.
* @returns {Promise<object[]>} the keys
*/
async getKeys(onlyKeys = null) {
return RNP.getKeys(onlyKeys);
}
/**
* Obtain signatures for a given set of key IDs.
*
* @param {string} keyId - Space-separated list of key IDs.
* @param {boolean} ignoreUnknownUid - If true, filter out unknown signer's UIDs.
* @returns {Promise<object[]>} signatures. See extractSignatures()
*/
async getKeySignatures(keyId, ignoreUnknownUid = false) {
return RNP.getKeySignatures(keyId, ignoreUnknownUid);
}
/**
* Obtain signatures for a given key.
*
* @param {string} keyId - The signatures of this key will be returned.
* @param {boolean} [ignoreUnknownUid=false] - If true, filter out unknown signer's UIDs.
* @returns {Promise<object[]>} signatures. See extractSignatures()
*/
async getKeyObjSignatures(keyId, ignoreUnknownUid = false) {
return RNP.getKeyObjSignatures(keyId, ignoreUnknownUid);
}
/**
* @param {window} win
* @param {string} keyBlock - An block of OpenPGP key data.
* @param {string} acceptance - The key acceptance level that should
* be assigned to imported public keys.
* @param {boolean} permissive - Whether it's allowed to fall back
* to a permissive import, if strict import fails.
* See RNP documentation for RNP_LOAD_SAVE_PERMISSIVE.
* @param {string[]} limitedFPRs - This is a filtering parameter.
* If the array is empty, all keys will be imported.
* If the array contains at least one entry, a key will be imported
* only if its fingerprint (of the primary key) is listed in this
* array.
*/
async importPubkeyBlockAutoAcceptAPI(
win,
keyBlock,
acceptance,
permissive,
limitedFPRs = []
) {
const res = await RNP.importPubkeyBlockAutoAcceptImpl(
win,
keyBlock,
acceptance,
permissive,
limitedFPRs
);
return res;
}
async importRevBlockAPI(data) {
return RNP.importRevImpl(data);
}
/**
* Export secret key(s) to a file.
*
* @param {string} _keyId - Specification by fingerprint or keyID.
* @param {boolean} _minimalKey - if true, reduce key to minimum required.
* @returns {Promise<object>} result
* @returns {integer} result.exitCode - 0 for success
* @returns {string} result.errorMsg - Error message, if exitCode != 0.
* @returns {string} result.keyData - key data in base64
*/
async extractSecretKey(_keyId, _minimalKey) {
throw new Error("extractSecretKey not implemented");
}
/**
* @param {byte} _byteData - The encrypted data.
* @returns {?string} the name of the attached file, or null.
*/
async getFileName(_byteData) {
throw new Error("getFileName not implemented");
}
/**
*
* @param {string} _filePath - The signed file.
* @param {string} _sigPath - The signature to verify.
* @returns {Promise<string>} - A message from the verification.
*/
async verifyAttachment(_filePath, _sigPath) {
throw new Error("verifyAttachment not implemented");
}
/**
* @param {byte[]} encrypted - The encrypted data.
*
* @returns {Promise<object>} the object with decryptedData and
* status information
*/
async decryptAttachment(encrypted) {
const options = {};
options.fromAddr = "";
options.msgDate = null;
return RNP.decrypt(encrypted, options);
}
/**
* @param {string} encrypted - The encrypted data.
* @param {object} options - Decryption options.
* @returns {Promise<object>} the object with decryptedData and
* status information
*
* Use Promise.catch to handle failed decryption.
* retObj.errorMsg will be an error message in this case.
* XXX: it's not... ^^^ This should be changed to always reject
* by throwing an Error (subclass?) for failures to decrypt.
*/
async decrypt(encrypted, options) {
return RNP.decrypt(encrypted, options);
}
/**
*
* @param {string} encrypted - The encrypted data.
* @param {object} options - Decryption options.
* @returns {Promise<object>} the object with decryptedData and
* status information.
*/
async decryptMime(encrypted, options) {
// write something to gpg such that the process doesn't get stuck
if (encrypted.length === 0) {
encrypted = "NO DATA\n";
}
options.noOutput = false;
options.verifyOnly = false;
options.uiFlags = EnigmailConstants.UI_PGP_MIME;
return this.decrypt(encrypted, options);
}
/**
* @param {string} signed - The signed data.
* @param {object} options - Decryption options.
* @returns {Promise<object>} the object with decryptedData and
* status information.
*/
async verifyMime(signed, options) {
if (!options.mimeSignatureData) {
throw new Error("inline verify not yet implemented");
}
return RNP.verifyDetached(signed, options);
}
async getKeyListFromKeyBlockAPI(
keyBlockStr,
pubkey,
seckey,
permissive,
withPubKey
) {
return RNP.getKeyListFromKeyBlockImpl(
keyBlockStr,
pubkey,
seckey,
permissive,
withPubKey
);
}
async genKey(userId, keyType, keySize, expiryTime, passphrase) {
const id = RNP.genKey(userId, keyType, keySize, expiryTime, passphrase);
await RNP.saveKeyRings();
return id;
}
async deleteKey(keyFingerprint, deleteSecret) {
return RNP.deleteKey(keyFingerprint, deleteSecret);
}
async encryptAndOrSign(plaintext, args, resultStatus) {
return RNP.encryptAndOrSign(plaintext, args, resultStatus);
}
async unlockAndGetNewRevocation(id, pass) {
return RNP.unlockAndGetNewRevocation(id, pass);
}
async getPublicKey(id) {
return RNP.getPublicKey(id);
}
}
export function getRNPAPI() {
return new RNPCryptoAPI();
}

Просмотреть файл

@ -11,12 +11,12 @@ ChromeUtils.defineESModuleGetters(lazy, {
EnigmailArmor: "chrome://openpgp/content/modules/armor.sys.mjs",
EnigmailConstants: "chrome://openpgp/content/modules/constants.sys.mjs",
EnigmailCore: "chrome://openpgp/content/modules/core.sys.mjs",
EnigmailCryptoAPI: "chrome://openpgp/content/modules/cryptoAPI.sys.mjs",
EnigmailDialog: "chrome://openpgp/content/modules/dialog.sys.mjs",
EnigmailFuncs: "chrome://openpgp/content/modules/funcs.sys.mjs",
EnigmailKey: "chrome://openpgp/content/modules/key.sys.mjs",
EnigmailKeyRing: "chrome://openpgp/content/modules/keyRing.sys.mjs",
MailStringUtils: "resource:///modules/MailStringUtils.sys.mjs",
RNP: "chrome://openpgp/content/modules/RNP.sys.mjs",
});
ChromeUtils.defineLazyGetter(lazy, "log", () => {
return console.createInstance({
@ -279,8 +279,7 @@ export var EnigmailDecryption = {
uiFlags,
msgDate,
};
const cApi = lazy.EnigmailCryptoAPI();
const result = lazy.EnigmailFuncs.sync(cApi.decrypt(pgpBlock, options));
const result = lazy.EnigmailFuncs.sync(lazy.RNP.decrypt(pgpBlock, options));
if (!result) {
lazy.log.warn("Decryption message finished with no result.");
return "";
@ -584,8 +583,8 @@ export var EnigmailDecryption = {
lazy.log.debug(`Decrypting attachment to ${outFile.path}`);
const cApi = lazy.EnigmailCryptoAPI();
const result = await cApi.decryptAttachment(byteData);
const options = { fromAddr: "", msgDate: null };
const result = await lazy.RNP.decrypt(byteData, options);
if (!result) {
lazy.log.warn("Decrypt attachment finished with no result.");
return false;

Просмотреть файл

@ -7,11 +7,11 @@
const lazy = {};
ChromeUtils.defineESModuleGetters(lazy, {
EnigmailConstants: "chrome://openpgp/content/modules/constants.sys.mjs",
EnigmailCryptoAPI: "chrome://openpgp/content/modules/cryptoAPI.sys.mjs",
EnigmailCore: "chrome://openpgp/content/modules/core.sys.mjs",
EnigmailFuncs: "chrome://openpgp/content/modules/funcs.sys.mjs",
EnigmailKeyRing: "chrome://openpgp/content/modules/keyRing.sys.mjs",
PgpSqliteDb2: "chrome://openpgp/content/modules/sqliteDb.sys.mjs",
RNP: "chrome://openpgp/content/modules/RNP.sys.mjs",
});
ChromeUtils.defineLazyGetter(lazy, "l10n", () => {
@ -403,9 +403,8 @@ export var EnigmailEncryption = {
}
const resultStatus = {};
const cApi = lazy.EnigmailCryptoAPI();
const encrypted = lazy.EnigmailFuncs.sync(
cApi.encryptAndOrSign(
lazy.RNP.encryptAndOrSign(
listener.getInputForCrypto(),
encryptArgs,
resultStatus

Просмотреть файл

@ -8,9 +8,9 @@
const lazy = {};
ChromeUtils.defineESModuleGetters(lazy, {
EnigmailCryptoAPI: "chrome://openpgp/content/modules/cryptoAPI.sys.mjs",
EnigmailKeyRing: "chrome://openpgp/content/modules/keyRing.sys.mjs",
MailStringUtils: "resource:///modules/MailStringUtils.sys.mjs",
RNP: "chrome://openpgp/content/modules/RNP.sys.mjs",
});
ChromeUtils.defineLazyGetter(lazy, "l10n", () => {
@ -181,14 +181,13 @@ export var EnigmailKey = {
this._keyListCache.delete(this._keyListCache.keys().next().value);
}
const cApi = lazy.EnigmailCryptoAPI();
let keyList;
let key = {};
let blocks;
errorMsgObj.value = "";
try {
keyList = await cApi.getKeyListFromKeyBlockAPI(
keyList = await lazy.RNP.getKeyListFromKeyBlockImpl(
keyBlockStr,
pubkey,
seckey,

Просмотреть файл

@ -6,7 +6,6 @@
const lazy = {};
ChromeUtils.defineESModuleGetters(lazy, {
EnigmailCryptoAPI: "chrome://openpgp/content/modules/cryptoAPI.sys.mjs",
EnigmailFuncs: "chrome://openpgp/content/modules/funcs.sys.mjs",
EnigmailKey: "chrome://openpgp/content/modules/key.sys.mjs",
});
@ -514,19 +513,6 @@ export class EnigmailKeyObj {
}
}
/**
* @param {boolean} minimalKey - If true, reduce key to minimum required.
*
* @returns {object} object
* @returns {integer} object.exitCode - Result code (0: OK)
* @returns {string} object.keyData - ASCII armored key data material.
* @returns {string} object.errorMsg - Error message in case exitCode !== 0.
*/
getSecretKey(minimalKey) {
const cApi = lazy.EnigmailCryptoAPI();
return lazy.EnigmailFuncs.sync(cApi.extractSecretKey(this.fpr, minimalKey));
}
iSimpleOneSubkeySameExpiry() {
if (this.subKeys.length == 0) {
return true;

Просмотреть файл

@ -11,7 +11,6 @@ ChromeUtils.defineESModuleGetters(lazy, {
CollectedKeysDB: "chrome://openpgp/content/modules/CollectedKeysDB.sys.mjs",
OpenPGPAlias: "chrome://openpgp/content/modules/OpenPGPAlias.sys.mjs",
EnigmailArmor: "chrome://openpgp/content/modules/armor.sys.mjs",
EnigmailCryptoAPI: "chrome://openpgp/content/modules/cryptoAPI.sys.mjs",
EnigmailFuncs: "chrome://openpgp/content/modules/funcs.sys.mjs",
EnigmailTrust: "chrome://openpgp/content/modules/trust.sys.mjs",
EnigmailDialog: "chrome://openpgp/content/modules/dialog.sys.mjs",
@ -350,8 +349,7 @@ export var EnigmailKeyRing = {
endIndexObj.value - beginIndexObj.value + 1
);
const cApi = lazy.EnigmailCryptoAPI();
const res = await cApi.importRevBlockAPI(pgpBlock);
const res = await lazy.RNP.importRevImpl(pgpBlock);
if (res.exitCode) {
return;
}
@ -886,7 +884,6 @@ export var EnigmailKeyRing = {
throw new Error("importKeyAsync with minimizeKey not implemented");
}
const cApi = lazy.EnigmailCryptoAPI();
let result = undefined;
let tryAgain;
let permissive = false;
@ -894,7 +891,10 @@ export var EnigmailKeyRing = {
// strict on first attempt, permissive on optional second attempt
const blockParam = isBinary ? keyBlock : pgpBlock;
result = await cApi.importPubkeyBlockAutoAcceptAPI(
// TODO: The filtering might not work, because the underlying
// implementation wants to filter by fingerprint, but the filter
// input is apparently user IDs? Really?
result = await lazy.RNP.importPubkeyBlockAutoAcceptImpl(
parent,
blockParam,
acceptance,
@ -2021,9 +2021,7 @@ function loadKeyList(win, sortColumn, sortDirection, onlyKeys = null) {
}
gLoadingKeys = true;
const cApi = lazy.EnigmailCryptoAPI();
cApi
.getKeys(onlyKeys)
lazy.RNP.getKeys(onlyKeys)
.then(keyList => {
createAndSortKeyList(
keyList,

Просмотреть файл

@ -7,11 +7,11 @@
const lazy = {};
ChromeUtils.defineESModuleGetters(lazy, {
EnigmailConstants: "chrome://openpgp/content/modules/constants.sys.mjs",
EnigmailCryptoAPI: "chrome://openpgp/content/modules/cryptoAPI.sys.mjs",
EnigmailFuncs: "chrome://openpgp/content/modules/funcs.sys.mjs",
EnigmailKeyRing: "chrome://openpgp/content/modules/keyRing.sys.mjs",
FeedUtils: "resource:///modules/FeedUtils.sys.mjs",
MailStringUtils: "resource:///modules/MailStringUtils.sys.mjs",
RNP: "chrome://openpgp/content/modules/RNP.sys.mjs",
});
ChromeUtils.defineLazyGetter(lazy, "log", () => {
return console.createInstance({
@ -1294,8 +1294,7 @@ const accessVksServer = {
listener
);
const cApi = lazy.EnigmailCryptoAPI();
const keyList = await cApi.getKeyListFromKeyBlockAPI(
const keyList = await lazy.RNP.getKeyListFromKeyBlockImpl(
r,
true,
false,

Просмотреть файл

@ -14,13 +14,13 @@ const lazy = {};
ChromeUtils.defineESModuleGetters(lazy, {
EnigmailConstants: "chrome://openpgp/content/modules/constants.sys.mjs",
EnigmailCore: "chrome://openpgp/content/modules/core.sys.mjs",
EnigmailCryptoAPI: "chrome://openpgp/content/modules/cryptoAPI.sys.mjs",
EnigmailData: "chrome://openpgp/content/modules/data.sys.mjs",
EnigmailDecryption: "chrome://openpgp/content/modules/decryption.sys.mjs",
EnigmailFuncs: "chrome://openpgp/content/modules/funcs.sys.mjs",
EnigmailMime: "chrome://openpgp/content/modules/mime.sys.mjs",
EnigmailURIs: "chrome://openpgp/content/modules/uris.sys.mjs",
EnigmailVerify: "chrome://openpgp/content/modules/mimeVerify.sys.mjs",
RNP: "chrome://openpgp/content/modules/RNP.sys.mjs",
});
ChromeUtils.defineLazyGetter(lazy, "log", () => {
return console.createInstance({
@ -449,9 +449,12 @@ MimeDecryptHandler.prototype = {
LAST_MSG.lastMessageURI = currMsg;
LAST_MSG.mimePartNumber = this.mimePartNumber;
const cApi = lazy.EnigmailCryptoAPI();
options.noOutput = false;
options.verifyOnly = false;
options.uiFlags = lazy.EnigmailConstants.UI_PGP_MIME;
this.returnStatus = lazy.EnigmailFuncs.sync(
cApi.decryptMime(this.outQueue, options)
lazy.RNP.decrypt(this.outQueue, options)
);
if (!this.returnStatus) {

Просмотреть файл

@ -11,12 +11,12 @@ import { EnigmailConstants } from "chrome://openpgp/content/modules/constants.sy
const lazy = {};
ChromeUtils.defineESModuleGetters(lazy, {
EnigmailCore: "chrome://openpgp/content/modules/core.sys.mjs",
EnigmailCryptoAPI: "chrome://openpgp/content/modules/cryptoAPI.sys.mjs",
EnigmailData: "chrome://openpgp/content/modules/data.sys.mjs",
EnigmailFuncs: "chrome://openpgp/content/modules/funcs.sys.mjs",
EnigmailMime: "chrome://openpgp/content/modules/mime.sys.mjs",
EnigmailSingletons: "chrome://openpgp/content/modules/singletons.sys.mjs",
EnigmailURIs: "chrome://openpgp/content/modules/uris.sys.mjs",
RNP: "chrome://openpgp/content/modules/RNP.sys.mjs",
});
ChromeUtils.defineLazyGetter(lazy, "log", () => {
return console.createInstance({
@ -537,8 +537,6 @@ MimeVerify.prototype = {
}
}
const cApi = lazy.EnigmailCryptoAPI();
// ensure all lines end with CRLF as specified in RFC 3156, section 5
if (this.signedData.search(/[^\r]\n/) >= 0) {
this.signedData = this.signedData
@ -546,8 +544,12 @@ MimeVerify.prototype = {
.replace(/\n/g, "\r\n");
}
if (!options.mimeSignatureData) {
throw new Error("inline verify not yet implemented");
}
this.returnStatus = lazy.EnigmailFuncs.sync(
cApi.verifyMime(this.signedData, options)
lazy.RNP.verifyDetached(this.signedData, options)
);
if (!this.returnStatus) {

Просмотреть файл

@ -27,9 +27,6 @@ var { EnigmailWindows } = ChromeUtils.importESModule(
var { EnigmailKeyServer } = ChromeUtils.importESModule(
"chrome://openpgp/content/modules/keyserver.sys.mjs"
);
var { EnigmailCryptoAPI } = ChromeUtils.importESModule(
"chrome://openpgp/content/modules/cryptoAPI.sys.mjs"
);
var { KeyLookupHelper } = ChromeUtils.importESModule(
"chrome://openpgp/content/modules/keyLookupHelper.sys.mjs"
);
@ -393,10 +390,9 @@ async function enigmailDeleteKey() {
return;
}
const cApi = EnigmailCryptoAPI();
for (const j in keyList) {
const fpr = gKeyList[keyList[j]].fpr;
await cApi.deleteKey(fpr, deleteSecret);
await lazy.RNP.deleteKey(fpr, deleteSecret);
await PgpSqliteDb2.deleteAcceptance(fpr);
}
clearKeyCache();

Просмотреть файл

@ -25,7 +25,6 @@ ChromeUtils.defineESModuleGetters(this, {
EnigmailArmor: "chrome://openpgp/content/modules/armor.sys.mjs",
EnigmailConstants: "chrome://openpgp/content/modules/constants.sys.mjs",
EnigmailCore: "chrome://openpgp/content/modules/core.sys.mjs",
EnigmailCryptoAPI: "chrome://openpgp/content/modules/cryptoAPI.sys.mjs",
EnigmailData: "chrome://openpgp/content/modules/data.sys.mjs",
EnigmailDecryption: "chrome://openpgp/content/modules/decryption.sys.mjs",
EnigmailDialog: "chrome://openpgp/content/modules/dialog.sys.mjs",
@ -1955,8 +1954,7 @@ Enigmail.msg = {
}
await IOUtils.writeUTF8(outFile2.path, await response2.text());
const cApi = EnigmailCryptoAPI();
const promise = cApi.verifyAttachment(outFile1.path, outFile2.path);
const promise = RNP.verifyAttachment(outFile1.path, outFile2.path);
promise.then(async function (message) {
Services.prompt.alert(
window,
@ -2043,8 +2041,7 @@ Enigmail.msg = {
// from an encrypted data block.
/*
if (callbackArg.actionType != "importKey") {
let cApi = EnigmailCryptoAPI();
let origFilename = await cApi.getFileName(window, callbackArg.data);
let origFilename = await ???.getFileName(window, callbackArg.data);
if (origFilename && origFilename.length > rawFileName.length) {
rawFileName = origFilename;
}

Просмотреть файл

@ -19,9 +19,6 @@ var { EnigmailKeyRing } = ChromeUtils.importESModule(
var { PgpSqliteDb2 } = ChromeUtils.importESModule(
"chrome://openpgp/content/modules/sqliteDb.sys.mjs"
);
var { EnigmailCryptoAPI } = ChromeUtils.importESModule(
"chrome://openpgp/content/modules/cryptoAPI.sys.mjs"
);
var { KeyLookupHelper } = ChromeUtils.importESModule(
"chrome://openpgp/content/modules/keyLookupHelper.sys.mjs"
);
@ -392,8 +389,7 @@ async function reloadData(firstLoad) {
}
gSigTree = document.getElementById("signatures_tree");
const cApi = EnigmailCryptoAPI();
const signatures = await cApi.getKeyObjSignatures(keyObj);
const signatures = await RNP.getKeyObjSignatures(keyObj, false);
gSigTree.view = new SigListView(signatures);
document.getElementById("subkeyList").view = new SubkeyListView(keyObj);

Просмотреть файл

@ -10,9 +10,6 @@ var { MailServices } = ChromeUtils.importESModule(
var { AppConstants } = ChromeUtils.importESModule(
"resource://gre/modules/AppConstants.sys.mjs"
);
var { EnigmailCryptoAPI } = ChromeUtils.importESModule(
"chrome://openpgp/content/modules/cryptoAPI.sys.mjs"
);
var { OpenPGPMasterpass } = ChromeUtils.importESModule(
"chrome://openpgp/content/modules/masterpass.sys.mjs"
);
@ -34,6 +31,9 @@ var { PgpSqliteDb2 } = ChromeUtils.importESModule(
var { EnigmailCore } = ChromeUtils.importESModule(
"chrome://openpgp/content/modules/core.sys.mjs"
);
var { RNP } = ChromeUtils.importESModule(
"chrome://openpgp/content/modules/RNP.sys.mjs"
);
ChromeUtils.defineESModuleGetters(this, {
LoginHelper: "resource://gre/modules/LoginHelper.sys.mjs",
@ -654,7 +654,6 @@ async function openPgpKeygenConfirm() {
kGenerating = true;
let password;
const cApi = EnigmailCryptoAPI();
let newId = null;
const sepPassphraseEnabled = Services.prefs.getBoolPref(
@ -669,7 +668,7 @@ async function openPgpKeygenConfirm() {
} else {
password = document.getElementById("passwordInput").value;
}
newId = await cApi.genKey(
newId = await RNP.genKey(
`${gIdentity.fullName} <${gIdentity.email}>`,
document.getElementById("keyType").value,
Number(document.getElementById("keySize").value),
@ -679,6 +678,7 @@ async function openPgpKeygenConfirm() {
Number(document.getElementById("timeScale").value),
password
);
await RNP.saveKeyRings();
gGeneratedKey = newId;
@ -706,7 +706,7 @@ async function openPgpKeygenConfirm() {
closeOverlay();
EnigmailKeyRing.clearCache();
const rev = await cApi.unlockAndGetNewRevocation(
const rev = await RNP.unlockAndGetNewRevocation(
`0x${gGeneratedKey}`,
password,
true

Просмотреть файл

@ -10,7 +10,6 @@ openpgp.jar:
content/openpgp/modules/CollectedKeysDB.sys.mjs (content/modules/CollectedKeysDB.sys.mjs)
content/openpgp/modules/constants.sys.mjs (content/modules/constants.sys.mjs)
content/openpgp/modules/core.sys.mjs (content/modules/core.sys.mjs)
content/openpgp/modules/cryptoAPI.sys.mjs (content/modules/cryptoAPI.sys.mjs)
content/openpgp/modules/data.sys.mjs (content/modules/data.sys.mjs)
content/openpgp/modules/decryption.sys.mjs (content/modules/decryption.sys.mjs)
content/openpgp/modules/dialog.sys.mjs (content/modules/dialog.sys.mjs)
@ -47,8 +46,6 @@ openpgp.jar:
content/openpgp/modules/wkdLookup.sys.mjs (content/modules/wkdLookup.sys.mjs)
content/openpgp/modules/zbase32.sys.mjs (content/modules/zbase32.sys.mjs)
content/openpgp/modules/cryptoAPI/RNPCryptoAPI.sys.mjs (content/modules/cryptoAPI/RNPCryptoAPI.sys.mjs)
content/openpgp/ui/backupKeyPassword.js (content/ui/backupKeyPassword.js)
content/openpgp/ui/changeExpiryDlg.js (content/ui/changeExpiryDlg.js)
content/openpgp/ui/commonWorkflows.js (content/ui/commonWorkflows.js)