asn1.js icon indicating copy to clipboard operation
asn1.js copied to clipboard

Unbound integers

Open indutny opened this issue 11 years ago • 2 comments

Should support unbound integers somehow.

indutny avatar Dec 07 '13 07:12 indutny

+1 on this one. With unbound, do you refer to negative integers as well? The following fails:

    it ('-1 bug in ASN.1 implementation', () => {
        var ASNInteger = asn1.define('Integer', function () {
            this.seq().obj(
                this.key('aNumber').int());
        });
        var one = ASNInteger.encode({aNumber: 1}, 'der');
        assert.equal(ASNInteger.decode(one, 'der').aNumber, 1);
        var minusOne = ASNInteger.encode({aNumber: -1}, 'der'); // Fail
        assert.equal(ASNInteger.decode(minusOne, 'der').aNumber, -1);
    });

kallerosenbaum avatar Jan 11 '17 05:01 kallerosenbaum

Negative numbers are overrated.

killerstorm avatar Oct 30 '17 16:10 killerstorm