UNPKG

@li0ard/magma

Version:

Magma cipher implementation in pure TypeScript

55 lines (54 loc) 2.31 kB
import { type Sbox } from "../"; /** * Key wrapping (GOST 28147-89) * @param kek Key encryption key * @param cek Content encryption key * @param ukm UKM (Initialization vector) * @param sbox Optional substitution box, defaults to `ID_GOST_28147_89_CRYPTO_PRO_A_PARAM_SET` */ export declare const wrap: (kek: Uint8Array, cek: Uint8Array, ukm: Uint8Array, sbox?: Sbox) => Uint8Array; /** * Key unwrapping (GOST 28147-89) * @param kek Key encryption key * @param data Wrapped key * @param sbox Optional substitution box, defaults to `ID_GOST_28147_89_CRYPTO_PRO_A_PARAM_SET` */ export declare const unwrap: (kek: Uint8Array, data: Uint8Array, sbox?: Sbox) => Uint8Array; /** * Key wrapping (CryptoPro) * @param kek Key encryption key * @param cek Content encryption key * @param ukm UKM (Initialization vector) * @param sbox Optional substitution box, defaults to `ID_GOST_28147_89_CRYPTO_PRO_A_PARAM_SET` */ export declare const wrapCryptopro: (kek: Uint8Array, cek: Uint8Array, ukm: Uint8Array, sbox?: Sbox) => Uint8Array; /** * Key unwrapping (CryptoPro) * @param kek Key encryption key * @param data Wrapped key * @param sbox Optional substitution box, defaults to `ID_GOST_28147_89_CRYPTO_PRO_A_PARAM_SET` */ export declare const unwrapCryptopro: (kek: Uint8Array, data: Uint8Array, sbox?: Sbox) => Uint8Array; /** * CryptoPro KEK Diversification (RFC 4357, section 6.5) * @param kek Key encryption key * @param ukm UKM (Initialization vector) * @param sbox Optional substitution box, defaults to `ID_GOST_28147_89_CRYPTO_PRO_A_PARAM_SET` */ export declare const cp_kek_diversify: (kek: Uint8Array, ukm: Uint8Array, sbox?: Sbox) => Uint8Array; /** * KExp15 key exporting * @param key Key to export * @param keyEnc Key for key encryption * @param keyMac Key for key authentication * @param iv Initialization vector (Half of block size) */ export declare const kexp15: (key: Uint8Array, keyEnc: Uint8Array, keyMac: Uint8Array, iv: Uint8Array) => Uint8Array; /** * KImp15 key importing * @param kexp Key to import * @param keyEnc Key for key decryption * @param keyMac Key for key authentication * @param iv Initialization vector (Half of block size) */ export declare const kimp15: (kexp: Uint8Array, keyEnc: Uint8Array, keyMac: Uint8Array, iv: Uint8Array) => Uint8Array;