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

simple-pem2jwk

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

simple-pem2jwk

Parse PEM to JWK format with minimal dependencies

  • 0.2.4
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

simple-pem2jwk

Simple RSA key conversion from PEM-format to JWK-format with no dependencies on Node.js or Web Crypto API. Works in react-native.

Example for private key;

const privateKey = `-----BEGIN RSA PRIVATE KEY-----
MIIEowIBAAKCA... ...e+BMRbC5SnJpMsfF0luZhvX
-----END RSA PRIVATE KEY-----`

pem2jwk(privateKey)

// Output:
// {
//     p: '...',
//     kty: 'RSA',
//     q: '...',
//     d: '...',
//     e: '...',
//     qi: '...',
//     dp: '...',
//     dq: '...',
//     n: '...'
// }

// It works the same way with public keys but the output only contains parameters n, e and kty

What does the parameters mean?

Read section 6.3 in rfc7518.

Why this lib?

The lib react-native-rsa-native generates keys in PEM format but did not support exporting to JWK format. Hence this helper lib.

Keywords

FAQs

Package last updated on 22 May 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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