// Erzeugt die v6-Fixtures neu (v4.pgp nicht): // node internal/pgpkey/testdata/gen.mjs internal/pgpkey/testdata // Passphrase der geschützten Schlüssel: "probe probe". import * as openpgp from "../../../frontend/node_modules/openpgp/dist/node/openpgp.mjs"; import { writeFileSync } from "fs"; const out = process.argv[2]; const strong = { v6Keys: true, s2kType: openpgp.enums.s2k.argon2, aeadProtect: true }; async function gen(uid, name) { const { privateKey, publicKey, revocationCertificate } = await openpgp.generateKey({ type: "curve25519", userIDs: [uid], passphrase: "probe probe", keyExpirationTime: 2*365*86400, format: "object", config: strong }); writeFileSync(`${out}/${name}.pgp`, publicKey.write()); writeFileSync(`${out}/${name}-locked.pgp`, privateKey.write()); writeFileSync(`${out}/${name}.fpr`, publicKey.getFingerprint() + "\n"); return { privateKey, publicKey, revocationCertificate }; } const a = await gen({ email: "alice@kver.xyz" }, "v6"); await gen({ email: "alice@kver.xyz" }, "v6-2"); const { publicKey: rev } = await openpgp.revokeKey({ key: a.publicKey, revocationCertificate: a.revocationCertificate, format: "object" }); writeFileSync(`${out}/v6-revoked.pgp`, rev.write()); const open = await openpgp.decryptKey({ privateKey: a.privateKey, passphrase: "probe probe" }); writeFileSync(`${out}/v6-secret.pgp`, open.write()); const iter = await openpgp.encryptKey({ privateKey: open, passphrase: "probe probe", config: { s2kType: openpgp.enums.s2k.iterated, aeadProtect: false } }); writeFileSync(`${out}/v6-iter.pgp`, iter.write()); const f = await openpgp.generateKey({ type: "curve25519", userIDs: [{ name: "alice", email: "alice@kver.example.org" }], format: "object", config: { v6Keys: true } }); writeFileSync(`${out}/v6-foreign.pgp`, f.publicKey.write());