Socket
Socket
Sign inDemoInstall

google-p12-pem

Package Overview
Dependencies
1
Maintainers
1
Versions
29
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    google-p12-pem

Convert Google .p12 keys to .pem keys


Version published
Weekly downloads
5.7M
decreased by-4.11%
Maintainers
1
Install size
1.61 MB
Created
Weekly downloads
 

Package description

What is google-p12-pem?

The google-p12-pem npm package is used to convert Google .p12 or PFX files to the PEM format. This is particularly useful when dealing with authentication in Google Cloud Platform services, as it allows developers to transform the private key obtained from Google into a format that can be used with various authentication libraries.

What are google-p12-pem's main functionalities?

Convert P12 to PEM

This feature allows you to convert a .p12 or PFX file to PEM format. The code sample demonstrates how to use the `getPem` function provided by the package to perform the conversion. The function takes the path to the .p12 file and a callback function that receives an error or the resulting PEM.

const { getPem } = require('google-p12-pem');
getPem('/path/to/key.p12', (err, pem) => {
  if (err) {
    console.error('Error converting P12 to PEM', err);
    return;
  }
  console.log(pem);
});

Convert P12 to PEM with Promise

This feature is similar to the previous one but uses Promises instead of callbacks. It allows for better integration with modern asynchronous JavaScript code, such as async/await syntax.

const { getPem } = require('google-p12-pem');
getPem('/path/to/key.p12').then(pem => {
  console.log(pem);
}).catch(err => {
  console.error('Error converting P12 to PEM', err);
});

Other packages similar to google-p12-pem

Readme

Source

google-p12-pem

Convert Google .p12 keys to .pem keys.

Build Status

Installation

npm install google-p12-pem

Usage

Asynchronous

var gp12 = require('google-p12-pem');
gp12('/path/to/key.p12', function(err, pem) {
  if (err) {
    console.log(err);
  } else {
    console.log(pem); // '-----BEGIN RSA PRIVATE KEY-----\nMIICXQIBAAK...'
  }
});

Synchronous

Note: If an error occurs and the callback is omitted, it will throw the error.

var gp12 = require('google-p12-pem');
var pem = gp12('/path/to/key.p12');
console.log(pem); // '-----BEGIN RSA PRIVATE KEY-----\nMIICXQIBAAK...'

CLI

gp12-pem myfile.p12 > output.pem

License

MIT

FAQs

Last updated on 06 Apr 2017

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc