How to use the pem.createPkcs12 function in pem

To help you get started, we’ve selected a few pem examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github DefinitelyTyped / DefinitelyTyped / types / pem / pem-tests.ts View on Github external
}, (error: any, csr: any) => {
        pem.createPkcs12(csr.clientKey, csr.certificate, 'mypassword', (err: any, pkcs12: any) => {
          test.ifError(err);
          test.ok(pkcs12);

          // test.ok(fs.readdirSync('./tmp').length === 0);
          test.done();
        });
      });
    });
github DefinitelyTyped / DefinitelyTyped / pem / pem-tests.ts View on Github external
}, (error: any, cert: any) => {
        test.ifError(error);

        pem.createPkcs12(cert.clientKey, cert.certificate, '', {certFiles: [ca.certificate]}, (error: any, pkcs12: any) => {
          test.ifError(error);
          test.ok(pkcs12.pkcs12);

          // test.ok(fs.readdirSync('./tmp').length === 0);

          pem.readPkcs12(pkcs12.pkcs12, (error: any, keystore: any) => {
            test.ifError(error);
            test.ok(keystore);

            test.equal(ca.certificate, keystore.ca[0]);
            test.equal(cert.certificate, keystore.cert);
            test.equal(cert.clientKey, keystore.key);

            test.done();
          });
        });
github DefinitelyTyped / DefinitelyTyped / types / pem / pem-tests.ts View on Github external
}, (error: any, cert: any) => {
        test.ifError(error);

        pem.createPkcs12(cert.clientKey, cert.certificate, '', {certFiles: [ca.certificate]}, (error: any, pkcs12: any) => {
          test.ifError(error);
          test.ok(pkcs12.pkcs12);

          // test.ok(fs.readdirSync('./tmp').length === 0);
          const pkcs12Buffer = new Buffer(pkcs12.pkcs12);

          pem.readPkcs12(pkcs12Buffer, (error: any, keystore: pem.Pkcs12ReadResult) => {
            test.ifError(error);
            test.ok(keystore);

            test.equal(ca.certificate, keystore.ca[0]);
            test.equal(cert.certificate, keystore.cert);
            test.equal(cert.clientKey, keystore.key);
          });

          const pkcs12File: string = __dirname + '/test.pkcs12';
github DefinitelyTyped / DefinitelyTyped / pem / pem-tests.ts View on Github external
}, (error: any, csr: any) => {

        pem.createPkcs12(csr.clientKey, csr.certificate, 'mypassword', (err: any, pkcs12: any) => {
          test.ifError(err);
          test.ok(pkcs12);

          // test.ok(fs.readdirSync('./tmp').length === 0);
          test.done();
        });
      });
    });
github smartdevicelink / sdl_server / app / v1 / helpers / certificates.js View on Github external
return new Promise((resolve, reject) => {
        pem.createPkcs12(
            clientKey,
            certificate,
            settings.securityOptions.passphrase,
            function (err, pkcs12) {
                if (err) {
                    return reject(err);
                }
                return resolve(pkcs12);
            }
        );
    });
}
github beameio / beame-sdk / src / services / Credential.js View on Github external
cred.getCert(sign, keys.pubKeys, {validityPeriod, saveCerts: false}).then(payload => {

								if (!payload) {
									reject(`invalid cert request payload`);
									return;
								}

								const pem = require('pem');

								pem.createPkcs12(private_key, payload.p7b, password, [], (err, pfx) => {

									if (err) {
										reject(err);
										return;
									}

									resolve({
										fqdn,
										pfx: pfx.pkcs12
									});
								});

							}).catch(onError);
						}).catch(onError);
github smartdevicelink / sdl_server / app / v1 / certificates / controller.js View on Github external
function checkAuthorityValidity (cb){
    if (!openSSLEnabled) {
        return cb(false);
    }
    pem.createPkcs12(
        authorityKey,
        authorityCertificate,
        settings.securityOptions.passphrase,
        {
            cipher: 'aes128',
            clientKeyPassword: settings.securityOptions.passphrase
        },
        function(err, pkcs12){
            cb((err) ? false : true);
        }
    );
}