New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

goodpkcs7

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

goodpkcs7

A package for PKCS7 padding that actually works.

latest
Source
npmnpm
Version
1.0.1
Version published
Maintainers
1
Created
Source

goodpkcs7

a good library for pkcs7 padding

rationale

there isn't a good pkcs7 library on NPM. pkcs7 is okay, but it only supports padding to 16 byte blocks.

usage

install with npm install goodpkcs7

example usage:

// get the pad and unpad functions
const { pad, unpad } = require("goodpkcs7");
// pad an array, buffer, or uint8array
// note that the result will be a uint8array
const padded = pad([1, 2, 3, 4]);
// unpad a uint8array
const unpadded = unpad(padded);

goodpkcs7 provides two methods:

  • pad(message, bytes = 16) - Pads an array, buffer, or Uint8Array message to a multiple of the specified number of bytes (default 16). Returns a Uint8Array.
  • unpad(message, bytes = 16) - Unpads an array, buffer, or Uint8Array message given that its length is a multiple of the specified number of bytes (default 16). Returns a Uint8Array. Errors if the message is not properly padded.

goodpkcs7 can be used in the same way as pkcs7, but goodpkcs7 lets you specify the number of bytes per block if necessary.

licensing

goodpkcs7 is in the public domain. do whatever you want with it. i don't care.

Keywords

pkcs7

FAQs

Package last updated on 28 Nov 2022

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