Socket
Socket
Sign inDemoInstall

auth-cipher

Package Overview
Dependencies
17
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    auth-cipher

streaming authenticated cipher


Version published
Weekly downloads
1
Maintainers
1
Install size
425 kB
Created
Weekly downloads
 

Readme

Source

auth-cipher

A streaming authenticated cipher with sensible defaults.

npm install auth-cipher

API

var authCipher = require('auth-cipher');
var cipherStream = authCipher.cipher(new Buffer('password'));
var decipherStream = authCipher.decipher(new Buffer('password'));
something.pipe(cipherStream).pipe(something).pipe(decipherStream).pipe(somewhere);

An encrypt then hmac stratagy is used.

Encryption is provided by create-cipher which is just a thin wrapper around node createCipher but using pbkdf2 to derive the key and IV. A 16 byte salt with 1000 iterations are used to derive the key and IV, aes-256-ctr is used for the cipher suite.

Authentication is provided by hmac-stream which divides the message into chunks and hmacs them using a key also derived from the password pbkdf2 but with a different salt. The size of a chunk is variable up to a certain size and is designed to be secure first with secondary goal of a trade off between avoiding too much overhead (lots of 256 bit hmacs with data chunks that are shorter then their hash) and avoiding buffering, Sync Buffer Stream is used for this. The HMAC key is incremented after each chunk and extra data is put into the last chunk to differentiate it.

FAQs

Last updated on 05 Nov 2014

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc