Skip to content
No description or website provided.
Branch: master
Clone or download
Latest commit c730235 Jan 25, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
benchmarks tests: user safe-buffer and new buffer allocation methods Nov 3, 2016
fuzz fuzz: use native-crypto as keygen for fuzzing Feb 22, 2017
spec tests: user safe-buffer and new buffer allocation methods Nov 3, 2016
src add typescript typings Dec 21, 2018
.editorconfig init Jun 10, 2015
.eslintignore chore(style) use eslint Jan 18, 2016
.eslintrc chore(style) use eslint Jan 18, 2016
.gitignore init Jun 10, 2015
.npmignore chore(package) remove benchmarks and fuzz from package Jan 18, 2016
.travis.yml
CODEOWNERS meta: add myself as initial owner Jul 28, 2017
LICENSE init Jun 10, 2015
README.md chore(style) use eslint Jan 18, 2016
package.json v1.0.11 Jan 25, 2019

README.md

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.

You can’t perform that action at this time.