# pkcs7

> Add and remove pkcs7-style padding.

Latest version **1.0.4** (published 2020-09-09) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install pkcs7
pnpm add pkcs7
yarn add pkcs7
bun add pkcs7
```

Provides the command `pkcs7`.

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 1.0.4 |
| Published | 2020-09-09 |
| First published | 2014-07-28 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 22.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 22 |
| Author | Brightcove |
| Maintainers | jcarfagno-bc, albshin, hkanagarajan, ingrid.s.cruz, cmarquez, tomson.george, carlosabajo, ericramos, palvarezbc, jasilvaantonio, nhaseena.mohamed, hrodriguez2, skumar85, granganathan, lauralopez, vnavarro, quillad, attinder, priyadharsshini, ogutierrez, agarciabcov, syurishi, fdelgado_bc, tshutt, rollocasanova, rociosantos, rahul.yadav, anand.gangadharan, kkashalkar, bvilvanathan, rodrigo.perez, arunjeyaprasad, mbalasubramaniam, cavieira, lescorcio, scorreia, jmpmacedo, bzizmond, dmkelly, xgarcia, sndy35, muthukumar.bc, chrisbanning, pdohertybcov, schhabra, mgonzalez_bc, ilunabcove, omartinez, vchistyakov, cvillasenor, ackbabe, etobin, dnortonbcov, bcpsalas, javibright, diegocruz1991, jorduno, ipadilla, marcogaray, gcastillobc, egoulding, sgopalakrishna, acruzr, psousa, erodrigues, carredondo, jcueto, cpayan, eledezma, bc-jcarlson, tteixeira, bmartinez, jgouveia, barroyo, manisha.sh, biswaranjan, bzhang-bcov, dchavez, jsepulveda, paco_oblea_bc, bcmauleon, mdeltorob, jblaker, jcapitao, hwoodbury, jedwards53, andydangerous, asinclair, stuartmh, elbadawimustafa, mtolanbc, mcarreiro, zhongqil, bc_rpeck, syseng, ekelson-bcove, revinkey, tnwanna, adalwani, gastafurov, mjholland, wswanbeck, khaipham, jonbwalsh, gnorth, bcabice, amanningbcov, sumeetdubey, lbx-dev, larsmaultsby, rjune, quicklyfrozen, salleko, jack.terranova, brightcove-admin, gkatsev, tedk, abradley-brightcove, bc-alive, misteroneill, mrocajr, forbesjo, brandonocasey, gesinger, violettemi, apadhye, marguinbc, brightcove-user, kmason, tomruggs, bsahlas, lday, cbarstow, jmingolla-bcov, pdias, misterben, twalling, jwhisenant, mjneil, abarstow, rtezera1, dmlap |
| Keywords | pkcs7, pkcs7 encrypt decrypt padding pkcs, videojs, videojs-plugin |

## Links

- npm: https://www.npmjs.com/package/pkcs7
- Repository: https://github.com/brightcove/pkcs7
- Issues: https://github.com/brightcove/pkcs7/issues
- npm.io page: https://npm.io/package/pkcs7

## Dependencies (1)

- [@babel/runtime](https://npm.io/package/@babel/runtime.md) ^7.5.5

## Alternatives

- [@sindresorhus/slugify](https://npm.io/package/@sindresorhus/slugify.md) — 3.7M weekly downloads
- [solid-js](https://npm.io/package/solid-js.md) — 2.7M weekly downloads
- [expo-glass-effect](https://npm.io/package/expo-glass-effect.md) — 2.5M weekly downloads
- [nanoassert](https://npm.io/package/nanoassert.md) — 780.8K weekly downloads
- [@ffmpeg/ffmpeg](https://npm.io/package/@ffmpeg/ffmpeg.md) — 529.5K weekly downloads

## Recent versions

- 1.0.4 (latest) — 2020-09-09
- 1.0.3 (experimental) — 2019-08-21
- 1.0.3-1 (next) — 2019-08-16
- 1.0.3-0 — 2019-08-16
- 1.0.2 — 2017-06-02
- 1.0.1 — 2017-06-02
- 1.0.0 — 2017-06-02
- 0.2.3 — 2015-01-13
- 0.2.2 — 2014-08-01
- 0.2.1 — 2014-07-31
- 0.2.0 — 2014-07-31
- 0.1.1 — 2014-07-29
- 0.1.0 — 2014-07-28

## README

# pkcs7

[![Build Status](https://travis-ci.org/brightcove/pkcs7.svg?branch=master)](https://travis-ci.org/brightcove/pkcs7)
[![Greenkeeper badge](https://badges.greenkeeper.io/brightcove/pkcs7.svg)](https://greenkeeper.io/)
[![Slack Status](http://slack.videojs.com/badge.svg)](http://slack.videojs.com)

[![NPM](https://nodei.co/npm/pkcs7.png?downloads=true&downloadRank=true)](https://nodei.co/npm/pkcs7/)

> Add and remove pkcs7-style padding.

<!-- START doctoc generated TOC please keep comment here to allow auto update -->
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
**Table of Contents**  *generated with [DocToc](https://github.com/thlorenz/doctoc)*

- [Getting Started](#getting-started)
- [Documentation](#documentation)
- [Examples](#examples)
- [Contributing](#contributing)
- [License](#license)

<!-- END doctoc generated TOC please keep comment here to allow auto update -->

## Getting Started

Install the module with: `npm install pkcs7`

```js
var pkcs7 = require('pkcs7'), encrypted;
// pad a buffer!
enctcrypted = encrypt(pkcs7.pad(buffer));

// later, you can unpad it:
console.log('the secret is out! ' + pkcs7.unpad(decrypt(encrypted)));
```

Install with cli command

```sh
$ npm install -g pkcs7
$ pkcs7 --help
$ pkcs7 --version
```

## Documentation

PKCS#7 padding a really simple transformation some crytographic algorithms use to ensure the number of input bytes is a multiple of some constant. Here's how it works:

             01 -- if lth mod k = k-1
          02 02 -- if lth mod k = k-2
              .
              .
              .
    k k ... k k -- if lth mod k = 0

`k` is the constant value the encryption algorithm wants your input to be a multiple of. This project assumes `k` is *always* sixteen. Not much to it, right? If reading specs is your thing, check out [RFC 5652](http://tools.ietf.org/html/rfc5652).


## Examples

You can run pkcs7 from the command line:

```shell
# pad a string generated by echo and the hex dump the result
echo -n "0123456789AB" | pkcs7 | xxd
```

## Contributing

In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using [Grunt](http://gruntjs.com).


## License

Copyright (c) 2014 Brightcove
Licensed under the Apache-2 license.

---
_Source: https://npm.io/package/pkcs7 · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
