ecdsa-sig-formatter

Translate ECDSA signatures between ASN.1/DER and JOSE-style concatenation

Apache-2.0 10 个版本
安装
npm install ecdsa-sig-formatter
yarn add ecdsa-sig-formatter
pnpm add ecdsa-sig-formatter
bun add ecdsa-sig-formatter
README

ecdsa-sig-formatter

Build Status Coverage Status

Translate between JOSE and ASN.1/DER encodings for ECDSA signatures

Install

npm install ecdsa-sig-formatter --save

Usage

var format = require('ecdsa-sig-formatter');

var derSignature = '..'; // asn.1/DER encoded ecdsa signature

var joseSignature = format.derToJose(derSignature);

API


.derToJose(Buffer|String signature, String alg) -> String

Convert the ASN.1/DER encoded signature to a JOSE-style concatenated signature. Returns a base64 url encoded String.

  • If signature is a String, it should be base64 encoded
  • alg must be one of ES256, ES384 or ES512

.joseToDer(Buffer|String signature, String alg) -> Buffer

Convert the JOSE-style concatenated signature to an ASN.1/DER encoded signature. Returns a Buffer

  • If signature is a String, it should be base64 url encoded
  • alg must be one of ES256, ES384 or ES512

Contributing

  1. Fork the repository. Committing directly against this repository is highly discouraged.

  2. Make your modifications in a branch, updating and writing new unit tests as necessary in the spec directory.

  3. Ensure that all tests pass with npm test

  4. rebase your changes against master. Do not merge.

  5. Submit a pull request to this repository. Wait for tests to run and someone to chime in.

Code Style

This repository is configured with EditorConfig and ESLint rules.

版本列表
1.0.11 2019-01-25
1.0.10 2018-05-14
1.0.9 2016-12-05
1.0.8 2016-11-15
1.0.7 2016-06-18
1.0.6 2016-06-17
1.0.5 2016-01-20
1.0.2 2015-06-12
1.0.1 2015-06-10
1.0.0 2015-06-10