Ohm-Management - Projektarbeit B-ME
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

README.md 1.2KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. node-asn1 is a library for encoding and decoding ASN.1 datatypes in pure JS.
  2. Currently BER encoding is supported; at some point I'll likely have to do DER.
  3. ## Usage
  4. Mostly, if you're *actually* needing to read and write ASN.1, you probably don't
  5. need this readme to explain what and why. If you have no idea what ASN.1 is,
  6. see this: ftp://ftp.rsa.com/pub/pkcs/ascii/layman.asc
  7. The source is pretty much self-explanatory, and has read/write methods for the
  8. common types out there.
  9. ### Decoding
  10. The following reads an ASN.1 sequence with a boolean.
  11. var Ber = require('asn1').Ber;
  12. var reader = new Ber.Reader(new Buffer([0x30, 0x03, 0x01, 0x01, 0xff]));
  13. reader.readSequence();
  14. console.log('Sequence len: ' + reader.length);
  15. if (reader.peek() === Ber.Boolean)
  16. console.log(reader.readBoolean());
  17. ### Encoding
  18. The following generates the same payload as above.
  19. var Ber = require('asn1').Ber;
  20. var writer = new Ber.Writer();
  21. writer.startSequence();
  22. writer.writeBoolean(true);
  23. writer.endSequence();
  24. console.log(writer.buffer);
  25. ## Installation
  26. npm install asn1
  27. ## License
  28. MIT.
  29. ## Bugs
  30. See <https://github.com/mcavage/node-asn1/issues>.