<?xml version="1.0" encoding="utf-8" ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <!-- This file is generated by Nim. --> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <!-- Favicon --> <link rel="shortcut icon" href="data:image/x-icon;base64,AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAUAAAAF////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAIAAABbAAAAlQAAAKIAAACbAAAAmwAAAKIAAACVAAAAWwAAAAL///8A////AP///wD///8A////AAAAABQAAADAAAAAYwAAAA3///8A////AP///wD///8AAAAADQAAAGMAAADAAAAAFP///wD///8A////AP///wAAAACdAAAAOv///wD///8A////AP///wD///8A////AP///wD///8AAAAAOgAAAJ3///8A////AP///wAAAAAnAAAAcP///wAAAAAoAAAASv///wD///8A////AP///wAAAABKAAAAKP///wAAAABwAAAAJ////wD///8AAAAAgQAAABwAAACIAAAAkAAAAJMAAACtAAAAFQAAABUAAACtAAAAkwAAAJAAAACIAAAAHAAAAIH///8A////AAAAAKQAAACrAAAAaP///wD///8AAAAARQAAANIAAADSAAAARf///wD///8AAAAAaAAAAKsAAACk////AAAAADMAAACcAAAAnQAAABj///8A////AP///wAAAAAYAAAAGP///wD///8A////AAAAABgAAACdAAAAnAAAADMAAAB1AAAAwwAAAP8AAADpAAAAsQAAAE4AAAAb////AP///wAAAAAbAAAATgAAALEAAADpAAAA/wAAAMMAAAB1AAAAtwAAAOkAAAD/AAAA/wAAAP8AAADvAAAA3gAAAN4AAADeAAAA3gAAAO8AAAD/AAAA/wAAAP8AAADpAAAAtwAAAGUAAAA/AAAA3wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAADfAAAAPwAAAGX///8A////AAAAAEgAAADtAAAAvwAAAL0AAADGAAAA7wAAAO8AAADGAAAAvQAAAL8AAADtAAAASP///wD///8A////AP///wD///8AAAAAO////wD///8A////AAAAAIcAAACH////AP///wD///8AAAAAO////wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A//8AAP//AAD4HwAA7/cAAN/7AAD//wAAoYUAAJ55AACf+QAAh+EAAAAAAADAAwAA4AcAAP5/AAD//wAA//8AAA=="/> <link rel="icon" type="image/png" sizes="32x32" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAA3XAAAN1wFCKJt4AAAAB3RJTUUH4QQQEwksSS9ZWwAAAk1JREFUWMPtll2ITVEUx39nn/O7Y5qR8f05wtCUUr6ZIS++8pEnkZInPImneaCQ5METNdOkeFBKUhMPRIkHKfEuUZSUlGlKPN2TrgfncpvmnntnmlEyq1Z7t89/rf9a6+y99oZxGZf/XeIq61EdtgKXgdXA0xrYAvBjOIF1AI9zvjcC74BSpndrJPkBWDScTF8Aa4E3wDlgHbASaANmVqlcCnwHvgDvgVfAJ+AikAAvgfVZwLnSVZHZaOuKoQi3ZOMi4NkYkpe1p4J7A8BpYAD49hfIy/oqG0+hLomiKP2L5L+1ubn5115S+3OAn4EnwBlgMzCjyt6ZAnQCJ4A7wOs88iRJHvw50HoujuPBoCKwHWiosy8MdfZnAdcHk8dxXFJ3VQbQlCTJvRBCGdRbD4M6uc5glpY3eAihpN5S5w12diSEcCCEcKUO4ljdr15T76ur1FDDLIQQ3qv71EdDOe3Kxj3leRXyk+pxdWnFWod6Wt2bY3de3aSuUHcPBVimHs7mK9WrmeOF6lR1o9qnzskh2ar2qm1qizpfXaPeVGdlmGN5pb09qMxz1Xb1kLqgzn1RyH7JUXW52lr5e/Kqi9qpto7V1atuUzfnARrV7jEib1T76gG2qxdGmXyiekkt1GswPTtek0aBfJp6YySGBfWg2tPQ0FAYgf1stUfdmdcjarbYJEniKIq6gY/Aw+zWHAC+p2labGpqiorFYgGYCEzN7oQdQClN07O1/EfDyGgC0ALMBdYAi4FyK+4H3gLPsxfR1zRNi+NP7nH5J+QntnXe5B5mpfQAAAAASUVORK5CYII="> <!-- Google fonts --> <link href='https://fonts.googleapis.com/css?family=Lato:400,600,900' rel='stylesheet' type='text/css'/> <link href='https://fonts.googleapis.com/css?family=Source+Code+Pro:400,500,600' rel='stylesheet' type='text/css'/> <!-- CSS --> <title>libp2p/crypto/minasn1</title> <link rel="stylesheet" type="text/css" href="../../nimdoc.out.css"> <script type="text/javascript" src="../../dochack.js"></script> <script type="text/javascript"> function main() { var pragmaDots = document.getElementsByClassName("pragmadots"); for (var i = 0; i < pragmaDots.length; i++) { pragmaDots[i].onclick = function(event) { // Hide tease event.target.parentNode.style.display = "none"; // Show actual event.target.parentNode.nextElementSibling.style.display = "inline"; } } function switchTheme(e) { if (e.target.checked) { document.documentElement.setAttribute('data-theme', 'dark'); localStorage.setItem('theme', 'dark'); } else { document.documentElement.setAttribute('data-theme', 'light'); localStorage.setItem('theme', 'light'); } } const toggleSwitch = document.querySelector('.theme-switch input[type="checkbox"]'); if (toggleSwitch !== null) { toggleSwitch.addEventListener('change', switchTheme, false); } var currentTheme = localStorage.getItem('theme'); if (!currentTheme && window.matchMedia('(prefers-color-scheme: dark)').matches) { currentTheme = 'dark'; } if (currentTheme) { document.documentElement.setAttribute('data-theme', currentTheme); if (currentTheme === 'dark' && toggleSwitch !== null) { toggleSwitch.checked = true; } } } window.addEventListener('DOMContentLoaded', main); </script> </head> <body> <div class="document" id="documentId"> <div class="container"> <h1 class="title">libp2p/crypto/minasn1</h1> <div class="row"> <div class="three columns"> <div class="theme-switch-wrapper"> <label class="theme-switch" for="checkbox"> <input type="checkbox" id="checkbox" /> <div class="slider round"></div> </label> <em>Dark Mode</em> </div> <div id="global-links"> <ul class="simple"> <li> <a href="../../theindex.html">Index</a> </li> </ul> </div> <div id="searchInputDiv"> Search: <input type="text" id="searchInput" onkeyup="search()" /> </div> <div> Group by: <select onchange="groupBy(this.value)"> <option value="section">Section</option> <option value="type">Type</option> </select> </div> <script type="text/javascript"> function main2() { // Create the slider var firstSlider = document.getElementsByClassName("theme-switch-wrapper")[0]; var newSlider = document.createRange().createContextualFragment(` <div class="theme-switch-wrapper"> <label class="theme-switch" for="internalcheckbox"> <input type="checkbox" id="internalcheckbox"> <div class="slider round"></div> </label> <em>Internal</em> </div> `); var sliderInst = firstSlider.after(newSlider); // Restore slider state from storage var currentMode = localStorage.getItem('privateMode'); if (currentMode == "private") { document.getElementById("internalcheckbox").checked = true; } else { hidePrivateProcs(); } document.getElementById("internalcheckbox").onclick = togglePrivateProcs; } function hidePrivateProcs() { var toHide = document.getElementsByClassName("tohide"); for (var i = 0; i < toHide.length; i++) { var pragmas = toHide[i].querySelectorAll("span.Identifier"); var public = false; for (var z = 0; z < pragmas.length; z++) { if (pragmas[z].innerText == "public") { public = true; break; } } if (public == false) { toHide[i].style.display = "none"; toHide[i].classList.add("hidden"); links = document.querySelectorAll("a[href='#" + encodeURIComponent(toHide[i].id) + "']"); for (var y = 0; y < links.length; y++) { links[y].parentNode.style.display = "none"; links[y].parentNode.classList.add("hidden"); } } } // TOC var nestedSections = document.getElementsByClassName("nested-toc-section"); for (var i = 0; i < nestedSections.length; i++) { if (nestedSections[i].querySelectorAll("li:not(.hidden)").length == 0) { nestedSections[i].style.display = "none"; nestedSections[i].classList.add("hidden"); } } var sections = document.getElementsByClassName("simple-toc-section"); for (var i = 0; i < sections.length; i++) { if (sections[i].querySelectorAll(".nested-toc-section:not(.hidden)").length == 0) { sections[i].parentNode.style.display = "none"; sections[i].parentNode.classList.add("hidden"); } } // Sections var sections = document.getElementsByClassName("section"); for (var i = 0; i < sections.length; i++) { if (sections[i].querySelectorAll(".item > div").length == 0) continue; if (sections[i].querySelectorAll(".item > div:not(.hidden)").length == 0) { sections[i].style.display = "none"; sections[i].classList.add("hidden"); } } } function showPrivateProcs() { var toHide = Array.from(document.getElementsByClassName("hidden")); for (var i = 0; i < toHide.length; i++) { toHide[i].style.display = ""; toHide[i].classList.remove("hidden"); } } function togglePrivateProcs() { if (document.getElementById("internalcheckbox").checked) { localStorage.setItem('privateMode', 'private'); showPrivateProcs(); } else { localStorage.setItem('privateMode', 'public'); hidePrivateProcs(); } } window.addEventListener("DOMContentLoaded", main2); </script> <ul class="simple simple-toc" id="toc-list"> <li> <a class="reference reference-toplevel" href="#6" id="56">Imports</a> <ul class="simple simple-toc-section"> </ul> </li> <li> <a class="reference reference-toplevel" href="#7" id="57">Types</a> <ul class="simple simple-toc-section"> <li><a class="reference" href="#Asn1Buffer" title="Asn1Buffer = object of RootObj buffer*: seq[byte] offset*: int length*: int">Asn1Buffer</a></li> <li><a class="reference" href="#Asn1Class" title="Asn1Class {.pure.} = enum Universal = 0, Application = 1, ContextSpecific = 2, Private = 3">Asn1Class</a></li> <li><a class="reference" href="#Asn1Composite" title="Asn1Composite = object of Asn1Buffer tag*: Asn1Tag idx*: int">Asn1Composite</a></li> <li><a class="reference" href="#Asn1Error" title="Asn1Error {.pure.} = enum Overflow, Incomplete, Indefinite, Incorrect, NoSupport, Overrun">Asn1Error</a></li> <li><a class="reference" href="#Asn1Field" title="Asn1Field = object klass*: Asn1Class index*: int offset*: int length*: int buffer*: seq[byte] case kind*: Asn1Tag of Asn1Tag.Boolean: vbool*: bool of Asn1Tag.Integer: vint*: uint64 of Asn1Tag.BitString: ubits*: int else: nil">Asn1Field</a></li> <li><a class="reference" href="#Asn1Result" title="Asn1Result[T] = Result[T, Asn1Error]">Asn1Result</a></li> <li><a class="reference" href="#Asn1Tag" title="Asn1Tag {.pure.} = enum NoSupport, Boolean, Integer, BitString, OctetString, Null, Oid, Sequence, Context">Asn1Tag</a></li> </ul> </li> <li> <a class="reference reference-toplevel" href="#10" id="60">Consts</a> <ul class="simple simple-toc-section"> <li><a class="reference" href="#Asn1False" title="Asn1False = [0x01'u8, 0x01'u8, 0x00'u8]">Asn1False</a></li> <li><a class="reference" href="#Asn1Null" title="Asn1Null = [0x05'u8, 0x00'u8]">Asn1Null</a></li> <li><a class="reference" href="#Asn1OidEcPublicKey" title="Asn1OidEcPublicKey = [0x2A'u8, 0x86'u8, 0x48'u8, 0xCE'u8, 0x3D'u8, 0x02'u8, 0x01'u8]">Asn1OidEcPublicKey</a></li> <li><a class="reference" href="#Asn1OidRsaEncryption" title="Asn1OidRsaEncryption = [0x2A'u8, 0x86'u8, 0x48'u8, 0x86'u8, 0xF7'u8, 0x0D'u8, 0x01'u8, 0x01'u8, 0x01'u8]">Asn1OidRsaEncryption</a></li> <li><a class="reference" href="#Asn1OidSecp256k1" title="Asn1OidSecp256k1 = [0x2B'u8, 0x81'u8, 0x04'u8, 0x00'u8, 0x0A'u8]">Asn1OidSecp256k1</a></li> <li><a class="reference" href="#Asn1OidSecp256r1" title="Asn1OidSecp256r1 = [0x2A'u8, 0x86'u8, 0x48'u8, 0xCE'u8, 0x3D'u8, 0x03'u8, 0x01'u8, 0x07'u8]">Asn1OidSecp256r1</a></li> <li><a class="reference" href="#Asn1OidSecp384r1" title="Asn1OidSecp384r1 = [0x2B'u8, 0x81'u8, 0x04'u8, 0x00'u8, 0x22'u8]">Asn1OidSecp384r1</a></li> <li><a class="reference" href="#Asn1OidSecp521r1" title="Asn1OidSecp521r1 = [0x2B'u8, 0x81'u8, 0x04'u8, 0x00'u8, 0x23'u8]">Asn1OidSecp521r1</a></li> <li><a class="reference" href="#Asn1True" title="Asn1True = [0x01'u8, 0x01'u8, 0xFF'u8]">Asn1True</a></li> </ul> </li> <li> <a class="reference reference-toplevel" href="#12" id="62">Procs</a> <ul class="simple simple-toc-section"> <ul class="simple nested-toc-section">$ <li><a class="reference" href="#%24%2CAsn1Buffer" title="`$`(buffer: Asn1Buffer): string">`$`(buffer: Asn1Buffer): string</a></li> <li><a class="reference" href="#%24%2CAsn1Field" title="`$`(field: Asn1Field): string">`$`(field: Asn1Field): string</a></li> </ul> <ul class="simple nested-toc-section">== <li><a class="reference" href="#%3D%3D%2CAsn1Field%2CopenArray%5Bbyte%5D" title="`==`(field: Asn1Field; data: openArray[byte]): bool">`==`(field: Asn1Field; data: openArray[byte]): bool</a></li> </ul> <ul class="simple nested-toc-section">asn1EncodeBitString <li><a class="reference" href="#asn1EncodeBitString%2CopenArray%5Bbyte%5D%2CopenArray%5Bbyte%5D%2Cint" title="asn1EncodeBitString(dest: var openArray[byte]; value: openArray[byte]; bits = 0): int">asn1EncodeBitString(dest: var openArray[byte]; value: openArray[byte]; bits = 0): int</a></li> </ul> <ul class="simple nested-toc-section">asn1EncodeBoolean <li><a class="reference" href="#asn1EncodeBoolean%2CopenArray%5Bbyte%5D%2Cbool" title="asn1EncodeBoolean(dest: var openArray[byte]; value: bool): int">asn1EncodeBoolean(dest: var openArray[byte]; value: bool): int</a></li> </ul> <ul class="simple nested-toc-section">asn1EncodeComposite <li><a class="reference" href="#asn1EncodeComposite%2CopenArray%5Bbyte%5D%2CAsn1Composite" title="asn1EncodeComposite(dest: var openArray[byte]; value: Asn1Composite): int">asn1EncodeComposite(dest: var openArray[byte]; value: Asn1Composite): int</a></li> </ul> <ul class="simple nested-toc-section">asn1EncodeContextTag <li><a class="reference" href="#asn1EncodeContextTag%2CopenArray%5Bbyte%5D%2CopenArray%5Bbyte%5D%2Cint" title="asn1EncodeContextTag(dest: var openArray[byte]; value: openArray[byte]; tag: int): int">asn1EncodeContextTag(dest: var openArray[byte]; value: openArray[byte]; tag: int): int</a></li> </ul> <ul class="simple nested-toc-section">asn1EncodeInteger <li><a class="reference" href="#asn1EncodeInteger%2CopenArray%5Bbyte%5D%2CopenArray%5Bbyte%5D" title="asn1EncodeInteger(dest: var openArray[byte]; value: openArray[byte]): int">asn1EncodeInteger(dest: var openArray[byte]; value: openArray[byte]): int</a></li> <li><a class="reference" href="#asn1EncodeInteger%2CopenArray%5Bbyte%5D%2CT" title="asn1EncodeInteger[T: SomeUnsignedInt](dest: var openArray[byte]; value: T): int">asn1EncodeInteger[T: SomeUnsignedInt](dest: var openArray[byte]; value: T): int</a></li> </ul> <ul class="simple nested-toc-section">asn1EncodeLength <li><a class="reference" href="#asn1EncodeLength%2CopenArray%5Bbyte%5D%2Cuint64" title="asn1EncodeLength(dest: var openArray[byte]; length: uint64): int">asn1EncodeLength(dest: var openArray[byte]; length: uint64): int</a></li> </ul> <ul class="simple nested-toc-section">asn1EncodeNull <li><a class="reference" href="#asn1EncodeNull%2CopenArray%5Bbyte%5D" title="asn1EncodeNull(dest: var openArray[byte]): int">asn1EncodeNull(dest: var openArray[byte]): int</a></li> </ul> <ul class="simple nested-toc-section">asn1EncodeOctetString <li><a class="reference" href="#asn1EncodeOctetString%2CopenArray%5Bbyte%5D%2CopenArray%5Bbyte%5D" title="asn1EncodeOctetString(dest: var openArray[byte]; value: openArray[byte]): int">asn1EncodeOctetString(dest: var openArray[byte]; value: openArray[byte]): int</a></li> </ul> <ul class="simple nested-toc-section">asn1EncodeOid <li><a class="reference" href="#asn1EncodeOid%2CopenArray%5Bbyte%5D%2CopenArray%5Bbyte%5D" title="asn1EncodeOid(dest: var openArray[byte]; value: openArray[byte]): int">asn1EncodeOid(dest: var openArray[byte]; value: openArray[byte]): int</a></li> </ul> <ul class="simple nested-toc-section">asn1EncodeSequence <li><a class="reference" href="#asn1EncodeSequence%2CopenArray%5Bbyte%5D%2CopenArray%5Bbyte%5D" title="asn1EncodeSequence(dest: var openArray[byte]; value: openArray[byte]): int">asn1EncodeSequence(dest: var openArray[byte]; value: openArray[byte]): int</a></li> </ul> <ul class="simple nested-toc-section">code <li><a class="reference" href="#code%2CAsn1Tag" title="code(tag: Asn1Tag): byte">code(tag: Asn1Tag): byte</a></li> </ul> <ul class="simple nested-toc-section">extend <li><a class="reference" href="#extend%2CT%2Cint" title="extend[T: Asn1Buffer | Asn1Composite](abc: var T; length: int)">extend[T: Asn1Buffer | Asn1Composite](abc: var T; length: int)</a></li> </ul> <ul class="simple nested-toc-section">finish <li><a class="reference" href="#finish%2CT" title="finish[T: Asn1Buffer | Asn1Composite](abc: var T)">finish[T: Asn1Buffer | Asn1Composite](abc: var T)</a></li> </ul> <ul class="simple nested-toc-section">getBuffer <li><a class="reference" href="#getBuffer%2CAsn1Field" title="getBuffer(field: Asn1Field): Asn1Buffer">getBuffer(field: Asn1Field): Asn1Buffer</a></li> </ul> <ul class="simple nested-toc-section">init <li><a class="reference" href="#init%2Ctypedesc%5BAsn1Buffer%5D" title="init(t: typedesc[Asn1Buffer]): Asn1Buffer">init(t: typedesc[Asn1Buffer]): Asn1Buffer</a></li> <li><a class="reference" href="#init%2Ctypedesc%5BAsn1Buffer%5D%2CopenArray%5Bbyte%5D" title="init(t: typedesc[Asn1Buffer]; data: openArray[byte]): Asn1Buffer">init(t: typedesc[Asn1Buffer]; data: openArray[byte]): Asn1Buffer</a></li> <li><a class="reference" href="#init%2Ctypedesc%5BAsn1Buffer%5D%2Cstring" title="init(t: typedesc[Asn1Buffer]; data: string): Asn1Buffer">init(t: typedesc[Asn1Buffer]; data: string): Asn1Buffer</a></li> <li><a class="reference" href="#init%2Ctypedesc%5BAsn1Composite%5D%2Cint" title="init(t: typedesc[Asn1Composite]; idx: int): Asn1Composite">init(t: typedesc[Asn1Composite]; idx: int): Asn1Composite</a></li> <li><a class="reference" href="#init%2Ctypedesc%5BAsn1Composite%5D%2CAsn1Tag" title="init(t: typedesc[Asn1Composite]; tag: Asn1Tag): Asn1Composite">init(t: typedesc[Asn1Composite]; tag: Asn1Tag): Asn1Composite</a></li> </ul> <ul class="simple nested-toc-section">len <li><a class="reference" href="#len%2CAsn1Field" title="len(field: Asn1Field): int">len(field: Asn1Field): int</a></li> <li><a class="reference" href="#len%2CT" title="len[T: Asn1Buffer | Asn1Composite](abc: T): int">len[T: Asn1Buffer | Asn1Composite](abc: T): int</a></li> </ul> <ul class="simple nested-toc-section">read <li><a class="reference" href="#read%2CAsn1Buffer" title="read(ab: var Asn1Buffer): Asn1Result[Asn1Field]">read(ab: var Asn1Buffer): Asn1Result[Asn1Field]</a></li> </ul> <ul class="simple nested-toc-section">write <li><a class="reference" href="#write%2CT%2CAsn1Tag" title="write[T: Asn1Buffer | Asn1Composite](abc: var T; tag: Asn1Tag)">write[T: Asn1Buffer | Asn1Composite](abc: var T; tag: Asn1Tag)</a></li> <li><a class="reference" href="#write%2CT%2CAsn1Tag%2CopenArray%5Bbyte%5D%2Cint" title="write[T: Asn1Buffer | Asn1Composite](abc: var T; tag: Asn1Tag; value: openArray[byte]; bits = 0)">write[T: Asn1Buffer | Asn1Composite](abc: var T; tag: Asn1Tag; value: openArray[byte]; bits = 0)</a></li> <li><a class="reference" href="#write%2CT%2CAsn1Composite" title="write[T: Asn1Buffer | Asn1Composite](abc: var T; value: Asn1Composite)">write[T: Asn1Buffer | Asn1Composite](abc: var T; value: Asn1Composite)</a></li> <li><a class="reference" href="#write%2CT%2Cbool" title="write[T: Asn1Buffer | Asn1Composite](abc: var T; value: bool)">write[T: Asn1Buffer | Asn1Composite](abc: var T; value: bool)</a></li> <li><a class="reference" href="#write%2CT%2Cuint64" title="write[T: Asn1Buffer | Asn1Composite](abc: var T; value: uint64)">write[T: Asn1Buffer | Asn1Composite](abc: var T; value: uint64)</a></li> </ul> </ul> </li> <li> <a class="reference reference-toplevel" href="#18" id="68">Templates</a> <ul class="simple simple-toc-section"> <ul class="simple nested-toc-section">getPtr <li><a class="reference" href="#getPtr.t%2Cuntyped" title="getPtr(field: untyped): pointer">getPtr(field: untyped): pointer</a></li> </ul> <ul class="simple nested-toc-section">isEmpty <li><a class="reference" href="#isEmpty.t%2CAsn1Buffer" title="isEmpty(ab: Asn1Buffer): bool">isEmpty(ab: Asn1Buffer): bool</a></li> </ul> <ul class="simple nested-toc-section">isEnough <li><a class="reference" href="#isEnough.t%2CAsn1Buffer%2Cint64" title="isEnough(ab: Asn1Buffer; length: int64): bool">isEnough(ab: Asn1Buffer; length: int64): bool</a></li> </ul> <ul class="simple nested-toc-section">toOpenArray <li><a class="reference" href="#toOpenArray.t%2CAsn1Buffer" title="toOpenArray(ab: Asn1Buffer): untyped">toOpenArray(ab: Asn1Buffer): untyped</a></li> <li><a class="reference" href="#toOpenArray.t%2CAsn1Composite" title="toOpenArray(ac: Asn1Composite): untyped">toOpenArray(ac: Asn1Composite): untyped</a></li> <li><a class="reference" href="#toOpenArray.t%2CAsn1Field" title="toOpenArray(af: Asn1Field): untyped">toOpenArray(af: Asn1Field): untyped</a></li> </ul> </ul> </li> </ul> </div> <a href="https://github.com/status-im/nim-libp2p/tree/fix-doc-workflow/libp2p/crypto/minasn1.nim#L1" class="link-seesrc" target="_blank">Source</a> <a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/minasn1.nim#L1" class="link-seesrc" target="_blank" >Edit</a> <div class="nine columns" id="content"> <div id="tocRoot"></div> <p class="module-desc">This module implements minimal ASN.1 encoding/decoding primitives.</p> <div class="section" id="6"> <h1><a class="toc-backref" href="#6">Imports</a></h1> <dl class="item"> <a class="reference external" href="../utility.html">../utility</a> </dl></div> <div class="section" id="7"> <h1><a class="toc-backref" href="#7">Types</a></h1> <dl class="item"> <div id="Asn1Buffer" class="tohide"> <dt><pre><a href="minasn1.html#Asn1Buffer"><span class="Identifier">Asn1Buffer</span></a> <span class="Other">=</span> <span class="Keyword">object</span> <span class="Keyword">of</span> <span class="Identifier">RootObj</span> <span class="Identifier">buffer</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">seq</span><span class="Other">[</span><span class="Identifier">byte</span><span class="Other">]</span> <span class="Identifier">offset</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">int</span> <span class="Identifier">length</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">int</span> </pre></dt> <dd> ASN.1's message representation object <a href="https://github.com/status-im/nim-libp2p/tree/fix-doc-workflow/libp2p/crypto/minasn1.nim#L49" class="link-seesrc" target="_blank">Source</a> <a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/minasn1.nim#L49" class="link-seesrc" target="_blank" >Edit</a> </dd> </div> <div id="Asn1Class" class="tohide"> <dt><pre><a href="minasn1.html#Asn1Class"><span class="Identifier">Asn1Class</span></a> {.<span class="Identifier">pure</span>.} <span class="Other">=</span> <span class="Keyword">enum</span> <span class="Identifier">Universal</span> <span class="Other">=</span> <span class="DecNumber">0</span><span class="Other">,</span> <span class="Identifier">Application</span> <span class="Other">=</span> <span class="DecNumber">1</span><span class="Other">,</span> <span class="Identifier">ContextSpecific</span> <span class="Other">=</span> <span class="DecNumber">2</span><span class="Other">,</span> <span class="Identifier">Private</span> <span class="Other">=</span> <span class="DecNumber">3</span></pre></dt> <dd> <a href="https://github.com/status-im/nim-libp2p/tree/fix-doc-workflow/libp2p/crypto/minasn1.nim#L31" class="link-seesrc" target="_blank">Source</a> <a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/minasn1.nim#L31" class="link-seesrc" target="_blank" >Edit</a> </dd> </div> <div id="Asn1Composite" class="tohide"> <dt><pre><a href="minasn1.html#Asn1Composite"><span class="Identifier">Asn1Composite</span></a> <span class="Other">=</span> <span class="Keyword">object</span> <span class="Keyword">of</span> <a href="minasn1.html#Asn1Buffer"><span class="Identifier">Asn1Buffer</span></a> <span class="Identifier">tag</span><span class="Operator">*</span><span class="Other">:</span> <a href="minasn1.html#Asn1Tag"><span class="Identifier">Asn1Tag</span></a> <span class="Identifier">idx</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">int</span> </pre></dt> <dd> <a href="https://github.com/status-im/nim-libp2p/tree/fix-doc-workflow/libp2p/crypto/minasn1.nim#L71" class="link-seesrc" target="_blank">Source</a> <a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/minasn1.nim#L71" class="link-seesrc" target="_blank" >Edit</a> </dd> </div> <div id="Asn1Error" class="tohide"> <dt><pre><a href="minasn1.html#Asn1Error"><span class="Identifier">Asn1Error</span></a> {.<span class="Identifier">pure</span>.} <span class="Other">=</span> <span class="Keyword">enum</span> <span class="Identifier">Overflow</span><span class="Other">,</span> <span class="Identifier">Incomplete</span><span class="Other">,</span> <span class="Identifier">Indefinite</span><span class="Other">,</span> <span class="Identifier">Incorrect</span><span class="Other">,</span> <span class="Identifier">NoSupport</span><span class="Other">,</span> <span class="Identifier">Overrun</span></pre></dt> <dd> <a href="https://github.com/status-im/nim-libp2p/tree/fix-doc-workflow/libp2p/crypto/minasn1.nim#L21" class="link-seesrc" target="_blank">Source</a> <a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/minasn1.nim#L21" class="link-seesrc" target="_blank" >Edit</a> </dd> </div> <div id="Asn1Field" class="tohide"> <dt><pre><a href="minasn1.html#Asn1Field"><span class="Identifier">Asn1Field</span></a> <span class="Other">=</span> <span class="Keyword">object</span> <span class="Identifier">klass</span><span class="Operator">*</span><span class="Other">:</span> <a href="minasn1.html#Asn1Class"><span class="Identifier">Asn1Class</span></a> <span class="Identifier">index</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">int</span> <span class="Identifier">offset</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">int</span> <span class="Identifier">length</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">int</span> <span class="Identifier">buffer</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">seq</span><span class="Other">[</span><span class="Identifier">byte</span><span class="Other">]</span> <span class="Keyword">case</span> <span class="Identifier">kind</span><span class="Operator">*</span><span class="Other">:</span> <a href="minasn1.html#Asn1Tag"><span class="Identifier">Asn1Tag</span></a> <span class="Keyword">of</span> <span class="Identifier">Asn1Tag</span><span class="Other">.</span><span class="Identifier">Boolean</span><span class="Other">:</span> <span class="Identifier">vbool</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">bool</span> <span class="Keyword">of</span> <span class="Identifier">Asn1Tag</span><span class="Other">.</span><span class="Identifier">Integer</span><span class="Other">:</span> <span class="Identifier">vint</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">uint64</span> <span class="Keyword">of</span> <span class="Identifier">Asn1Tag</span><span class="Other">.</span><span class="Identifier">BitString</span><span class="Other">:</span> <span class="Identifier">ubits</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">int</span> <span class="Keyword">else</span><span class="Other">:</span> <span class="Keyword">nil</span> </pre></dt> <dd> <a href="https://github.com/status-im/nim-libp2p/tree/fix-doc-workflow/libp2p/crypto/minasn1.nim#L55" class="link-seesrc" target="_blank">Source</a> <a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/minasn1.nim#L55" class="link-seesrc" target="_blank" >Edit</a> </dd> </div> <div id="Asn1Result" class="tohide"> <dt><pre><a href="minasn1.html#Asn1Result"><span class="Identifier">Asn1Result</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span> <span class="Other">=</span> <span class="Identifier">Result</span><span class="Other">[</span><span class="Identifier">T</span><span class="Other">,</span> <a href="minasn1.html#Asn1Error"><span class="Identifier">Asn1Error</span></a><span class="Other">]</span></pre></dt> <dd> <a href="https://github.com/status-im/nim-libp2p/tree/fix-doc-workflow/libp2p/crypto/minasn1.nim#L29" class="link-seesrc" target="_blank">Source</a> <a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/minasn1.nim#L29" class="link-seesrc" target="_blank" >Edit</a> </dd> </div> <div id="Asn1Tag" class="tohide"> <dt><pre><a href="minasn1.html#Asn1Tag"><span class="Identifier">Asn1Tag</span></a> {.<span class="Identifier">pure</span>.} <span class="Other">=</span> <span class="Keyword">enum</span> <span class="Identifier">NoSupport</span><span class="Other">,</span> <span class="Identifier">Boolean</span><span class="Other">,</span> <span class="Identifier">Integer</span><span class="Other">,</span> <span class="Identifier">BitString</span><span class="Other">,</span> <span class="Identifier">OctetString</span><span class="Other">,</span> <span class="Identifier">Null</span><span class="Other">,</span> <span class="Identifier">Oid</span><span class="Other">,</span> <span class="Identifier">Sequence</span><span class="Other">,</span> <span class="Identifier">Context</span></pre></dt> <dd> Protobuf's field types enum <a href="https://github.com/status-im/nim-libp2p/tree/fix-doc-workflow/libp2p/crypto/minasn1.nim#L37" class="link-seesrc" target="_blank">Source</a> <a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/minasn1.nim#L37" class="link-seesrc" target="_blank" >Edit</a> </dd> </div> </dl></div> <div class="section" id="10"> <h1><a class="toc-backref" href="#10">Consts</a></h1> <dl class="item"> <div id="Asn1False" class="tohide"> <dt><pre><a href="minasn1.html#Asn1False"><span class="Identifier">Asn1False</span></a> <span class="Other">=</span> <span class="Other">[</span><span class="DecNumber">0x01'u8</span><span class="Other">,</span> <span class="DecNumber">0x01'u8</span><span class="Other">,</span> <span class="DecNumber">0x00'u8</span><span class="Other">]</span></pre></dt> <dd> Encoded boolean <tt class="docutils literal"><span class="pre">FALSE</span></tt>. <a href="https://github.com/status-im/nim-libp2p/tree/fix-doc-workflow/libp2p/crypto/minasn1.nim#L103" class="link-seesrc" target="_blank">Source</a> <a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/minasn1.nim#L103" class="link-seesrc" target="_blank" >Edit</a> </dd> </div> <div id="Asn1Null" class="tohide"> <dt><pre><a href="minasn1.html#Asn1Null"><span class="Identifier">Asn1Null</span></a> <span class="Other">=</span> <span class="Other">[</span><span class="DecNumber">0x05'u8</span><span class="Other">,</span> <span class="DecNumber">0x00'u8</span><span class="Other">]</span></pre></dt> <dd> Encoded <tt class="docutils literal"><span class="pre">NULL</span></tt> value. <a href="https://github.com/status-im/nim-libp2p/tree/fix-doc-workflow/libp2p/crypto/minasn1.nim#L105" class="link-seesrc" target="_blank">Source</a> <a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/minasn1.nim#L105" class="link-seesrc" target="_blank" >Edit</a> </dd> </div> <div id="Asn1OidEcPublicKey" class="tohide"> <dt><pre><a href="minasn1.html#Asn1OidEcPublicKey"><span class="Identifier">Asn1OidEcPublicKey</span></a> <span class="Other">=</span> <span class="Other">[</span><span class="DecNumber">0x2A'u8</span><span class="Other">,</span> <span class="DecNumber">0x86'u8</span><span class="Other">,</span> <span class="DecNumber">0x48'u8</span><span class="Other">,</span> <span class="DecNumber">0xCE'u8</span><span class="Other">,</span> <span class="DecNumber">0x3D'u8</span><span class="Other">,</span> <span class="DecNumber">0x02'u8</span><span class="Other">,</span> <span class="DecNumber">0x01'u8</span><span class="Other">]</span></pre></dt> <dd> Encoded OID for Elliptic Curve Public Key (1.2.840.10045.2.1) <a href="https://github.com/status-im/nim-libp2p/tree/fix-doc-workflow/libp2p/crypto/minasn1.nim#L92" class="link-seesrc" target="_blank">Source</a> <a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/minasn1.nim#L92" class="link-seesrc" target="_blank" >Edit</a> </dd> </div> <div id="Asn1OidRsaEncryption" class="tohide"> <dt><pre><a href="minasn1.html#Asn1OidRsaEncryption"><span class="Identifier">Asn1OidRsaEncryption</span></a> <span class="Other">=</span> <span class="Other">[</span><span class="DecNumber">0x2A'u8</span><span class="Other">,</span> <span class="DecNumber">0x86'u8</span><span class="Other">,</span> <span class="DecNumber">0x48'u8</span><span class="Other">,</span> <span class="DecNumber">0x86'u8</span><span class="Other">,</span> <span class="DecNumber">0xF7'u8</span><span class="Other">,</span> <span class="DecNumber">0x0D'u8</span><span class="Other">,</span> <span class="DecNumber">0x01'u8</span><span class="Other">,</span> <span class="DecNumber">0x01'u8</span><span class="Other">,</span> <span class="DecNumber">0x01'u8</span><span class="Other">]</span></pre></dt> <dd> Encoded OID for RSA Encryption (1.2.840.113549.1.1.1) <a href="https://github.com/status-im/nim-libp2p/tree/fix-doc-workflow/libp2p/crypto/minasn1.nim#L96" class="link-seesrc" target="_blank">Source</a> <a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/minasn1.nim#L96" class="link-seesrc" target="_blank" >Edit</a> </dd> </div> <div id="Asn1OidSecp256k1" class="tohide"> <dt><pre><a href="minasn1.html#Asn1OidSecp256k1"><span class="Identifier">Asn1OidSecp256k1</span></a> <span class="Other">=</span> <span class="Other">[</span><span class="DecNumber">0x2B'u8</span><span class="Other">,</span> <span class="DecNumber">0x81'u8</span><span class="Other">,</span> <span class="DecNumber">0x04'u8</span><span class="Other">,</span> <span class="DecNumber">0x00'u8</span><span class="Other">,</span> <span class="DecNumber">0x0A'u8</span><span class="Other">]</span></pre></dt> <dd> Encoded OID for <tt class="docutils literal"><span class="pre"><span class="Identifier">secp256k1</span></span></tt> curve (1.3.132.0.10) <a href="https://github.com/status-im/nim-libp2p/tree/fix-doc-workflow/libp2p/crypto/minasn1.nim#L88" class="link-seesrc" target="_blank">Source</a> <a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/minasn1.nim#L88" class="link-seesrc" target="_blank" >Edit</a> </dd> </div> <div id="Asn1OidSecp256r1" class="tohide"> <dt><pre><a href="minasn1.html#Asn1OidSecp256r1"><span class="Identifier">Asn1OidSecp256r1</span></a> <span class="Other">=</span> <span class="Other">[</span><span class="DecNumber">0x2A'u8</span><span class="Other">,</span> <span class="DecNumber">0x86'u8</span><span class="Other">,</span> <span class="DecNumber">0x48'u8</span><span class="Other">,</span> <span class="DecNumber">0xCE'u8</span><span class="Other">,</span> <span class="DecNumber">0x3D'u8</span><span class="Other">,</span> <span class="DecNumber">0x03'u8</span><span class="Other">,</span> <span class="DecNumber">0x01'u8</span><span class="Other">,</span> <span class="DecNumber">0x07'u8</span><span class="Other">]</span></pre></dt> <dd> Encoded OID for <tt class="docutils literal"><span class="pre"><span class="Identifier">secp256r1</span></span></tt> curve (1.2.840.10045.3.1.7) <a href="https://github.com/status-im/nim-libp2p/tree/fix-doc-workflow/libp2p/crypto/minasn1.nim#L76" class="link-seesrc" target="_blank">Source</a> <a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/minasn1.nim#L76" class="link-seesrc" target="_blank" >Edit</a> </dd> </div> <div id="Asn1OidSecp384r1" class="tohide"> <dt><pre><a href="minasn1.html#Asn1OidSecp384r1"><span class="Identifier">Asn1OidSecp384r1</span></a> <span class="Other">=</span> <span class="Other">[</span><span class="DecNumber">0x2B'u8</span><span class="Other">,</span> <span class="DecNumber">0x81'u8</span><span class="Other">,</span> <span class="DecNumber">0x04'u8</span><span class="Other">,</span> <span class="DecNumber">0x00'u8</span><span class="Other">,</span> <span class="DecNumber">0x22'u8</span><span class="Other">]</span></pre></dt> <dd> Encoded OID for <tt class="docutils literal"><span class="pre"><span class="Identifier">secp384r1</span></span></tt> curve (1.3.132.0.34) <a href="https://github.com/status-im/nim-libp2p/tree/fix-doc-workflow/libp2p/crypto/minasn1.nim#L80" class="link-seesrc" target="_blank">Source</a> <a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/minasn1.nim#L80" class="link-seesrc" target="_blank" >Edit</a> </dd> </div> <div id="Asn1OidSecp521r1" class="tohide"> <dt><pre><a href="minasn1.html#Asn1OidSecp521r1"><span class="Identifier">Asn1OidSecp521r1</span></a> <span class="Other">=</span> <span class="Other">[</span><span class="DecNumber">0x2B'u8</span><span class="Other">,</span> <span class="DecNumber">0x81'u8</span><span class="Other">,</span> <span class="DecNumber">0x04'u8</span><span class="Other">,</span> <span class="DecNumber">0x00'u8</span><span class="Other">,</span> <span class="DecNumber">0x23'u8</span><span class="Other">]</span></pre></dt> <dd> Encoded OID for <tt class="docutils literal"><span class="pre"><span class="Identifier">secp521r1</span></span></tt> curve (1.3.132.0.35) <a href="https://github.com/status-im/nim-libp2p/tree/fix-doc-workflow/libp2p/crypto/minasn1.nim#L84" class="link-seesrc" target="_blank">Source</a> <a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/minasn1.nim#L84" class="link-seesrc" target="_blank" >Edit</a> </dd> </div> <div id="Asn1True" class="tohide"> <dt><pre><a href="minasn1.html#Asn1True"><span class="Identifier">Asn1True</span></a> <span class="Other">=</span> <span class="Other">[</span><span class="DecNumber">0x01'u8</span><span class="Other">,</span> <span class="DecNumber">0x01'u8</span><span class="Other">,</span> <span class="DecNumber">0xFF'u8</span><span class="Other">]</span></pre></dt> <dd> Encoded boolean <tt class="docutils literal"><span class="pre">TRUE</span></tt>. <a href="https://github.com/status-im/nim-libp2p/tree/fix-doc-workflow/libp2p/crypto/minasn1.nim#L101" class="link-seesrc" target="_blank">Source</a> <a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/minasn1.nim#L101" class="link-seesrc" target="_blank" >Edit</a> </dd> </div> </dl></div> <div class="section" id="12"> <h1><a class="toc-backref" href="#12">Procs</a></h1> <dl class="item"> <div id="$,Asn1Buffer" class="tohide"> <dt><pre><span class="Keyword">proc</span> <a href="#%24%2CAsn1Buffer"><span class="Identifier">`$`</span></a><span class="Other">(</span><span class="Identifier">buffer</span><span class="Other">:</span> <a href="minasn1.html#Asn1Buffer"><span class="Identifier">Asn1Buffer</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">string</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt> <dd> Return string representation of <tt class="docutils literal"><span class="pre">buffer</span></tt>. <a href="https://github.com/status-im/nim-libp2p/tree/fix-doc-workflow/libp2p/crypto/minasn1.nim#L703" class="link-seesrc" target="_blank">Source</a> <a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/minasn1.nim#L703" class="link-seesrc" target="_blank" >Edit</a> </dd> </div> <div id="$,Asn1Field" class="tohide"> <dt><pre><span class="Keyword">proc</span> <a href="#%24%2CAsn1Field"><span class="Identifier">`$`</span></a><span class="Other">(</span><span class="Identifier">field</span><span class="Other">:</span> <a href="minasn1.html#Asn1Field"><span class="Identifier">Asn1Field</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">string</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt> <dd> Return string representation of <tt class="docutils literal"><span class="pre">field</span></tt>. <a href="https://github.com/status-im/nim-libp2p/tree/fix-doc-workflow/libp2p/crypto/minasn1.nim#L707" class="link-seesrc" target="_blank">Source</a> <a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/minasn1.nim#L707" class="link-seesrc" target="_blank" >Edit</a> </dd> </div> <div id="==,Asn1Field,openArray[byte]" class="tohide"> <dt><pre><span class="Keyword">proc</span> <a href="#%3D%3D%2CAsn1Field%2CopenArray%5Bbyte%5D"><span class="Identifier">`==`</span></a><span class="Other">(</span><span class="Identifier">field</span><span class="Other">:</span> <a href="minasn1.html#Asn1Field"><span class="Identifier">Asn1Field</span></a><span class="Other">;</span> <span class="Identifier">data</span><span class="Other">:</span> <span class="Identifier">openArray</span><span class="Other">[</span><span class="Identifier">byte</span><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">bool</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt> <dd> Compares field <tt class="docutils literal"><span class="pre">field</span></tt> data with <tt class="docutils literal"><span class="pre">data</span></tt> and returns <tt class="docutils literal"><span class="pre">true</span></tt> if both buffers are equal. <a href="https://github.com/status-im/nim-libp2p/tree/fix-doc-workflow/libp2p/crypto/minasn1.nim#L665" class="link-seesrc" target="_blank">Source</a> <a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/minasn1.nim#L665" class="link-seesrc" target="_blank" >Edit</a> </dd> </div> <div id="asn1EncodeBitString,openArray[byte],openArray[byte],int" class="tohide"> <dt><pre><span class="Keyword">proc</span> <a href="#asn1EncodeBitString%2CopenArray%5Bbyte%5D%2CopenArray%5Bbyte%5D%2Cint"><span class="Identifier">asn1EncodeBitString</span></a><span class="Other">(</span><span class="Identifier">dest</span><span class="Other">:</span> <span class="Keyword">var</span> <span class="Identifier">openArray</span><span class="Other">[</span><span class="Identifier">byte</span><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">value</span><span class="Other">:</span> <span class="Identifier">openArray</span><span class="Other">[</span><span class="Identifier">byte</span><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">bits</span> <span class="Other">=</span> <span class="DecNumber">0</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">int</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt> <dd> <p>Encode array of bytes as ASN.1 DER <tt class="docutils literal"><span class="pre"><span class="Identifier">BIT</span> <span class="Identifier">STRING</span></span></tt> and return number of bytes (octets) used.</p> <p><tt class="docutils literal"><span class="pre">bits</span></tt> number of unused bits in <tt class="docutils literal"><span class="pre">value</span></tt>. If <tt class="docutils literal"><span class="pre">bits == 0</span></tt>, all the bits from <tt class="docutils literal"><span class="pre">value</span></tt> will be used.</p> <p>If length of <tt class="docutils literal"><span class="pre">dest</span></tt> is less then number of required bytes to encode <tt class="docutils literal"><span class="pre">value</span></tt>, then result of encoding will not be stored in <tt class="docutils literal"><span class="pre">dest</span></tt> but number of bytes (octets) required will be returned.</p> <a href="https://github.com/status-im/nim-libp2p/tree/fix-doc-workflow/libp2p/crypto/minasn1.nim#L286" class="link-seesrc" target="_blank">Source</a> <a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/minasn1.nim#L286" class="link-seesrc" target="_blank" >Edit</a> </dd> </div> <div id="asn1EncodeBoolean,openArray[byte],bool" class="tohide"> <dt><pre><span class="Keyword">proc</span> <a href="#asn1EncodeBoolean%2CopenArray%5Bbyte%5D%2Cbool"><span class="Identifier">asn1EncodeBoolean</span></a><span class="Other">(</span><span class="Identifier">dest</span><span class="Other">:</span> <span class="Keyword">var</span> <span class="Identifier">openArray</span><span class="Other">[</span><span class="Identifier">byte</span><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">value</span><span class="Other">:</span> <span class="Identifier">bool</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">int</span> {. <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt> <dd> <p>Encode Nim's boolean as ASN.1 DER <tt class="docutils literal"><span class="pre"><span class="Identifier">BOOLEAN</span></span></tt> and return number of bytes (octets) used.</p> <p>If length of <tt class="docutils literal"><span class="pre">dest</span></tt> is less then number of required bytes to encode <tt class="docutils literal"><span class="pre">value</span></tt>, then result of encoding will not be stored in <tt class="docutils literal"><span class="pre">dest</span></tt> but number of bytes (octets) required will be returned.</p> <a href="https://github.com/status-im/nim-libp2p/tree/fix-doc-workflow/libp2p/crypto/minasn1.nim#L242" class="link-seesrc" target="_blank">Source</a> <a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/minasn1.nim#L242" class="link-seesrc" target="_blank" >Edit</a> </dd> </div> <div id="asn1EncodeComposite,openArray[byte],Asn1Composite" class="tohide"> <dt><pre><span class="Keyword">proc</span> <a href="#asn1EncodeComposite%2CopenArray%5Bbyte%5D%2CAsn1Composite"><span class="Identifier">asn1EncodeComposite</span></a><span class="Other">(</span><span class="Identifier">dest</span><span class="Other">:</span> <span class="Keyword">var</span> <span class="Identifier">openArray</span><span class="Other">[</span><span class="Identifier">byte</span><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">value</span><span class="Other">:</span> <a href="minasn1.html#Asn1Composite"><span class="Identifier">Asn1Composite</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">int</span> {. <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt> <dd> <p>Encode composite value and return number of bytes (octets) used.</p> <p>If length of <tt class="docutils literal"><span class="pre">dest</span></tt> is less then number of required bytes to encode <tt class="docutils literal"><span class="pre">value</span></tt>, then result of encoding will not be stored in <tt class="docutils literal"><span class="pre">dest</span></tt> but number of bytes (octets) required will be returned.</p> <a href="https://github.com/status-im/nim-libp2p/tree/fix-doc-workflow/libp2p/crypto/minasn1.nim#L381" class="link-seesrc" target="_blank">Source</a> <a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/minasn1.nim#L381" class="link-seesrc" target="_blank" >Edit</a> </dd> </div> <div id="asn1EncodeContextTag,openArray[byte],openArray[byte],int" class="tohide"> <dt><pre><span class="Keyword">proc</span> <a href="#asn1EncodeContextTag%2CopenArray%5Bbyte%5D%2CopenArray%5Bbyte%5D%2Cint"><span class="Identifier">asn1EncodeContextTag</span></a><span class="Other">(</span><span class="Identifier">dest</span><span class="Other">:</span> <span class="Keyword">var</span> <span class="Identifier">openArray</span><span class="Other">[</span><span class="Identifier">byte</span><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">value</span><span class="Other">:</span> <span class="Identifier">openArray</span><span class="Other">[</span><span class="Identifier">byte</span><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">tag</span><span class="Other">:</span> <span class="Identifier">int</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">int</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt> <dd> <p>Encode ASN.1 DER <tt class="docutils literal"><span class="pre"><span class="Identifier">CONTEXT</span> <span class="Identifier">SPECIFIC</span> <span class="Identifier">TAG</span></span></tt> <tt class="docutils literal"><span class="pre">tag</span></tt> for value <tt class="docutils literal"><span class="pre">value</span></tt> and return number of bytes (octets) used.</p> <p>Note: Only values in [0, 15] range can be used as context tag <tt class="docutils literal"><span class="pre">tag</span></tt> values.</p> <p>If length of <tt class="docutils literal"><span class="pre">dest</span></tt> is less then number of required bytes to encode <tt class="docutils literal"><span class="pre">value</span></tt>, then result of encoding will not be stored in <tt class="docutils literal"><span class="pre">dest</span></tt> but number of bytes (octets) required will be returned.</p> <a href="https://github.com/status-im/nim-libp2p/tree/fix-doc-workflow/libp2p/crypto/minasn1.nim#L398" class="link-seesrc" target="_blank">Source</a> <a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/minasn1.nim#L398" class="link-seesrc" target="_blank" >Edit</a> </dd> </div> <div id="asn1EncodeInteger,openArray[byte],openArray[byte]" class="tohide"> <dt><pre><span class="Keyword">proc</span> <a href="#asn1EncodeInteger%2CopenArray%5Bbyte%5D%2CopenArray%5Bbyte%5D"><span class="Identifier">asn1EncodeInteger</span></a><span class="Other">(</span><span class="Identifier">dest</span><span class="Other">:</span> <span class="Keyword">var</span> <span class="Identifier">openArray</span><span class="Other">[</span><span class="Identifier">byte</span><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">value</span><span class="Other">:</span> <span class="Identifier">openArray</span><span class="Other">[</span><span class="Identifier">byte</span><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">int</span> {. <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt> <dd> <p>Encode big-endian binary representation of integer as ASN.1 DER <tt class="docutils literal"><span class="pre"><span class="Identifier">INTEGER</span></span></tt> and return number of bytes (octets) used.</p> <p>If length of <tt class="docutils literal"><span class="pre">dest</span></tt> is less then number of required bytes to encode <tt class="docutils literal"><span class="pre">value</span></tt>, then result of encoding WILL NOT BE stored in <tt class="docutils literal"><span class="pre">dest</span></tt> but number of bytes (octets) required will be returned.</p> <a href="https://github.com/status-im/nim-libp2p/tree/fix-doc-workflow/libp2p/crypto/minasn1.nim#L185" class="link-seesrc" target="_blank">Source</a> <a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/minasn1.nim#L185" class="link-seesrc" target="_blank" >Edit</a> </dd> </div> <div id="asn1EncodeInteger,openArray[byte],T" class="tohide"> <dt><pre><span class="Keyword">proc</span> <a href="#asn1EncodeInteger%2CopenArray%5Bbyte%5D%2CT"><span class="Identifier">asn1EncodeInteger</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">:</span> <span class="Identifier">SomeUnsignedInt</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">dest</span><span class="Other">:</span> <span class="Keyword">var</span> <span class="Identifier">openArray</span><span class="Other">[</span><span class="Identifier">byte</span><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">value</span><span class="Other">:</span> <span class="Identifier">T</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">int</span> {. <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt> <dd> <p>Encode Nim's unsigned integer as ASN.1 DER <tt class="docutils literal"><span class="pre"><span class="Identifier">INTEGER</span></span></tt> and return number of bytes (octets) used.</p> <p>If length of <tt class="docutils literal"><span class="pre">dest</span></tt> is less then number of required bytes to encode <tt class="docutils literal"><span class="pre">value</span></tt>, then result of encoding will not be stored in <tt class="docutils literal"><span class="pre">dest</span></tt> but number of bytes (octets) required will be returned.</p> <a href="https://github.com/status-im/nim-libp2p/tree/fix-doc-workflow/libp2p/crypto/minasn1.nim#L232" class="link-seesrc" target="_blank">Source</a> <a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/minasn1.nim#L232" class="link-seesrc" target="_blank" >Edit</a> </dd> </div> <div id="asn1EncodeLength,openArray[byte],uint64" class="tohide"> <dt><pre><span class="Keyword">proc</span> <a href="#asn1EncodeLength%2CopenArray%5Bbyte%5D%2Cuint64"><span class="Identifier">asn1EncodeLength</span></a><span class="Other">(</span><span class="Identifier">dest</span><span class="Other">:</span> <span class="Keyword">var</span> <span class="Identifier">openArray</span><span class="Other">[</span><span class="Identifier">byte</span><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">length</span><span class="Other">:</span> <span class="Identifier">uint64</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">int</span> {. <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt> <dd> <p>Encode ASN.1 DER length part of TLV triple and return number of bytes (octets) used.</p> <p>If length of <tt class="docutils literal"><span class="pre">dest</span></tt> is less then number of required bytes to encode <tt class="docutils literal"><span class="pre">length</span></tt> value, then result of encoding WILL NOT BE stored in <tt class="docutils literal"><span class="pre">dest</span></tt> but number of bytes (octets) required will be returned.</p> <a href="https://github.com/status-im/nim-libp2p/tree/fix-doc-workflow/libp2p/crypto/minasn1.nim#L158" class="link-seesrc" target="_blank">Source</a> <a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/minasn1.nim#L158" class="link-seesrc" target="_blank" >Edit</a> </dd> </div> <div id="asn1EncodeNull,openArray[byte]" class="tohide"> <dt><pre><span class="Keyword">proc</span> <a href="#asn1EncodeNull%2CopenArray%5Bbyte%5D"><span class="Identifier">asn1EncodeNull</span></a><span class="Other">(</span><span class="Identifier">dest</span><span class="Other">:</span> <span class="Keyword">var</span> <span class="Identifier">openArray</span><span class="Other">[</span><span class="Identifier">byte</span><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">int</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt> <dd> <p>Encode ASN.1 DER <tt class="docutils literal"><span class="pre"><span class="Identifier">NULL</span></span></tt> and return number of bytes (octets) used.</p> <p>If length of <tt class="docutils literal"><span class="pre">dest</span></tt> is less then number of required bytes to encode <tt class="docutils literal"><span class="pre">value</span></tt>, then result of encoding will not be stored in <tt class="docutils literal"><span class="pre">dest</span></tt> but number of bytes (octets) required will be returned.</p> <a href="https://github.com/status-im/nim-libp2p/tree/fix-doc-workflow/libp2p/crypto/minasn1.nim#L256" class="link-seesrc" target="_blank">Source</a> <a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/minasn1.nim#L256" class="link-seesrc" target="_blank" >Edit</a> </dd> </div> <div id="asn1EncodeOctetString,openArray[byte],openArray[byte]" class="tohide"> <dt><pre><span class="Keyword">proc</span> <a href="#asn1EncodeOctetString%2CopenArray%5Bbyte%5D%2CopenArray%5Bbyte%5D"><span class="Identifier">asn1EncodeOctetString</span></a><span class="Other">(</span><span class="Identifier">dest</span><span class="Other">:</span> <span class="Keyword">var</span> <span class="Identifier">openArray</span><span class="Other">[</span><span class="Identifier">byte</span><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">value</span><span class="Other">:</span> <span class="Identifier">openArray</span><span class="Other">[</span><span class="Identifier">byte</span><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">int</span> {. <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt> <dd> <p>Encode array of bytes as ASN.1 DER <tt class="docutils literal"><span class="pre"><span class="Identifier">OCTET</span> <span class="Identifier">STRING</span></span></tt> and return number of bytes (octets) used.</p> <p>If length of <tt class="docutils literal"><span class="pre">dest</span></tt> is less then number of required bytes to encode <tt class="docutils literal"><span class="pre">value</span></tt>, then result of encoding will not be stored in <tt class="docutils literal"><span class="pre">dest</span></tt> but number of bytes (octets) required will be returned.</p> <a href="https://github.com/status-im/nim-libp2p/tree/fix-doc-workflow/libp2p/crypto/minasn1.nim#L268" class="link-seesrc" target="_blank">Source</a> <a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/minasn1.nim#L268" class="link-seesrc" target="_blank" >Edit</a> </dd> </div> <div id="asn1EncodeOid,openArray[byte],openArray[byte]" class="tohide"> <dt><pre><span class="Keyword">proc</span> <a href="#asn1EncodeOid%2CopenArray%5Bbyte%5D%2CopenArray%5Bbyte%5D"><span class="Identifier">asn1EncodeOid</span></a><span class="Other">(</span><span class="Identifier">dest</span><span class="Other">:</span> <span class="Keyword">var</span> <span class="Identifier">openArray</span><span class="Other">[</span><span class="Identifier">byte</span><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">value</span><span class="Other">:</span> <span class="Identifier">openArray</span><span class="Other">[</span><span class="Identifier">byte</span><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">int</span> {. <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt> <dd> <p>Encode array of bytes <tt class="docutils literal"><span class="pre">value</span></tt> as ASN.1 DER <tt class="docutils literal"><span class="pre"><span class="Keyword">OBJECT</span> <span class="Identifier">IDENTIFIER</span></span></tt> and return number of bytes (octets) used.</p> <p>This procedure is useful to encode constant predefined identifiers such as <tt class="docutils literal"><span class="pre">asn1OidSecp256r1</span></tt>, <tt class="docutils literal"><span class="pre">asn1OidRsaEncryption</span></tt>.</p> <p>If length of <tt class="docutils literal"><span class="pre">dest</span></tt> is less then number of required bytes to encode <tt class="docutils literal"><span class="pre">value</span></tt>, then result of encoding will not be stored in <tt class="docutils literal"><span class="pre">dest</span></tt> but number of bytes (octets) required will be returned.</p> <a href="https://github.com/status-im/nim-libp2p/tree/fix-doc-workflow/libp2p/crypto/minasn1.nim#L345" class="link-seesrc" target="_blank">Source</a> <a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/minasn1.nim#L345" class="link-seesrc" target="_blank" >Edit</a> </dd> </div> <div id="asn1EncodeSequence,openArray[byte],openArray[byte]" class="tohide"> <dt><pre><span class="Keyword">proc</span> <a href="#asn1EncodeSequence%2CopenArray%5Bbyte%5D%2CopenArray%5Bbyte%5D"><span class="Identifier">asn1EncodeSequence</span></a><span class="Other">(</span><span class="Identifier">dest</span><span class="Other">:</span> <span class="Keyword">var</span> <span class="Identifier">openArray</span><span class="Other">[</span><span class="Identifier">byte</span><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">value</span><span class="Other">:</span> <span class="Identifier">openArray</span><span class="Other">[</span><span class="Identifier">byte</span><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">int</span> {. <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt> <dd> <p>Encode <tt class="docutils literal"><span class="pre">value</span></tt> as ASN.1 DER <tt class="docutils literal"><span class="pre"><span class="Identifier">SEQUENCE</span></span></tt> and return number of bytes (octets) used.</p> <p>If length of <tt class="docutils literal"><span class="pre">dest</span></tt> is less then number of required bytes to encode <tt class="docutils literal"><span class="pre">value</span></tt>, then result of encoding will not be stored in <tt class="docutils literal"><span class="pre">dest</span></tt> but number of bytes (octets) required will be returned.</p> <a href="https://github.com/status-im/nim-libp2p/tree/fix-doc-workflow/libp2p/crypto/minasn1.nim#L364" class="link-seesrc" target="_blank">Source</a> <a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/minasn1.nim#L364" class="link-seesrc" target="_blank" >Edit</a> </dd> </div> <div id="code,Asn1Tag" class="tohide"> <dt><pre><span class="Keyword">proc</span> <a href="#code%2CAsn1Tag"><span class="Identifier">code</span></a><span class="Other">(</span><span class="Identifier">tag</span><span class="Other">:</span> <a href="minasn1.html#Asn1Tag"><span class="Identifier">Asn1Tag</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">byte</span> {.<span class="Identifier">inline</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt> <dd> Converts Nim <tt class="docutils literal"><span class="pre">tag</span></tt> enum to ASN.1 tag code. <a href="https://github.com/status-im/nim-libp2p/tree/fix-doc-workflow/libp2p/crypto/minasn1.nim#L136" class="link-seesrc" target="_blank">Source</a> <a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/minasn1.nim#L136" class="link-seesrc" target="_blank" >Edit</a> </dd> </div> <div id="extend,T,int" class="tohide"> <dt><pre><span class="Keyword">proc</span> <a href="#extend%2CT%2Cint"><span class="Identifier">extend</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">:</span> <a href="minasn1.html#Asn1Buffer"><span class="Identifier">Asn1Buffer</span></a> <span class="Operator">|</span> <a href="minasn1.html#Asn1Composite"><span class="Identifier">Asn1Composite</span></a><span class="Other">]</span><span class="Other">(</span><span class="Identifier">abc</span><span class="Other">:</span> <span class="Keyword">var</span> <span class="Identifier">T</span><span class="Other">;</span> <span class="Identifier">length</span><span class="Other">:</span> <span class="Identifier">int</span><span class="Other">)</span> {.<span class="Identifier">inline</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt> <dd> Extend buffer or composite's internal buffer by <tt class="docutils literal"><span class="pre">length</span></tt> octets. <a href="https://github.com/status-im/nim-libp2p/tree/fix-doc-workflow/libp2p/crypto/minasn1.nim#L132" class="link-seesrc" target="_blank">Source</a> <a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/minasn1.nim#L132" class="link-seesrc" target="_blank" >Edit</a> </dd> </div> <div id="finish,T" class="tohide"> <dt><pre><span class="Keyword">proc</span> <a href="#finish%2CT"><span class="Identifier">finish</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">:</span> <a href="minasn1.html#Asn1Buffer"><span class="Identifier">Asn1Buffer</span></a> <span class="Operator">|</span> <a href="minasn1.html#Asn1Composite"><span class="Identifier">Asn1Composite</span></a><span class="Other">]</span><span class="Other">(</span><span class="Identifier">abc</span><span class="Other">:</span> <span class="Keyword">var</span> <span class="Identifier">T</span><span class="Other">)</span> {.<span class="Identifier">inline</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt> <dd> Finishes buffer or composite and prepares it for writing. <a href="https://github.com/status-im/nim-libp2p/tree/fix-doc-workflow/libp2p/crypto/minasn1.nim#L844" class="link-seesrc" target="_blank">Source</a> <a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/minasn1.nim#L844" class="link-seesrc" target="_blank" >Edit</a> </dd> </div> <div id="getBuffer,Asn1Field" class="tohide"> <dt><pre><span class="Keyword">proc</span> <a href="#getBuffer%2CAsn1Field"><span class="Identifier">getBuffer</span></a><span class="Other">(</span><span class="Identifier">field</span><span class="Other">:</span> <a href="minasn1.html#Asn1Field"><span class="Identifier">Asn1Field</span></a><span class="Other">)</span><span class="Other">:</span> <a href="minasn1.html#Asn1Buffer"><span class="Identifier">Asn1Buffer</span></a> {.<span class="Identifier">inline</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt> <dd> Return <tt class="docutils literal"><span class="pre">field</span></tt> as Asn1Buffer to enter composite types. <a href="https://github.com/status-im/nim-libp2p/tree/fix-doc-workflow/libp2p/crypto/minasn1.nim#L661" class="link-seesrc" target="_blank">Source</a> <a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/minasn1.nim#L661" class="link-seesrc" target="_blank" >Edit</a> </dd> </div> <div id="init,typedesc[Asn1Buffer]" class="tohide"> <dt><pre><span class="Keyword">proc</span> <a href="#init%2Ctypedesc%5BAsn1Buffer%5D"><span class="Identifier">init</span></a><span class="Other">(</span><span class="Identifier">t</span><span class="Other">:</span> <span class="Identifier">typedesc</span><span class="Other">[</span><a href="minasn1.html#Asn1Buffer"><span class="Identifier">Asn1Buffer</span></a><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <a href="minasn1.html#Asn1Buffer"><span class="Identifier">Asn1Buffer</span></a> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt> <dd> Initialize empty <tt class="docutils literal"><span class="pre">Asn1Buffer</span></tt>. <a href="https://github.com/status-im/nim-libp2p/tree/fix-doc-workflow/libp2p/crypto/minasn1.nim#L691" class="link-seesrc" target="_blank">Source</a> <a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/minasn1.nim#L691" class="link-seesrc" target="_blank" >Edit</a> </dd> </div> <div id="init,typedesc[Asn1Buffer],openArray[byte]" class="tohide"> <dt><pre><span class="Keyword">proc</span> <a href="#init%2Ctypedesc%5BAsn1Buffer%5D%2CopenArray%5Bbyte%5D"><span class="Identifier">init</span></a><span class="Other">(</span><span class="Identifier">t</span><span class="Other">:</span> <span class="Identifier">typedesc</span><span class="Other">[</span><a href="minasn1.html#Asn1Buffer"><span class="Identifier">Asn1Buffer</span></a><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">data</span><span class="Other">:</span> <span class="Identifier">openArray</span><span class="Other">[</span><span class="Identifier">byte</span><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <a href="minasn1.html#Asn1Buffer"><span class="Identifier">Asn1Buffer</span></a> {. <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt> <dd> Initialize <tt class="docutils literal"><span class="pre">Asn1Buffer</span></tt> from array of bytes <tt class="docutils literal"><span class="pre">data</span></tt>. <a href="https://github.com/status-im/nim-libp2p/tree/fix-doc-workflow/libp2p/crypto/minasn1.nim#L683" class="link-seesrc" target="_blank">Source</a> <a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/minasn1.nim#L683" class="link-seesrc" target="_blank" >Edit</a> </dd> </div> <div id="init,typedesc[Asn1Buffer],string" class="tohide"> <dt><pre><span class="Keyword">proc</span> <a href="#init%2Ctypedesc%5BAsn1Buffer%5D%2Cstring"><span class="Identifier">init</span></a><span class="Other">(</span><span class="Identifier">t</span><span class="Other">:</span> <span class="Identifier">typedesc</span><span class="Other">[</span><a href="minasn1.html#Asn1Buffer"><span class="Identifier">Asn1Buffer</span></a><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">data</span><span class="Other">:</span> <span class="Identifier">string</span><span class="Other">)</span><span class="Other">:</span> <a href="minasn1.html#Asn1Buffer"><span class="Identifier">Asn1Buffer</span></a> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt> <dd> Initialize <tt class="docutils literal"><span class="pre">Asn1Buffer</span></tt> from hexadecimal string <tt class="docutils literal"><span class="pre">data</span></tt>. <a href="https://github.com/status-im/nim-libp2p/tree/fix-doc-workflow/libp2p/crypto/minasn1.nim#L687" class="link-seesrc" target="_blank">Source</a> <a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/minasn1.nim#L687" class="link-seesrc" target="_blank" >Edit</a> </dd> </div> <div id="init,typedesc[Asn1Composite],int" class="tohide"> <dt><pre><span class="Keyword">proc</span> <a href="#init%2Ctypedesc%5BAsn1Composite%5D%2Cint"><span class="Identifier">init</span></a><span class="Other">(</span><span class="Identifier">t</span><span class="Other">:</span> <span class="Identifier">typedesc</span><span class="Other">[</span><a href="minasn1.html#Asn1Composite"><span class="Identifier">Asn1Composite</span></a><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">idx</span><span class="Other">:</span> <span class="Identifier">int</span><span class="Other">)</span><span class="Other">:</span> <a href="minasn1.html#Asn1Composite"><span class="Identifier">Asn1Composite</span></a> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt> <dd> Initialize <tt class="docutils literal"><span class="pre">Asn1Composite</span></tt> with tag context-specific id <tt class="docutils literal"><span class="pre">id</span></tt>. <a href="https://github.com/status-im/nim-libp2p/tree/fix-doc-workflow/libp2p/crypto/minasn1.nim#L699" class="link-seesrc" target="_blank">Source</a> <a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/minasn1.nim#L699" class="link-seesrc" target="_blank" >Edit</a> </dd> </div> <div id="init,typedesc[Asn1Composite],Asn1Tag" class="tohide"> <dt><pre><span class="Keyword">proc</span> <a href="#init%2Ctypedesc%5BAsn1Composite%5D%2CAsn1Tag"><span class="Identifier">init</span></a><span class="Other">(</span><span class="Identifier">t</span><span class="Other">:</span> <span class="Identifier">typedesc</span><span class="Other">[</span><a href="minasn1.html#Asn1Composite"><span class="Identifier">Asn1Composite</span></a><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">tag</span><span class="Other">:</span> <a href="minasn1.html#Asn1Tag"><span class="Identifier">Asn1Tag</span></a><span class="Other">)</span><span class="Other">:</span> <a href="minasn1.html#Asn1Composite"><span class="Identifier">Asn1Composite</span></a> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt> <dd> Initialize <tt class="docutils literal"><span class="pre">Asn1Composite</span></tt> with tag <tt class="docutils literal"><span class="pre">tag</span></tt>. <a href="https://github.com/status-im/nim-libp2p/tree/fix-doc-workflow/libp2p/crypto/minasn1.nim#L695" class="link-seesrc" target="_blank">Source</a> <a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/minasn1.nim#L695" class="link-seesrc" target="_blank" >Edit</a> </dd> </div> <div id="len,Asn1Field" class="tohide"> <dt><pre><span class="Keyword">proc</span> <a href="#len%2CAsn1Field"><span class="Identifier">len</span></a><span class="Other">(</span><span class="Identifier">field</span><span class="Other">:</span> <a href="minasn1.html#Asn1Field"><span class="Identifier">Asn1Field</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">int</span> {.<span class="Identifier">inline</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt> <dd> <a href="https://github.com/status-im/nim-libp2p/tree/fix-doc-workflow/libp2p/crypto/minasn1.nim#L126" class="link-seesrc" target="_blank">Source</a> <a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/minasn1.nim#L126" class="link-seesrc" target="_blank" >Edit</a> </dd> </div> <div id="len,T" class="tohide"> <dt><pre><span class="Keyword">proc</span> <a href="#len%2CT"><span class="Identifier">len</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">:</span> <a href="minasn1.html#Asn1Buffer"><span class="Identifier">Asn1Buffer</span></a> <span class="Operator">|</span> <a href="minasn1.html#Asn1Composite"><span class="Identifier">Asn1Composite</span></a><span class="Other">]</span><span class="Other">(</span><span class="Identifier">abc</span><span class="Other">:</span> <span class="Identifier">T</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">int</span> {.<span class="Identifier">inline</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt> <dd> <a href="https://github.com/status-im/nim-libp2p/tree/fix-doc-workflow/libp2p/crypto/minasn1.nim#L123" class="link-seesrc" target="_blank">Source</a> <a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/minasn1.nim#L123" class="link-seesrc" target="_blank" >Edit</a> </dd> </div> <div id="read,Asn1Buffer" class="tohide"> <dt><pre><span class="Keyword">proc</span> <a href="#read%2CAsn1Buffer"><span class="Identifier">read</span></a><span class="Other">(</span><span class="Identifier">ab</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="minasn1.html#Asn1Buffer"><span class="Identifier">Asn1Buffer</span></a><span class="Other">)</span><span class="Other">:</span> <a href="minasn1.html#Asn1Result"><span class="Identifier">Asn1Result</span></a><span class="Other">[</span><a href="minasn1.html#Asn1Field"><span class="Identifier">Asn1Field</span></a><span class="Other">]</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt> <dd> Decode value part of ASN.1 TLV triplet. <a href="https://github.com/status-im/nim-libp2p/tree/fix-doc-workflow/libp2p/crypto/minasn1.nim#L462" class="link-seesrc" target="_blank">Source</a> <a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/minasn1.nim#L462" class="link-seesrc" target="_blank" >Edit</a> </dd> </div> <div id="write,T,Asn1Tag" class="tohide"> <dt><pre><span class="Keyword">proc</span> <a href="#write%2CT%2CAsn1Tag"><span class="Identifier">write</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">:</span> <a href="minasn1.html#Asn1Buffer"><span class="Identifier">Asn1Buffer</span></a> <span class="Operator">|</span> <a href="minasn1.html#Asn1Composite"><span class="Identifier">Asn1Composite</span></a><span class="Other">]</span><span class="Other">(</span><span class="Identifier">abc</span><span class="Other">:</span> <span class="Keyword">var</span> <span class="Identifier">T</span><span class="Other">;</span> <span class="Identifier">tag</span><span class="Other">:</span> <a href="minasn1.html#Asn1Tag"><span class="Identifier">Asn1Tag</span></a><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt> <dd> <p>Write empty value to buffer or composite with <tt class="docutils literal"><span class="pre">tag</span></tt>.</p> <p>This procedure must be used to write <tt class="docutils literal"><span class="pre"><span class="Identifier">NULL</span></span></tt>, <tt class="docutils literal"><span class="pre"><span class="DecNumber">0</span></span></tt> or empty <tt class="docutils literal"><span class="pre"><span class="Identifier">BIT</span> <span class="Identifier">STRING</span></span></tt>, <tt class="docutils literal"><span class="pre"><span class="Identifier">OCTET</span> <span class="Identifier">STRING</span></span></tt> types.</p> <a href="https://github.com/status-im/nim-libp2p/tree/fix-doc-workflow/libp2p/crypto/minasn1.nim#L755" class="link-seesrc" target="_blank">Source</a> <a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/minasn1.nim#L755" class="link-seesrc" target="_blank" >Edit</a> </dd> </div> <div id="write,T,Asn1Tag,openArray[byte],int" class="tohide"> <dt><pre><span class="Keyword">proc</span> <a href="#write%2CT%2CAsn1Tag%2CopenArray%5Bbyte%5D%2Cint"><span class="Identifier">write</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">:</span> <a href="minasn1.html#Asn1Buffer"><span class="Identifier">Asn1Buffer</span></a> <span class="Operator">|</span> <a href="minasn1.html#Asn1Composite"><span class="Identifier">Asn1Composite</span></a><span class="Other">]</span><span class="Other">(</span><span class="Identifier">abc</span><span class="Other">:</span> <span class="Keyword">var</span> <span class="Identifier">T</span><span class="Other">;</span> <span class="Identifier">tag</span><span class="Other">:</span> <a href="minasn1.html#Asn1Tag"><span class="Identifier">Asn1Tag</span></a><span class="Other">;</span> <span class="Identifier">value</span><span class="Other">:</span> <span class="Identifier">openArray</span><span class="Other">[</span><span class="Identifier">byte</span><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">bits</span> <span class="Other">=</span> <span class="DecNumber">0</span><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt> <dd> <p>Write array <tt class="docutils literal"><span class="pre">value</span></tt> using <tt class="docutils literal"><span class="pre">tag</span></tt>.</p> <p>This procedure is used to write ASN.1 <tt class="docutils literal"><span class="pre"><span class="Identifier">INTEGER</span></span></tt>, <tt class="docutils literal"><span class="pre"><span class="Identifier">OCTET</span> <span class="Identifier">STRING</span></span></tt>, <tt class="docutils literal"><span class="pre"><span class="Identifier">BIT</span> <span class="Identifier">STRING</span></span></tt> or <tt class="docutils literal"><span class="pre"><span class="Keyword">OBJECT</span> <span class="Identifier">IDENTIFIER</span></span></tt>.</p> <p>For <tt class="docutils literal"><span class="pre"><span class="Identifier">BIT</span> <span class="Identifier">STRING</span></span></tt> you can use <tt class="docutils literal"><span class="pre">bits</span></tt> argument to specify number of used bits.</p> <a href="https://github.com/status-im/nim-libp2p/tree/fix-doc-workflow/libp2p/crypto/minasn1.nim#L797" class="link-seesrc" target="_blank">Source</a> <a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/minasn1.nim#L797" class="link-seesrc" target="_blank" >Edit</a> </dd> </div> <div id="write,T,Asn1Composite" class="tohide"> <dt><pre><span class="Keyword">proc</span> <a href="#write%2CT%2CAsn1Composite"><span class="Identifier">write</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">:</span> <a href="minasn1.html#Asn1Buffer"><span class="Identifier">Asn1Buffer</span></a> <span class="Operator">|</span> <a href="minasn1.html#Asn1Composite"><span class="Identifier">Asn1Composite</span></a><span class="Other">]</span><span class="Other">(</span><span class="Identifier">abc</span><span class="Other">:</span> <span class="Keyword">var</span> <span class="Identifier">T</span><span class="Other">;</span> <span class="Identifier">value</span><span class="Other">:</span> <a href="minasn1.html#Asn1Composite"><span class="Identifier">Asn1Composite</span></a><span class="Other">)</span> {. <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt> <dd> <a href="https://github.com/status-im/nim-libp2p/tree/fix-doc-workflow/libp2p/crypto/minasn1.nim#L827" class="link-seesrc" target="_blank">Source</a> <a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/minasn1.nim#L827" class="link-seesrc" target="_blank" >Edit</a> </dd> </div> <div id="write,T,bool" class="tohide"> <dt><pre><span class="Keyword">proc</span> <a href="#write%2CT%2Cbool"><span class="Identifier">write</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">:</span> <a href="minasn1.html#Asn1Buffer"><span class="Identifier">Asn1Buffer</span></a> <span class="Operator">|</span> <a href="minasn1.html#Asn1Composite"><span class="Identifier">Asn1Composite</span></a><span class="Other">]</span><span class="Other">(</span><span class="Identifier">abc</span><span class="Other">:</span> <span class="Keyword">var</span> <span class="Identifier">T</span><span class="Other">;</span> <span class="Identifier">value</span><span class="Other">:</span> <span class="Identifier">bool</span><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt> <dd> Write bool <tt class="docutils literal"><span class="pre">value</span></tt> to buffer or composite as ASN.1 <tt class="docutils literal"><span class="pre"><span class="Identifier">BOOLEAN</span></span></tt>. <a href="https://github.com/status-im/nim-libp2p/tree/fix-doc-workflow/libp2p/crypto/minasn1.nim#L790" class="link-seesrc" target="_blank">Source</a> <a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/minasn1.nim#L790" class="link-seesrc" target="_blank" >Edit</a> </dd> </div> <div id="write,T,uint64" class="tohide"> <dt><pre><span class="Keyword">proc</span> <a href="#write%2CT%2Cuint64"><span class="Identifier">write</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">:</span> <a href="minasn1.html#Asn1Buffer"><span class="Identifier">Asn1Buffer</span></a> <span class="Operator">|</span> <a href="minasn1.html#Asn1Composite"><span class="Identifier">Asn1Composite</span></a><span class="Other">]</span><span class="Other">(</span><span class="Identifier">abc</span><span class="Other">:</span> <span class="Keyword">var</span> <span class="Identifier">T</span><span class="Other">;</span> <span class="Identifier">value</span><span class="Other">:</span> <span class="Identifier">uint64</span><span class="Other">)</span> {. <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt> <dd> Write uint64 <tt class="docutils literal"><span class="pre">value</span></tt> to buffer or composite as ASN.1 <tt class="docutils literal"><span class="pre"><span class="Identifier">INTEGER</span></span></tt>. <a href="https://github.com/status-im/nim-libp2p/tree/fix-doc-workflow/libp2p/crypto/minasn1.nim#L783" class="link-seesrc" target="_blank">Source</a> <a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/minasn1.nim#L783" class="link-seesrc" target="_blank" >Edit</a> </dd> </div> </dl></div> <div class="section" id="18"> <h1><a class="toc-backref" href="#18">Templates</a></h1> <dl class="item"> <div id="getPtr.t,untyped" class="tohide"> <dt><pre><span class="Keyword">template</span> <a href="#getPtr.t%2Cuntyped"><span class="Identifier">getPtr</span></a><span class="Other">(</span><span class="Identifier">field</span><span class="Other">:</span> <span class="Identifier">untyped</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">pointer</span></pre></dt> <dd> <a href="https://github.com/status-im/nim-libp2p/tree/fix-doc-workflow/libp2p/crypto/minasn1.nim#L129" class="link-seesrc" target="_blank">Source</a> <a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/minasn1.nim#L129" class="link-seesrc" target="_blank" >Edit</a> </dd> </div> <div id="isEmpty.t,Asn1Buffer" class="tohide"> <dt><pre><span class="Keyword">template</span> <a href="#isEmpty.t%2CAsn1Buffer"><span class="Identifier">isEmpty</span></a><span class="Other">(</span><span class="Identifier">ab</span><span class="Other">:</span> <a href="minasn1.html#Asn1Buffer"><span class="Identifier">Asn1Buffer</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">bool</span></pre></dt> <dd> <a href="https://github.com/status-im/nim-libp2p/tree/fix-doc-workflow/libp2p/crypto/minasn1.nim#L117" class="link-seesrc" target="_blank">Source</a> <a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/minasn1.nim#L117" class="link-seesrc" target="_blank" >Edit</a> </dd> </div> <div id="isEnough.t,Asn1Buffer,int64" class="tohide"> <dt><pre><span class="Keyword">template</span> <a href="#isEnough.t%2CAsn1Buffer%2Cint64"><span class="Identifier">isEnough</span></a><span class="Other">(</span><span class="Identifier">ab</span><span class="Other">:</span> <a href="minasn1.html#Asn1Buffer"><span class="Identifier">Asn1Buffer</span></a><span class="Other">;</span> <span class="Identifier">length</span><span class="Other">:</span> <span class="Identifier">int64</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">bool</span></pre></dt> <dd> <a href="https://github.com/status-im/nim-libp2p/tree/fix-doc-workflow/libp2p/crypto/minasn1.nim#L120" class="link-seesrc" target="_blank">Source</a> <a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/minasn1.nim#L120" class="link-seesrc" target="_blank" >Edit</a> </dd> </div> <div id="toOpenArray.t,Asn1Buffer" class="tohide"> <dt><pre><span class="Keyword">template</span> <a href="#toOpenArray.t%2CAsn1Buffer"><span class="Identifier">toOpenArray</span></a><span class="Other">(</span><span class="Identifier">ab</span><span class="Other">:</span> <a href="minasn1.html#Asn1Buffer"><span class="Identifier">Asn1Buffer</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">untyped</span></pre></dt> <dd> <a href="https://github.com/status-im/nim-libp2p/tree/fix-doc-workflow/libp2p/crypto/minasn1.nim#L108" class="link-seesrc" target="_blank">Source</a> <a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/minasn1.nim#L108" class="link-seesrc" target="_blank" >Edit</a> </dd> </div> <div id="toOpenArray.t,Asn1Composite" class="tohide"> <dt><pre><span class="Keyword">template</span> <a href="#toOpenArray.t%2CAsn1Composite"><span class="Identifier">toOpenArray</span></a><span class="Other">(</span><span class="Identifier">ac</span><span class="Other">:</span> <a href="minasn1.html#Asn1Composite"><span class="Identifier">Asn1Composite</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">untyped</span></pre></dt> <dd> <a href="https://github.com/status-im/nim-libp2p/tree/fix-doc-workflow/libp2p/crypto/minasn1.nim#L111" class="link-seesrc" target="_blank">Source</a> <a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/minasn1.nim#L111" class="link-seesrc" target="_blank" >Edit</a> </dd> </div> <div id="toOpenArray.t,Asn1Field" class="tohide"> <dt><pre><span class="Keyword">template</span> <a href="#toOpenArray.t%2CAsn1Field"><span class="Identifier">toOpenArray</span></a><span class="Other">(</span><span class="Identifier">af</span><span class="Other">:</span> <a href="minasn1.html#Asn1Field"><span class="Identifier">Asn1Field</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">untyped</span></pre></dt> <dd> <a href="https://github.com/status-im/nim-libp2p/tree/fix-doc-workflow/libp2p/crypto/minasn1.nim#L114" class="link-seesrc" target="_blank">Source</a> <a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/minasn1.nim#L114" class="link-seesrc" target="_blank" >Edit</a> </dd> </div> </dl></div> </div> </div> <div class="row"> <div class="twelve-columns footer"> <span class="nim-sprite"></span> <br/> <small style="color: var(--hint);">Made with Nim. Generated: 2023-11-15 19:55:36 UTC</small> </div> </div> </div> </div> </body> </html>