# p12-pem

> Extracts the certificate and the private key from a p12/ pkcs12 file

Latest version **1.0.5** (published 2021-12-12) · ISC license · 0 weekly downloads

## Install

```sh
npm install p12-pem
pnpm add p12-pem
yarn add p12-pem
bun add p12-pem
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: has types; high quality score.

Warnings: low downloads; no esm support; has vulnerabilities.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.5 |
| Published | 2021-12-12 |
| First published | 2020-04-05 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 16.1 KB |
| Known vulnerabilities | 1 (+34 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 4 |
| Author | David Koller |
| Maintainers | dave7117 |
| Keywords | p12, cert, pem, private key, p12 to pem, concert p12, extract p12 |

## Links

- npm: https://www.npmjs.com/package/p12-pem
- Repository: https://github.com/appit-online/p12-to-pem
- Homepage: https://github.com/appit-online/p12-to-pem#readme
- Issues: https://github.com/appit-online/p12-to-pem/issues
- Funding: https://paypal.me/dave7117
- npm.io page: https://npm.io/package/p12-pem

## Dependencies (1)

- [node-forge](https://npm.io/package/node-forge.md) ^0.10.0

## Recent versions

- 1.0.5 (latest) — 2021-12-12
- 1.0.4 — 2020-04-09
- 1.0.3 — 2020-04-05
- 1.0.2 — 2020-04-05
- 1.0.1 — 2020-04-05
- 1.0.0 — 2020-04-05

## README

# [p12-to-pem-converter: Node.js](https://github.com/appit-online/p12-to-pem)

Convert PKCS12/.p12-files into pem key and pem certificate.



**Table of contents:**


* [Quickstart](#quickstart)

  * [Installing the library](#installing-the-library)
  * [Using the library](#using-the-library)
* [License](#license)

## Quickstart

### Installing the library

```bash
npm install p12-pem --save
```


### Using the library

```javascript
import * as p12 from 'p12-pem';

/**
 * Given a p12 file, convert it to the PEM format.
 * @param {string} pathToCert The relative path to a p12 file.
 * @param {string} password of p12 / private key.
 */
const {pemKey, pemCertificate, commonName} = p12.getPemFromP12(certPath, password);
console.log('The converted private key in PEM:');
console.log(pemKey);

console.log('The converted certificate in PEM:');
console.log(pemCertificate)

console.log('The extracted commonName:');
console.log(commonName);

```

## Supported Node.js Versions

Our client libraries follow the [Node.js release schedule](https://nodejs.org/en/about/releases/).
Libraries are compatible with all current _active_ and _maintenance_ versions of
Node.js.

## License

Apache Version 2.0

See [LICENSE](https://github.com/appit-online/p12-to-pem/blob/master/LICENSE)

---
_Source: https://npm.io/package/p12-pem · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
