node-\/asn1 is a library for encoding and decoding ASN.\+1 datatypes in pure JS. Currently BER encoding is supported; at some point I\textquotesingle{}ll likely have to do DER.\hypertarget{md_sfcode_node_modules_asn1_README_autotoc_md3227}{}\doxysubsection{Usage}\label{md_sfcode_node_modules_asn1_README_autotoc_md3227}
Mostly, if you\textquotesingle{}re {\itshape actually} needing to read and write ASN.\+1, you probably don\textquotesingle{}t need this readme to explain what and why. If you have no idea what ASN.\+1 is, see this\+: \href{ftp://ftp.rsa.com/pub/pkcs/ascii/layman.asc}{\texttt{ ftp\+://ftp.\+rsa.\+com/pub/pkcs/ascii/layman.\+asc}}

The source is pretty much self-\/explanatory, and has read/write methods for the common types out there.\hypertarget{md_sfcode_node_modules_asn1_README_autotoc_md3228}{}\doxysubsubsection{Decoding}\label{md_sfcode_node_modules_asn1_README_autotoc_md3228}
The following reads an ASN.\+1 sequence with a boolean. \begin{DoxyVerb}var Ber = require('asn1').Ber;

var reader = new Ber.Reader(Buffer.from([0x30, 0x03, 0x01, 0x01, 0xff]));

reader.readSequence();
console.log('Sequence len: ' + reader.length);
if (reader.peek() === Ber.Boolean)
  console.log(reader.readBoolean());
\end{DoxyVerb}
 \hypertarget{md_sfcode_node_modules_asn1_README_autotoc_md3229}{}\doxysubsubsection{Encoding}\label{md_sfcode_node_modules_asn1_README_autotoc_md3229}
The following generates the same payload as above. \begin{DoxyVerb}var Ber = require('asn1').Ber;

var writer = new Ber.Writer();

writer.startSequence();
writer.writeBoolean(true);
writer.endSequence();

console.log(writer.buffer);
\end{DoxyVerb}
 \hypertarget{md_sfcode_node_modules_asn1_README_autotoc_md3230}{}\doxysubsection{Installation}\label{md_sfcode_node_modules_asn1_README_autotoc_md3230}
\begin{DoxyVerb}npm install asn1
\end{DoxyVerb}
 \hypertarget{md_sfcode_node_modules_asn1_README_autotoc_md3231}{}\doxysubsection{License}\label{md_sfcode_node_modules_asn1_README_autotoc_md3231}
MIT.\hypertarget{md_sfcode_node_modules_asn1_README_autotoc_md3232}{}\doxysubsection{Bugs}\label{md_sfcode_node_modules_asn1_README_autotoc_md3232}
See \href{https://github.com/joyent/node-asn1/issues}{\texttt{ https\+://github.\+com/joyent/node-\/asn1/issues}}. 