New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

jwk-to-pem

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jwk-to-pem - npm Package Compare versions

Comparing version 1.0.2 to 1.1.0

src/ec-curves.js

2

package.json
{
"name": "jwk-to-pem",
"version": "1.0.2",
"version": "1.1.0",
"description": "Convert a JSON Web Key to a PEM",

@@ -5,0 +5,0 @@ "main": "src/jwk-to-pem.js",

@@ -28,3 +28,3 @@ # jwk-to-pem

RSA | all RSA keys
EC | _P-256_ curve
EC | _P-256_, _P-384_, and _P-521_ curves

@@ -31,0 +31,0 @@ ## Contributing

@@ -5,3 +5,3 @@ 'use strict';

BN = asn1.bignum,
EC = require('elliptic').ec,
curves = require('./ec-curves'),
rfc3280 = require('asn1.js-rfc3280');

@@ -28,11 +28,5 @@

var curve;
switch (jwk.crv) {
case 'P-256': {
curve = new EC('p256');
break;
}
default: {
throw new Error('Unsupported curve "' + jwk.crv + '"');
}
var curve = curves[jwk.crv];
if (!curve) {
throw new Error('Unsupported curve "' + jwk.crv + '"');
}

@@ -45,2 +39,7 @@

var keyValidation = key.validate();
if (!keyValidation.result) {
throw new Error('Invalid key for curve: "' + keyValidation.reason + '"');
}
var result = keyToPem(jwk.crv, key);

@@ -58,2 +57,10 @@

}
case 'P-384': {
oid = [1, 3, 132, 0, 34];
break;
}
case 'P-521': {
oid = [1, 3, 132, 0, 35];
break;
}
default: {

@@ -60,0 +67,0 @@ throw new Error('Unsupported curve "' + crv + '"');

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc