Socket
Socket
Sign inDemoInstall

parse-asn1

Package Overview
Dependencies
19
Maintainers
5
Versions
18
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 5.0.0 to 5.1.0

certificate.js

5

asn1.js
// from https://github.com/indutny/self-signed/blob/gh-pages/lib/asn1.js
// Fedor, you are amazing.
'use strict'
var asn1 = require('asn1.js')
exports.certificate = require('./certificate')
var RSAPrivateKey = asn1.define('RSAPrivateKey', function () {

@@ -97,2 +100,3 @@ this.seq().obj(

})
var ECPrivateKey = asn1.define('ECPrivateKey', function () {

@@ -107,2 +111,3 @@ this.seq().obj(

exports.ECPrivateKey = ECPrivateKey
var ECParameters = asn1.define('ECParameters', function () {

@@ -109,0 +114,0 @@ this.choice({

8

fixProc.js
// adapted from https://github.com/apatil/pemstrip
var findProc = /Proc-Type: 4,ENCRYPTED\r?\nDEK-Info: AES-((?:128)|(?:192)|(?:256))-CBC,([0-9A-H]+)\r?\n\r?\n([0-9A-z\n\r\+\/\=]+)\r?\n/m
var startRegex = /^-----BEGIN (.*) KEY-----\r?\n/m
var fullRegex = /^-----BEGIN (.*) KEY-----\r?\n([0-9A-z\n\r\+\/\=]+)\r?\n-----END \1 KEY-----$/m
var findProc = /Proc-Type: 4,ENCRYPTED\n\r?DEK-Info: AES-((?:128)|(?:192)|(?:256))-CBC,([0-9A-H]+)\n\r?\n\r?([0-9A-z\n\r\+\/\=]+)\n\r?/m
var startRegex = /^-----BEGIN ((?:.* KEY)|CERTIFICATE)-----\n/m
var fullRegex = /^-----BEGIN ((?:.* KEY)|CERTIFICATE)-----\n\r?([0-9A-z\n\r\+\/\=]+)\n\r?-----END \1-----$/m
var evp = require('evp_bytestokey')

@@ -25,3 +25,3 @@ var ciphers = require('browserify-aes')

}
var tag = key.match(startRegex)[1] + ' KEY'
var tag = key.match(startRegex)[1]
return {

@@ -28,0 +28,0 @@ tag: tag,

@@ -24,4 +24,9 @@ var asn1 = require('./asn1')

switch (type) {
case 'CERTIFICATE':
ndata = asn1.certificate.decode(data, 'der').tbsCertificate.subjectPublicKeyInfo
// falls through
case 'PUBLIC KEY':
ndata = asn1.PublicKey.decode(data, 'der')
if (!ndata) {
ndata = asn1.PublicKey.decode(data, 'der')
}
subtype = ndata.algorithm.algorithm.join('.')

@@ -28,0 +33,0 @@ switch (subtype) {

{
"name": "parse-asn1",
"version": "5.0.0",
"description": "",
"version": "5.1.0",
"description": "utility library for parsing asn1 files for use with browserify-sign.",
"main": "index.js",

@@ -6,0 +6,0 @@ "scripts": {

var test = require('tape')
var fs = require('fs')
var parseKey = require('../')
var crypto = require('crypto')
var rsa1024 = {

@@ -71,2 +70,6 @@ private: fs.readFileSync(__dirname + '/rsa.1024.priv'),

}
var cert = {
private: fs.readFileSync(__dirname + '/rsa.1024.priv'),
public: fs.readFileSync(__dirname + '/node.cert')
}
var i = 0

@@ -76,4 +79,4 @@ function testIt (keys) {

t.plan(2)
t.ok(parseKey(keys.public, crypto), 'public key')
t.ok(parseKey(keys.private, crypto), 'private key')
t.ok(parseKey(keys.public), 'public key')
t.ok(parseKey(keys.private), 'private key')
})

@@ -95,1 +98,2 @@ }

testIt(pass1024)
testIt(cert)
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