Socket
Book a DemoInstallSign in
Socket

openssl-file

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

openssl-file

A Javascript library for node, to enable it to encrypt and decrypt files in a openssl compatible way.

latest
Source
npmnpm
Version
1.0.0
Version published
Maintainers
1
Created
Source

node-openssl-file

A Javascript library for node, to enable it to encrypt and decrypt files in a openssl compatible way. Decryption is not yet implemented but shoud be very little work to add it. This libary uses the old way of generating the key from the password, which is now considered insecure, so only use this library for compatibility reasons. The key now should be generated with PBKDF2, if need more information, look into the node docs for crypto.pbkdf2 and crypto.createCipher.

Functions

EVP_BytesToKey (password: string|Buffer, salt: string|Buffer|null, keyLen: number, hashName: string = "SHA256", ivLen = 0) This function works exactly like the same named openssl function: EVP_BytesToKey.

  • password: a buffer or a string (which is converted to a buffer via ascii encoding, so do not use utf8 characters)
  • salt: a buffer or a string with byte length 8, if it is null no salt is used
  • keyLen: the length of the needed key
  • hashName: the hash to be used for key generation, has to be supported by crypto.createHash
  • ivLen: the length of the needed IV (initialization vector)
  • returns: {key: Buffer, iv: Buffer}

opensslEncBuf(algo: string, inp: Buffer, pw: string, useSalt: bool = true) This function works like calling openssl {algo} -e -k {pw} -salt.

  • algo: is the encryption algorithm e.g. bf (blowfish), must be supported by crypto.createCipheriv
  • inp: is the data to be encrypted
  • pw: is the password to encrypt with
  • useSalt: if you don't want to use a salt, pass false. This is like ommiting the -salt parameter when calling openssl.
  • returns: A Buffer containing the encrypted data

Keywords

openssl

FAQs

Package last updated on 14 Mar 2018

Did you know?

Socket

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