mirror of
https://github.com/openpgpjs/openpgpjs.git
synced 2026-03-19 14:48:59 +00:00
crypto-refresh: add support for Argon2 S2K (#1597)
In terms of API, this feature is backwards compatible, no breaking changes. However, since a Wasm module is loaded for the Argon2 computation, browser apps might need to make changes to their CSP policy in order to use the feature. Newly introduced config fields: - `config.s2kType` (defaulting to `enums.s2k.iterated`): s2k to use on password-based encryption as well as private key encryption; - `config.s2kArgon2Params` (defaulting to "uniformly safe settings" from Argon RFC): parameters to use on encryption when `config.s2kType` is set to `enums.s2k.argon2`;
This commit is contained in:
@@ -18,6 +18,7 @@
|
||||
import * as stream from '@openpgp/web-stream-tools';
|
||||
import { armor, unarmor } from './encoding/armor';
|
||||
import KeyID from './type/keyid';
|
||||
import { Argon2OutOfMemoryError } from './type/s2k';
|
||||
import defaultConfig from './config';
|
||||
import crypto from './crypto';
|
||||
import enums from './enums';
|
||||
@@ -183,6 +184,9 @@ export class Message {
|
||||
decryptedSessionKeyPackets.push(skeskPacket);
|
||||
} catch (err) {
|
||||
util.printDebugError(err);
|
||||
if (err instanceof Argon2OutOfMemoryError) {
|
||||
exception = err;
|
||||
}
|
||||
}
|
||||
}));
|
||||
}));
|
||||
|
||||
Reference in New Issue
Block a user