New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

asn1-ber

Package Overview
Dependencies
Maintainers
3
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

asn1-ber - npm Package Compare versions

Comparing version 1.2.0 to 1.2.1

33

lib/ber/reader.js

@@ -230,3 +230,36 @@

Reader.prototype.readBitString = function(tag) {
if (!tag)
tag = ASN1.BitString;
var b = this.peek();
if (b === null)
return null;
if (b !== tag)
throw InvalidAsn1Error('Expected 0x' + tag.toString(16) +
': got 0x' + b.toString(16));
var o = this.readLength(this._offset + 1);
if (o === null)
return null;
if (this.length > this._size - o)
return null;
this._offset = o;
if (this.length === 0)
return '';
var ignoredBits = this._buf[this._offset++];
var bitStringOctets = this._buf.slice(this._offset, this._offset + this.length - 1);
var bitString = (parseInt(bitStringOctets.toString('hex'), 16).toString(2)).padStart(bitStringOctets.length * 8, '0');
this._offset += this.length - 1;
return bitString.substring(0, bitString.length - ignoredBits);
};
Reader.prototype._readTag = function(tag) {

@@ -233,0 +266,0 @@ // assert.ok(tag !== undefined);

2

package.json
{
"name": "asn1-ber",
"version": "1.2.0",
"version": "1.2.1",
"description": "Generate and parse ASN1.BER objects",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -575,2 +575,6 @@

## Version 1.2.1 - 07/06/2022
* Add bit string reading
# License

@@ -577,0 +581,0 @@

@@ -241,2 +241,10 @@

describe("readBitString()", function() {
it("can read a bit string", function() {
var reader = new BerReader(Buffer.from([0x03, 0x07, 0x04, 0x0a, 0x3b, 0x5f, 0x29, 0x1c, 0xd0]))
assert.equal(reader.readBitString(), '00001010001110110101111100101001000111001101')
assert.equal(reader.length, 7)
})
})
describe("complex sequences", function() {

@@ -243,0 +251,0 @@ it("are processed correctly", function() {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc