Bugfix: ECC mode now works correctly in 'Generate PGP Key Pair'

This commit is contained in:
n1474335 2021-02-01 11:10:04 +00:00
parent 7dccecb336
commit 9892ee273e
2 changed files with 7 additions and 4 deletions

View file

@ -33,7 +33,7 @@ class GeneratePGPKeyPair extends Operation {
{ {
"name": "Key type", "name": "Key type",
"type": "option", "type": "option",
"value": ["RSA-1024", "RSA-2048", "RSA-4096", "ECC-256", "ECC-384"] "value": ["RSA-1024", "RSA-2048", "RSA-4096", "ECC-256", "ECC-384", "ECC-521"]
}, },
{ {
"name": "Password (optional)", "name": "Password (optional)",
@ -59,12 +59,15 @@ class GeneratePGPKeyPair extends Operation {
* @returns {string} * @returns {string}
*/ */
async run(input, args) { async run(input, args) {
const [keyType, keySize] = args[0].split("-"), let [keyType, keySize] = args[0].split("-");
password = args[1], const password = args[1],
name = args[2], name = args[2],
email = args[3]; email = args[3];
let userIdentifier = ""; let userIdentifier = "";
keyType = keyType.toLowerCase();
keySize = parseInt(keySize, 10);
if (name) userIdentifier += name; if (name) userIdentifier += name;
if (email) userIdentifier += ` <${email}>`; if (email) userIdentifier += ` <${email}>`;

View file

@ -588,7 +588,7 @@ Password: 034148`;
const result = await chef.generatePGPKeyPair("Back To the Drawing Board", { const result = await chef.generatePGPKeyPair("Back To the Drawing Board", {
keyType: "ECC-256", keyType: "ECC-256",
}); });
assert.strictEqual(result.toString().length, 2007); assert.strictEqual(result.toString().length, 2560);
}), }),
it("Generate UUID", () => { it("Generate UUID", () => {