import { pkEncrypt } from "https://deno.land/x/simple_utility@v1.4.4/src/crypto.ts";
Encrypt binary. Algorithm is AES-GCM with 128 bits key, 128 bits tag and 96 bits IV. IV is prepended to cipher.
Examples
Example 1
Example 1
const bin = await Deno.readFile("./file");
const k1 = await pkGenerateECDH();
const k2 = await pkGenerateECDH();
const cipher = await pkEncrypt({
publicKey: k1.publicKey,
privateKey: k2.privateKey
}, bin);
const decrypt = await pkDecrypt({
publicKey: k2.publicKey,
privateKey: k1.privateKey
}, cipher);
Parameters
unnamed 0: PortableCryptoKeyPair