import { pubkeyDecrypt } from "https://deno.land/x/simple_utility@v1.3.4/mod.universal.ts";
Decrypt binary. Algorithm use is "AES-GCM" with 256 bits key, 128 bits tag and 96 bits IV. IV is read from head of cipher.
Examples
Example 1
Example 1
const bin = await Deno.readFile("./file");
const key1 = await pubkeyGen("ECDH");
const key2 = await pubkeyGen("ECDH");
const converted = await pubkeyEncrypt({
publicKey: key1.publicKey,
privateKey: key2.privateKey
}, bin);
const restored = await pubkeyDecrypt({
publicKey: key2.publicKey,
privateKey: key1.privateKey
}, converted);
Parameters
unnamed 0: PortableCryptoKeyPair