This commit is contained in:
GotPPay
2017-10-16 20:21:19 +02:00
parent 8a7f8794cf
commit a75ea978f9
2554 changed files with 804218 additions and 109 deletions

1
backend/node_modules/google-p12-pem/.npmignore generated vendored Normal file
View File

@@ -0,0 +1 @@
node_modules

4
backend/node_modules/google-p12-pem/.travis.yml generated vendored Normal file
View File

@@ -0,0 +1,4 @@
language: node_js
node_js:
- "0.11"
- "0.10"

21
backend/node_modules/google-p12-pem/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) 2014 Ryan Seys
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

46
backend/node_modules/google-p12-pem/README.md generated vendored Normal file
View File

@@ -0,0 +1,46 @@
# google-p12-pem
Convert Google `.p12` keys to `.pem` keys.
[![Build Status](https://travis-ci.org/ryanseys/google-p12-pem.svg?branch=travis)](https://travis-ci.org/ryanseys/google-p12-pem)
## Installation
``` sh
npm install google-p12-pem
```
## Usage
### Asynchronous
``` js
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.
``` js
var gp12 = require('google-p12-pem');
var pem = gp12('/path/to/key.p12');
console.log(pem); // '-----BEGIN RSA PRIVATE KEY-----\nMIICXQIBAAK...'
```
### CLI
``` sh
gp12-pem myfile.p12 > output.pem
```
## License
MIT

19
backend/node_modules/google-p12-pem/bin/gp12-pem generated vendored Executable file
View File

@@ -0,0 +1,19 @@
#!/usr/bin/env node
var gp12 = require('../');
var argv = process.argv;
var p12Path = argv[2];
if (!p12Path) {
console.error('Please specify a *.p12 file to convert.');
process.exit(1);
}
gp12(p12Path, function(err, pem) {
if (err) {
console.log(err);
process.exit(1);
} else {
console.log(pem);
}
});

60
backend/node_modules/google-p12-pem/index.js generated vendored Normal file
View File

@@ -0,0 +1,60 @@
var forge = require('node-forge');
var fs = require('fs');
/**
* Convert a .p12 file to .pem string.
* This is the constructor so it can also be used to
* create an object that can be reused to get different keys.
*
* @param {string} filename The .p12 key filename.
* @param {Function=} callback The callback function.
*/
function GoogleP12toPem(filename, callback) {
if (!(this instanceof GoogleP12toPem)) {
var gp12 = new GoogleP12toPem();
return gp12.getPem(filename, callback);
}
this.pem = null;
}
/**
* Convert a .p12 file to .pem string
* @param {string} filename The .p12 key filename.
* @param {Function=} callback The callback function.
* @return {string=} The .pem private key if no callback provided.
*/
GoogleP12toPem.prototype.getPem = function(filename, callback) {
var self = this;
if (typeof callback === 'function') {
fs.readFile(filename, { encoding: 'base64' }, function(err, keyp12) {
if (err) {
callback(err, null);
return;
}
try {
this.pem = _convertToPem(keyp12);
} catch (e) {
callback(e, null);
return;
}
callback(null, this.pem);
});
} else {
var keyp12 = fs.readFileSync(filename, { encoding: 'base64' });
this.pem = _convertToPem(keyp12);
return this.pem;
}
function _convertToPem(p12base64) {
var p12Der = forge.util.decode64(p12base64);
var p12Asn1 = forge.asn1.fromDer(p12Der);
var p12 = forge.pkcs12.pkcs12FromAsn1(p12Asn1, 'notasecret');
var privateKey = p12.getBagsByFriendlyName('privatekey')[0].key;
var pem = forge.pki.privateKeyToPem(privateKey);
return pem.replace(/\r\n/g, '\n');
}
};
module.exports = GoogleP12toPem;

47
backend/node_modules/google-p12-pem/package.json generated vendored Normal file
View File

@@ -0,0 +1,47 @@
{
"_from": "google-p12-pem@^0.1.0",
"_id": "google-p12-pem@0.1.2",
"_inBundle": false,
"_integrity": "sha1-M8RqsCGqc0+gMys5YKmj/8svMXc=",
"_location": "/google-p12-pem",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "google-p12-pem@^0.1.0",
"name": "google-p12-pem",
"escapedName": "google-p12-pem",
"rawSpec": "^0.1.0",
"saveSpec": null,
"fetchSpec": "^0.1.0"
},
"_requiredBy": [
"/gtoken"
],
"_resolved": "https://registry.npmjs.org/google-p12-pem/-/google-p12-pem-0.1.2.tgz",
"_shasum": "33c46ab021aa734fa0332b3960a9a3ffcb2f3177",
"_spec": "google-p12-pem@^0.1.0",
"_where": "/home/bilal/Saburly/slucajna-televizija/backend/node_modules/gtoken",
"author": {
"name": "Ryan Seys"
},
"bin": {
"gp12-pem": "bin/gp12-pem"
},
"bundleDependencies": false,
"dependencies": {
"node-forge": "^0.7.1"
},
"deprecated": false,
"description": "Convert Google .p12 keys to .pem keys",
"devDependencies": {
"mocha": "2.0.1"
},
"license": "MIT",
"main": "index.js",
"name": "google-p12-pem",
"scripts": {
"test": "mocha"
},
"version": "0.1.2"
}

Binary file not shown.

BIN
backend/node_modules/google-p12-pem/test/assets/key.p12 generated vendored Normal file

Binary file not shown.

View File

@@ -0,0 +1,15 @@
-----BEGIN RSA PRIVATE KEY-----
MIICXQIBAAKBgQDzLFXig9jbMwyXM+dlVfKHtdbqK1vy+N+oNUf81BKl5EmrYNgx
76wO/bgQ+XP5nIjsRkS2NwOgCBmSMos36/d+FJBa5Q/lHVjUWQBuTa2CBC9dPhYe
hCVSdFPtlBo7vAOWO/n/2TcSfFrqPONcnfHI68P80uuL59oE9Fhpmql2owIDAQAB
AoGAAwYnH0UCel9dJbg4hXMXLAbf4FOfthrQNThMZ+F/Rd7b56yxo5VWb21KT7O6
dH002rNZAWcXvXK8VqwYPR7LGhkUWcKpEzoLIGIJVFG+vB5ZMQhulVeFC+tx8aXh
waPl5Y7b1URx5EhGc0Lm+y3Y4hZ2QwPHqaCSKJ9nj5MkWzkCQQD/As45WlpPHc45
2xeYDu86IaeBcSz6TwPkuc3ZUoNmO3elBzlgEDVai3deIpl9KqBJdAclHIyTwT2N
NuQiU1Z/AkEA9B3GxxajRNp1Q/y061C3g5htS69hVFD8bHbqEko522yR8eriBxRq
vlJDpJD966x60pNX+37FdXWx3c6aS3C13QJAYx8yDbUDGXGacX6p4x8a+duPAo99
TiZcexGF5A1gqeI/lVQDh0WFl5ZSZbLJOo/REfwZsuEv+1bHmBZYAsel/QJBAMLj
dsuAri4M/iud904aLbg4m6EdzeVDlpJ9SRf6/D/KaKWrMHIYgbOZ93jNbHqXQ6MT
kN0uczP4F10OUS5DOF0CQQDK0pjjBxWAlhaxIpAHpuZvM58NbHJ8SO4yxW8alwVo
ly4JILSVng9ToCzs208ChqsMOya1W2PpnDZj0IrQMJIf
-----END RSA PRIVATE KEY-----

59
backend/node_modules/google-p12-pem/test/index.js generated vendored Normal file
View File

@@ -0,0 +1,59 @@
var assert = require('assert');
var fs = require('fs');
describe('GoogleP12Pem', function() {
var gp12pem = require('../index.js');
var GOODP12FILE = './test/assets/key.p12';
var BADP12FILE = './test/assets/badkey.p12';
var PEMFILENAME = './test/assets/key.pem';
var expectedPem = fs.readFileSync(PEMFILENAME, { encoding: 'utf8' });
var noop = function() {};
it('should exist', function() {
assert.equal(typeof gp12pem, 'function');
});
it('should provide error on bad filename and callback', function(done) {
gp12pem('./badfilename.p12', function(err, pem) {
assert(err);
assert.equal(pem, null);
assert.ok(err.message.startsWith("ENOENT"));
done();
});
});
it('should throw ENOENT on bad filename with no callback', function() {
assert.throws(function() {
var pem = gp12pem('./badfilename.p12');
}, /ENOENT/);
});
it('should throw error on bad .p12 with no callback', function() {
assert.throws(function() {
var pem = gp12pem(BADP12FILE);
}, /Too few bytes to read/);
});
it('should return error on bad .p12 in callback', function(done) {
assert.doesNotThrow(function() {
gp12pem(BADP12FILE, function(err, pem) {
assert.equal(null);
assert(err.message.indexOf('Too few bytes to read') > -1);
done();
});
});
});
it('should work async when provided a callback', function(done) {
gp12pem(GOODP12FILE, function(err, pem) {
assert.ifError(err);
assert.equal(expectedPem, pem);
done();
});
});
it('should work sync when not provided a callback', function() {
var pem = gp12pem(GOODP12FILE);
assert.equal(expectedPem, pem);
});
});