* Commit updated Javascript packages * Bump preact from 10.5.4 to 10.5.5 in /build/javascript (#265) * Trying a new github workflow to install javascript packages * Bump tailwindcss from 1.9.2 to 1.9.4 in /build/javascript (#266) Bumps [tailwindcss](https://github.com/tailwindlabs/tailwindcss) from 1.9.2 to 1.9.4. - [Release notes](https://github.com/tailwindlabs/tailwindcss/releases) - [Changelog](https://github.com/tailwindlabs/tailwindcss/blob/master/CHANGELOG.md) - [Commits](https://github.com/tailwindlabs/tailwindcss/compare/v1.9.2...v1.9.4) Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Commit updated Javascript packages * Bump preact from 10.5.4 to 10.5.5 in /build/javascript Bumps [preact](https://github.com/preactjs/preact) from 10.5.4 to 10.5.5. - [Release notes](https://github.com/preactjs/preact/releases) - [Commits](https://github.com/preactjs/preact/compare/10.5.4...10.5.5) Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: Gabe Kangas <gabek@real-ity.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Owncast <owncast@owncast.online> * Bump @justinribeiro/lite-youtube in /build/javascript Bumps [@justinribeiro/lite-youtube](https://github.com/justinribeiro/lite-youtube) from 0.9.0 to 0.9.1. - [Release notes](https://github.com/justinribeiro/lite-youtube/releases) - [Commits](https://github.com/justinribeiro/lite-youtube/commits) Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: Owncast <owncast@owncast.online> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Gabe Kangas <gabek@real-ity.com>
76 lines
2.3 KiB
Markdown
76 lines
2.3 KiB
Markdown
# pkcs7
|
|
|
|
[](https://travis-ci.org/brightcove/pkcs7)
|
|
[](https://greenkeeper.io/)
|
|
[](http://slack.videojs.com)
|
|
|
|
[](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.
|