Skip to content

li0ard/cpfx_ts

Repository files navigation

@li0ard/cpfx
Декодер PFX и ключевого контейнера КриптоПро
docs




Установка

# из NPM
npm i @li0ard/cpfx

# из JSR
bunx jsr i @li0ard/cpfx

Использование

Декодирование PFX (cpfx)

import { proceedPFX } from "@li0ard/cpfx";

const file = await Bun.file("/path/to.pfx").bytes();
const result = await proceedPFX(file, "password");

console.log(result.pem);

Декодирование ключевого контейнера (ckey)

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);

Ссылки

About

Декодер PFX и ключевого контейнера КриптоПро

Topics

Resources

License

Stars

Watchers

Forks

Contributors