2.0.0 • Published 1 year ago

abitti-meb-decryptor v2.0.0

Weekly downloads
-
License
MIT
Repository
-
Last release
1 year ago

abitti-meb-decryptor

Decrypts meb/mex files that are generated by the oma.abitti.fi service and used by the Abitti examination OS.

Example

import { decryptExamFile } from "abitti-meb-decryptor";
import { readFileSync } from "fs";

console.log(
  decryptExamFile(
    readFileSync("my-exam-file.meb"),
    "my super secure passphrase",
  ),
);

Usage

async decryptExamFile(encryptedFile: Buffer, password: string, signaturePublicKey?: Buffer) ⇒ DecryptedFiles

Decrypts the given MEB/MEX file with the given password. The signatures of the inner files will be validated with a public key if a public key is given. If no public key is given, signature checking is skipped. An exam.json file (for MEB files) or an exam.xml file (for MEX files) should exist inside; otherwise, an error is thrown.

DecryptedFiles

The decrypted inner files are represented as an object where the keys are the filenames of the inner files (e.g. "exam.xml") and the value is the file content as a buffer.

async decryptExamFileRaw(encryptedFile: Buffer, password: string, signaturePublicKey?: Buffer) ⇒ Record<string, Buffer>

If the file structure inside the exam file changes significantly (i.e., if there isn't a exam.json/exam.xml file), it is possible to use this function as validation of the file structure is skipped here.