summaryrefslogtreecommitdiffstats
path: root/node_modules/parse-asn1/fixProc.js
diff options
context:
space:
mode:
authorGravatar Piotr Russ <mail@pruss.it> 2020-11-18 23:26:45 +0100
committerGravatar Piotr Russ <mail@pruss.it> 2020-11-18 23:26:45 +0100
commit81ddf9b700bc48a1f8e472209f080f9c1d9a9b09 (patch)
tree8b959d50c5a614cbf9fcb346ed556140374d4b6d /node_modules/parse-asn1/fixProc.js
parent1870f3fdf43707a15fda0f609a021f516f45eb63 (diff)
downloadwebsite_creator-81ddf9b700bc48a1f8e472209f080f9c1d9a9b09.tar.gz
website_creator-81ddf9b700bc48a1f8e472209f080f9c1d9a9b09.tar.bz2
website_creator-81ddf9b700bc48a1f8e472209f080f9c1d9a9b09.zip
rm node_modules
Diffstat (limited to 'node_modules/parse-asn1/fixProc.js')
-rw-r--r--node_modules/parse-asn1/fixProc.js31
1 files changed, 0 insertions, 31 deletions
diff --git a/node_modules/parse-asn1/fixProc.js b/node_modules/parse-asn1/fixProc.js
deleted file mode 100644
index 4684971..0000000
--- a/node_modules/parse-asn1/fixProc.js
+++ /dev/null
@@ -1,31 +0,0 @@
-// adapted from https://github.com/apatil/pemstrip
-var findProc = /Proc-Type: 4,ENCRYPTED[\n\r]+DEK-Info: AES-((?:128)|(?:192)|(?:256))-CBC,([0-9A-H]+)[\n\r]+([0-9A-z\n\r+/=]+)[\n\r]+/m
-var startRegex = /^-----BEGIN ((?:.*? KEY)|CERTIFICATE)-----/m
-var fullRegex = /^-----BEGIN ((?:.*? KEY)|CERTIFICATE)-----([0-9A-z\n\r+/=]+)-----END \1-----$/m
-var evp = require('evp_bytestokey')
-var ciphers = require('browserify-aes')
-var Buffer = require('safe-buffer').Buffer
-module.exports = function (okey, password) {
- var key = okey.toString()
- var match = key.match(findProc)
- var decrypted
- if (!match) {
- var match2 = key.match(fullRegex)
- decrypted = Buffer.from(match2[2].replace(/[\r\n]/g, ''), 'base64')
- } else {
- var suite = 'aes' + match[1]
- var iv = Buffer.from(match[2], 'hex')
- var cipherText = Buffer.from(match[3].replace(/[\r\n]/g, ''), 'base64')
- var cipherKey = evp(password, iv.slice(0, 8), parseInt(match[1], 10)).key
- var out = []
- var cipher = ciphers.createDecipheriv(suite, cipherKey, iv)
- out.push(cipher.update(cipherText))
- out.push(cipher.final())
- decrypted = Buffer.concat(out)
- }
- var tag = key.match(startRegex)[1]
- return {
- tag: tag,
- data: decrypted
- }
-}