Skip to content

LowFlyingDuck/Encryptouflage

Repository files navigation

Encryptouflage

This is a module, that can encrypt and decrypt messsages.

About

With this module you can encrypt and decrypt any text message. This might be useful for encrypting Emails or Files in order to prevent third parties from monitoring the matter.

By default, the encrypted message is output in "lettered" format, camouflaging the message to automated email filters.

Usage

require the module

const encryptouflage = require('encryptouflage');

encrypt

encryptouflage.encrypt({ options })

options:

  • key
  • key / password desired to encrypt with
  • instream
  • readable stream of data, that is to be encrypted
  • outstream
  • writable stream, that the encrypted data is written to
  • algorithm (optional)
  • cipher algorithm used
    default: 'AES-256-CTR'
  • iv (optional)
  • initialization vector
    default crypto.randomBytes(16)
  • lettered (optional)
  • use "lettered" formatting
    default: true

example:

With lettered formatting
the initialization vector is added automatically.

const encryptouflage = require('./encryptouflage');
const fs = require('fs');

var input = fs.createReadStream('./input.txt');
var output = fs.createWriteStream('./output.encr');
var key = 'mysecretkey';

encryptouflage.encrypt({ instream: input, outstream: output, key: key });

With plain formatting
the initialization vector has to be handled manually.

const encryptouflage = require('./encryptouflage');
const fs = require('fs');

var input = fs.createReadStream('./input.txt');
var output = fs.createWriteStream('./output.encr');
var key = 'mysecretkey';

let iv = encryptouflage.encrypt({ instream: input, outstream: output, key: key, lettered: false });

output.on('close', function () {
  fs.appendFileSync(output.path, iv);
});

decrypt

encryptouflage.decrypt({ options })

options:

  • key
  • correct key / password to decrypt with
  • instream
  • readable stream of data, that is to be decrypted
  • outstream
  • writable stream, that the decrypted data is written to
  • iv
  • initialization vector
  • algorithm (optional)
  • cipher algorithm used
    default: 'AES-256-CTR'
  • lettered (optional)
  • use "lettered" formatting
    default: true

example:

With lettered formatting
the original initialization vector is extracted automatically and therefore not required.

const encryptouflage = require('./encryptouflage');
const fs = require('fs');

var input = fs.createReadStream('./input.encr');
var output = fs.createWriteStream('./output.txt');
var key = 'mysecretkey';

encryptouflage.decrypt({ instream: input, outstream: output, key: key});

With plain formatting
the original initialization cannot be extracted automatically and is therefore required.

const encryptouflage = require('./encryptouflage');
const fs = require('fs');

var input = fs.createReadStream('./input.encr');
var output = fs.createWriteStream('./output.txt');
var key = 'mysecretkey';
var iv = Buffer.from('qLhMmT0icQrCyTcyWaeT7g==', 'base64');

encryptouflage.decrypt({ instream: input, outstream: output, key: key, lettered: false, iv: iv });

License

Encryptouflage is MIT licensed. You can find out more and read the license document here.

About

This is a website, that can encrypt and decrypt messsages. (API Integration)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published