1.0.1 • Published 2 years ago

openssl-smime v1.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

openssl-smime

Node.js wrapper for OpenSSL S/MIME utility.

Documentation in Russian

Full documentation on the S / MIME function and its parameters can be found at link.

Requirements

  • The system must have the OpenSSL Toolkit installed.

Installation

npm i openssl-smime

Examples of using

const smime = require( 'openssl-smime' );

( async () => {

  const data = 'some text';

  const pkcs7 = await smime( 'sign', {
    nointern: true,
    nodetach: true,
    nocerts: true,
    nochain: true,
    outform: 'PEM',
    signer: 'path/to/cert/cert.pem',
    inkey: 'path/to/key/key.pem',
  }, data );

  const verified = await smime( 'verify', {
    noverify: true,
    inform: 'PEM',
    nointern: true,
    certfile: 'path/to/cert/cert.pem',
    CAfile: 'path/to/cert/cert.pem'
  }, pkcs7 );

} )();

Arguments

smime( method, options, content )

ArgumentTypeDescription
methodstingOne of the S/MIME function operations: sign / resign / encrypt / decrypt / verify / pk7out
optionsobjectAn object with parameters for the operation. The full list can be found in the OpenSSL documentation.
contentstring/BufferIf the options.in parameter is omitted, thecontent will be passed to the OpenSSL operation for encoding or decoding.