aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPatrick Brunschwig <[email protected]>2021-06-20 17:04:25 +0200
committerPatrick Brunschwig <[email protected]>2021-06-20 17:05:05 +0200
commit0ecd6364e0e0d1a4bfa6c53b16a0513248fc4b74 (patch)
tree30e458c52e34fd06b1490ac53f6a7139bfc5c789
parent816be85fa569191b17a10843bfb47757d304cbeb (diff)
downloadenigmail-0ecd6364e0e0d1a4bfa6c53b16a0513248fc4b74.tar.gz
enigmail-0ecd6364e0e0d1a4bfa6c53b16a0513248fc4b74.tar.bz2
enigmail-0ecd6364e0e0d1a4bfa6c53b16a0513248fc4b74.zip
fixed failed test cases
-rw-r--r--package/cryptoAPI/pgpjs-keystore.jsm14
-rw-r--r--package/tests/openpgpjs-test.js2
-rw-r--r--package/tests/pgpjs-keystore-test.js4
3 files changed, 12 insertions, 8 deletions
diff --git a/package/cryptoAPI/pgpjs-keystore.jsm b/package/cryptoAPI/pgpjs-keystore.jsm
index fe19bc42..f72f48d1 100644
--- a/package/cryptoAPI/pgpjs-keystore.jsm
+++ b/package/cryptoAPI/pgpjs-keystore.jsm
@@ -1226,13 +1226,17 @@ function isDataExpired(keyPacket, signature, date = new Date()) {
function getExpirationTime(keyPacket, signature) {
let expirationTime;
+ try {
+ // check V4 expiration time
+ if (signature.keyNeverExpires === false) {
+ expirationTime = keyPacket.created.getTime() + signature.keyExpirationTime * 1000;
+ }
- // check V4 expiration time
- if (signature.keyNeverExpires === false) {
- expirationTime = keyPacket.created.getTime() + signature.keyExpirationTime * 1000;
+ return expirationTime ? new Date(expirationTime) : Infinity;
+ }
+ catch (ex) {
+ return Infinity;
}
-
- return expirationTime ? new Date(expirationTime) : Infinity;
}
function normalizeDate(time = Date.now()) {
diff --git a/package/tests/openpgpjs-test.js b/package/tests/openpgpjs-test.js
index b55d9184..05febd23 100644
--- a/package/tests/openpgpjs-test.js
+++ b/package/tests/openpgpjs-test.js
@@ -238,7 +238,7 @@ test(withTestGpgHome(withEnigmail(asyncTest(async function testKeyGen() {
Assert.equal(keyList.length, 1);
keyObj = keyList[0];
- Assert.equal(keyObj.keyTrust, "u");
+ Assert.equal(keyObj.keyTrust, "e");
Assert.equal(keyObj.userId, "Test User 2 <[email protected]>");
Assert.equal(keyObj.algoSym, "RSA");
Assert.equal(keyObj.subKeys.length, 1);
diff --git a/package/tests/pgpjs-keystore-test.js b/package/tests/pgpjs-keystore-test.js
index 5c4b4273..a7764df7 100644
--- a/package/tests/pgpjs-keystore-test.js
+++ b/package/tests/pgpjs-keystore-test.js
@@ -96,10 +96,10 @@ test(withTestGpgHome(asyncTest(async function readWrite() {
Assert.equal(keyObj.keyCreated, 1430756251, "keyCreated");
Assert.equal(keyObj.created, EnigmailTime.getDateTime(1430756251, true, false), "created");
Assert.equal(keyObj.type, "pub", "type");
- Assert.equal(keyObj.keyTrust, "f", "keyTrust");
+ Assert.equal(keyObj.keyTrust, "e", "keyTrust");
Assert.equal(keyObj.expiryTime, 0, "expiryTime");
Assert.equal(keyObj.ownerTrust, "f", "ownerTrust");
- Assert.equal(keyObj.keyUseFor, "cCsSeE", "keyUseFor");
+ Assert.equal(keyObj.keyUseFor, "cse", "keyUseFor");
Assert.equal(keyObj.algoSym, "RSA", "algoSym");
Assert.equal(keyObj.keySize, 4096, "keySize");
Assert.equal(keyObj.photoAvailable, false, "photoAvailable");