Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to get updated ber? #31

Open
ayZagen opened this issue Apr 18, 2024 · 0 comments
Open

How to get updated ber? #31

ayZagen opened this issue Apr 18, 2024 · 0 comments

Comments

@ayZagen
Copy link

ayZagen commented Apr 18, 2024

I am trying to update a value from the decoded ber element. Here is quick snippet (npm RunKit):

const ber = new asn.BERElement();

ber.fromBytes( new Uint8Array( [ 48,12,2,1,1,96,7,2,1,3,4,0,128,0 ] ) );

ber.components[0].integer = ber.sequence[0].integer = 5;

const newBytes = ber.toBytes();

console.assert( ber.components[0].integer === 5 );
console.assert( ber.sequence[0].integer === 5 );
console.assert( newBytes[4] === 5 );

All assertions fail.

How can I update a value and get the final updated structure?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant