Skip to content

Commit

Permalink
Drop config.revocationsExpire, always honour revocation expiration …
Browse files Browse the repository at this point in the history
…instead

Unclear motivation for adding the original config option; if an expiration is there, it should
be honoured.
  • Loading branch information
larabr committed Mar 25, 2024
1 parent 6ebd179 commit 3c4230e
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 8 deletions.
1 change: 0 additions & 1 deletion openpgp.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,6 @@ interface Config {
allowUnauthenticatedStream: boolean;
minRSABits: number;
passwordCollisionCheck: boolean;
revocationsExpire: boolean;
ignoreUnsupportedPackets: boolean;
ignoreMalformedPackets: boolean;
versionString: string;
Expand Down
5 changes: 0 additions & 5 deletions src/config/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -155,11 +155,6 @@ export default {
* @property {Boolean} passwordCollisionCheck
*/
passwordCollisionCheck: false,
/**
* @memberof module:config
* @property {Boolean} revocationsExpire If true, expired revocation signatures are ignored
*/
revocationsExpire: false,
/**
* Allow decryption using RSA keys without `encrypt` flag.
* This setting is potentially insecure, but it is needed to get around an old openpgpjs bug
Expand Down
2 changes: 1 addition & 1 deletion src/key/helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ export async function isDataRevoked(primaryKey, signatureType, dataToVerify, rev
!signature || revocationSignature.issuerKeyID.equals(signature.issuerKeyID)
) {
await revocationSignature.verify(
key, signatureType, dataToVerify, config.revocationsExpire ? date : null, false, config
key, signatureType, dataToVerify, date, false, config
);

// TODO get an identifier of the revoked object instead
Expand Down
3 changes: 2 additions & 1 deletion test/general/key.js
Original file line number Diff line number Diff line change
Expand Up @@ -4275,7 +4275,8 @@ VYGdb3eNlV8CfoEC
const key = await openpgp.readKey({ armoredKey: pub_revoked_subkeys });
key.revocationSignatures = [];
key.users[0].revocationSignatures = [];
return openpgp.encrypt({ encryptionKeys: [key], message: await openpgp.createMessage({ text: 'random data' }), date: new Date(1386842743000) }).then(() => {
const subkeyRevocationTime = key.subkeys[0].revocationSignatures[0].created;
return openpgp.encrypt({ encryptionKeys: [key], message: await openpgp.createMessage({ text: 'random data' }), date: subkeyRevocationTime }).then(() => {
throw new Error('encryptSessionKey should not encrypt with revoked public key');
}).catch(error => {
expect(error.message).to.equal('Error encrypting message: Could not find valid encryption key packet in key ' + key.getKeyID().toHex() + ': Subkey is revoked');
Expand Down

0 comments on commit 3c4230e

Please sign in to comment.