@li0ard/cpfx
Декодер PFX и ключевого контейнера КриптоПро
docs
# из NPM
npm i @li0ard/cpfx
# из JSR
bunx jsr i @li0ard/cpfximport { proceedPFX } from "@li0ard/cpfx";
const file = await Bun.file("/path/to.pfx").bytes();
const result = await proceedPFX(file, "password");
console.log(result.pem);import { proceedCryptoProContainer } from "@li0ard/cpfx";
const headerKey = await Bun.file("/path/to/header.key").bytes();
const masksKey = await Bun.file("/path/to/masks.key").bytes();
const primaryKey = await Bun.file("/path/to/primary.key").bytes();
const result = await proceedCryptoProContainer(
headerKey,
masksKey,
primaryKey,
"password"
);
console.log(result.pem);import { changeContainerExportable } from "@li0ard/cpfx";
const headerKey = Bun.file("/path/to/header.key");
const newHeaderKey = changeContainerExportable(await file.bytes(), true); // Разрешить экспорт
await headerKey.write(newHeaderKey);- Статья про cpfx на Хабре
- Статья про ckey на Хабре
- Цикл статей в блоге: ч.1, ч.2, ч.3