1461 lines
124 KiB
HTML
1461 lines
124 KiB
HTML
<?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/ecnist</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/ecnist</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="#EcCurveKind"
|
|
title="EcCurveKind = enum
|
|
Secp256r1 = 23, Secp384r1 = 24, Secp521r1 = 25">EcCurveKind</a></li>
|
|
<li><a class="reference" href="#ECDHEScheme"
|
|
title="ECDHEScheme = EcCurveKind">ECDHEScheme</a></li>
|
|
<li><a class="reference" href="#EcError"
|
|
title="EcError = enum
|
|
EcRngError, EcKeyGenError, EcPublicKeyError, EcKeyIncorrectError,
|
|
EcSignatureError">EcError</a></li>
|
|
<li><a class="reference" href="#EcKeyPair"
|
|
title="EcKeyPair = object
|
|
seckey*: EcPrivateKey
|
|
pubkey*: EcPublicKey">EcKeyPair</a></li>
|
|
<li><a class="reference" href="#EcPKI"
|
|
title="EcPKI = EcPrivateKey | EcPublicKey | EcSignature">EcPKI</a></li>
|
|
<li><a class="reference" href="#EcPrivateKey"
|
|
title="EcPrivateKey = ref object
|
|
buffer*: array[EC_KBUF_PRIV_MAX_SIZE, byte]
|
|
key*: ec.EcPrivateKey">EcPrivateKey</a></li>
|
|
<li><a class="reference" href="#EcPublicKey"
|
|
title="EcPublicKey = ref object
|
|
buffer*: array[EC_KBUF_PUB_MAX_SIZE, byte]
|
|
key*: ec.EcPublicKey">EcPublicKey</a></li>
|
|
<li><a class="reference" href="#EcResult"
|
|
title="EcResult[T] = Result[T, EcError]">EcResult</a></li>
|
|
<li><a class="reference" href="#EcSignature"
|
|
title="EcSignature = ref object
|
|
buffer*: seq[byte]">EcSignature</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="#EcSupportedCurvesCint"
|
|
title="EcSupportedCurvesCint = [23, 24, 25]">EcSupportedCurvesCint</a></li>
|
|
<li><a class="reference" href="#PubKey256Length"
|
|
title="PubKey256Length = 65">PubKey256Length</a></li>
|
|
<li><a class="reference" href="#PubKey384Length"
|
|
title="PubKey384Length = 97">PubKey384Length</a></li>
|
|
<li><a class="reference" href="#PubKey521Length"
|
|
title="PubKey521Length = 133">PubKey521Length</a></li>
|
|
<li><a class="reference" href="#SecKey256Length"
|
|
title="SecKey256Length = 32">SecKey256Length</a></li>
|
|
<li><a class="reference" href="#SecKey384Length"
|
|
title="SecKey384Length = 48">SecKey384Length</a></li>
|
|
<li><a class="reference" href="#SecKey521Length"
|
|
title="SecKey521Length = 66">SecKey521Length</a></li>
|
|
<li><a class="reference" href="#Secret256Length"
|
|
title="Secret256Length = 32">Secret256Length</a></li>
|
|
<li><a class="reference" href="#Secret384Length"
|
|
title="Secret384Length = 48">Secret384Length</a></li>
|
|
<li><a class="reference" href="#Secret521Length"
|
|
title="Secret521Length = 66">Secret521Length</a></li>
|
|
<li><a class="reference" href="#Sig256Length"
|
|
title="Sig256Length = 64">Sig256Length</a></li>
|
|
<li><a class="reference" href="#Sig384Length"
|
|
title="Sig384Length = 96">Sig384Length</a></li>
|
|
<li><a class="reference" href="#Sig521Length"
|
|
title="Sig521Length = 132">Sig521Length</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%2CEcPublicKey"
|
|
title="`$`(pubkey: EcPublicKey): string">`$`(pubkey: EcPublicKey): string</a></li>
|
|
<li><a class="reference" href="#%24%2CEcPrivateKey"
|
|
title="`$`(seckey: EcPrivateKey): string">`$`(seckey: EcPrivateKey): string</a></li>
|
|
<li><a class="reference" href="#%24%2CEcSignature"
|
|
title="`$`(sig: EcSignature): string">`$`(sig: EcSignature): string</a></li>
|
|
|
|
</ul>
|
|
<ul class="simple nested-toc-section">==
|
|
<li><a class="reference" href="#%3D%3D%2CEcSignature%2CEcSignature"
|
|
title="`==`(a, b: EcSignature): bool">`==`(a, b: EcSignature): bool</a></li>
|
|
<li><a class="reference" href="#%3D%3D%2CEcPublicKey%2CEcPublicKey"
|
|
title="`==`(pubkey1, pubkey2: EcPublicKey): bool">`==`(pubkey1, pubkey2: EcPublicKey): bool</a></li>
|
|
<li><a class="reference" href="#%3D%3D%2CEcPrivateKey%2CEcPrivateKey"
|
|
title="`==`(seckey1, seckey2: EcPrivateKey): bool">`==`(seckey1, seckey2: EcPrivateKey): bool</a></li>
|
|
|
|
</ul>
|
|
<ul class="simple nested-toc-section">clear
|
|
<li><a class="reference" href="#clear%2CT"
|
|
title="clear[T: EcPKI | EcKeyPair](pki: var T)">clear[T: EcPKI | EcKeyPair](pki: var T)</a></li>
|
|
|
|
</ul>
|
|
<ul class="simple nested-toc-section">copy
|
|
<li><a class="reference" href="#copy%2CT%2CT"
|
|
title="copy[T: EcPKI](dst: var T; src: T): bool">copy[T: EcPKI](dst: var T; src: T): bool</a></li>
|
|
<li><a class="reference" href="#copy%2CT"
|
|
title="copy[T: EcPKI](src: T): T">copy[T: EcPKI](src: T): T</a></li>
|
|
|
|
</ul>
|
|
<ul class="simple nested-toc-section">ephemeral
|
|
<li><a class="reference" href="#ephemeral%2CEcCurveKind%2CHmacDrbgContext"
|
|
title="ephemeral(scheme: ECDHEScheme; rng: var HmacDrbgContext): EcResult[EcKeyPair]">ephemeral(scheme: ECDHEScheme; rng: var HmacDrbgContext): EcResult[EcKeyPair]</a></li>
|
|
<li><a class="reference" href="#ephemeral%2Cstring%2CHmacDrbgContext"
|
|
title="ephemeral(scheme: string; rng: var HmacDrbgContext): EcResult[EcKeyPair]">ephemeral(scheme: string; rng: var HmacDrbgContext): EcResult[EcKeyPair]</a></li>
|
|
|
|
</ul>
|
|
<ul class="simple nested-toc-section">getBytes
|
|
<li><a class="reference" href="#getBytes%2CEcPublicKey"
|
|
title="getBytes(pubkey: EcPublicKey): EcResult[seq[byte]]">getBytes(pubkey: EcPublicKey): EcResult[seq[byte]]</a></li>
|
|
<li><a class="reference" href="#getBytes%2CEcPrivateKey"
|
|
title="getBytes(seckey: EcPrivateKey): EcResult[seq[byte]]">getBytes(seckey: EcPrivateKey): EcResult[seq[byte]]</a></li>
|
|
<li><a class="reference" href="#getBytes%2CEcSignature"
|
|
title="getBytes(sig: EcSignature): EcResult[seq[byte]]">getBytes(sig: EcSignature): EcResult[seq[byte]]</a></li>
|
|
|
|
</ul>
|
|
<ul class="simple nested-toc-section">getPublicKey
|
|
<li><a class="reference" href="#getPublicKey%2CEcPrivateKey"
|
|
title="getPublicKey(seckey: EcPrivateKey): EcResult[EcPublicKey]">getPublicKey(seckey: EcPrivateKey): EcResult[EcPublicKey]</a></li>
|
|
|
|
</ul>
|
|
<ul class="simple nested-toc-section">getRawBytes
|
|
<li><a class="reference" href="#getRawBytes%2CEcPublicKey"
|
|
title="getRawBytes(pubkey: EcPublicKey): EcResult[seq[byte]]">getRawBytes(pubkey: EcPublicKey): EcResult[seq[byte]]</a></li>
|
|
<li><a class="reference" href="#getRawBytes%2CEcPrivateKey"
|
|
title="getRawBytes(seckey: EcPrivateKey): EcResult[seq[byte]]">getRawBytes(seckey: EcPrivateKey): EcResult[seq[byte]]</a></li>
|
|
<li><a class="reference" href="#getRawBytes%2CEcSignature"
|
|
title="getRawBytes(sig: EcSignature): EcResult[seq[byte]]">getRawBytes(sig: EcSignature): EcResult[seq[byte]]</a></li>
|
|
|
|
</ul>
|
|
<ul class="simple nested-toc-section">getSecret
|
|
<li><a class="reference" href="#getSecret%2CEcPublicKey%2CEcPrivateKey"
|
|
title="getSecret(pubkey: EcPublicKey; seckey: EcPrivateKey): seq[byte]">getSecret(pubkey: EcPublicKey; seckey: EcPrivateKey): seq[byte]</a></li>
|
|
|
|
</ul>
|
|
<ul class="simple nested-toc-section">init
|
|
<li><a class="reference" href="#init%2CEcPrivateKey%2CopenArray%5Bbyte%5D"
|
|
title="init(key: var EcPrivateKey; data: openArray[byte]): Result[void, Asn1Error]">init(key: var EcPrivateKey; data: openArray[byte]): Result[void, Asn1Error]</a></li>
|
|
<li><a class="reference" href="#init%2CEcPublicKey%2CopenArray%5Bbyte%5D"
|
|
title="init(pubkey: var EcPublicKey; data: openArray[byte]): Result[void, Asn1Error]">init(pubkey: var EcPublicKey; data: openArray[byte]): Result[void, Asn1Error]</a></li>
|
|
<li><a class="reference" href="#init%2CEcSignature%2CopenArray%5Bbyte%5D"
|
|
title="init(sig: var EcSignature; data: openArray[byte]): Result[void, Asn1Error]">init(sig: var EcSignature; data: openArray[byte]): Result[void, Asn1Error]</a></li>
|
|
<li><a class="reference" href="#init%2Ctypedesc%5BEcPrivateKey%5D%2CopenArray%5Bbyte%5D"
|
|
title="init(t: typedesc[EcPrivateKey]; data: openArray[byte]): EcResult[EcPrivateKey]">init(t: typedesc[EcPrivateKey]; data: openArray[byte]): EcResult[EcPrivateKey]</a></li>
|
|
<li><a class="reference" href="#init%2Ctypedesc%5BEcPublicKey%5D%2CopenArray%5Bbyte%5D"
|
|
title="init(t: typedesc[EcPublicKey]; data: openArray[byte]): EcResult[EcPublicKey]">init(t: typedesc[EcPublicKey]; data: openArray[byte]): EcResult[EcPublicKey]</a></li>
|
|
<li><a class="reference" href="#init%2Ctypedesc%5BEcSignature%5D%2CopenArray%5Bbyte%5D"
|
|
title="init(t: typedesc[EcSignature]; data: openArray[byte]): EcResult[EcSignature]">init(t: typedesc[EcSignature]; data: openArray[byte]): EcResult[EcSignature]</a></li>
|
|
<li><a class="reference" href="#init%2CT%2Cstring"
|
|
title="init[T: EcPKI](sospk: var T; data: string): Result[void, Asn1Error]">init[T: EcPKI](sospk: var T; data: string): Result[void, Asn1Error]</a></li>
|
|
<li><a class="reference" href="#init%2Ctypedesc%5BT%5D%2Cstring"
|
|
title="init[T: EcPKI](t: typedesc[T]; data: string): EcResult[T]">init[T: EcPKI](t: typedesc[T]; data: string): EcResult[T]</a></li>
|
|
|
|
</ul>
|
|
<ul class="simple nested-toc-section">initRaw
|
|
<li><a class="reference" href="#initRaw%2CEcPrivateKey%2CopenArray%5Bbyte%5D"
|
|
title="initRaw(key: var EcPrivateKey; data: openArray[byte]): bool">initRaw(key: var EcPrivateKey; data: openArray[byte]): bool</a></li>
|
|
<li><a class="reference" href="#initRaw%2CEcPublicKey%2CopenArray%5Bbyte%5D"
|
|
title="initRaw(pubkey: var EcPublicKey; data: openArray[byte]): bool">initRaw(pubkey: var EcPublicKey; data: openArray[byte]): bool</a></li>
|
|
<li><a class="reference" href="#initRaw%2CEcSignature%2CopenArray%5Bbyte%5D"
|
|
title="initRaw(sig: var EcSignature; data: openArray[byte]): bool">initRaw(sig: var EcSignature; data: openArray[byte]): bool</a></li>
|
|
<li><a class="reference" href="#initRaw%2Ctypedesc%5BEcPrivateKey%5D%2CopenArray%5Bbyte%5D"
|
|
title="initRaw(t: typedesc[EcPrivateKey]; data: openArray[byte]): EcResult[EcPrivateKey]">initRaw(t: typedesc[EcPrivateKey]; data: openArray[byte]): EcResult[EcPrivateKey]</a></li>
|
|
<li><a class="reference" href="#initRaw%2Ctypedesc%5BEcPublicKey%5D%2CopenArray%5Bbyte%5D"
|
|
title="initRaw(t: typedesc[EcPublicKey]; data: openArray[byte]): EcResult[EcPublicKey]">initRaw(t: typedesc[EcPublicKey]; data: openArray[byte]): EcResult[EcPublicKey]</a></li>
|
|
<li><a class="reference" href="#initRaw%2Ctypedesc%5BEcSignature%5D%2CopenArray%5Bbyte%5D"
|
|
title="initRaw(t: typedesc[EcSignature]; data: openArray[byte]): EcResult[EcSignature]">initRaw(t: typedesc[EcSignature]; data: openArray[byte]): EcResult[EcSignature]</a></li>
|
|
<li><a class="reference" href="#initRaw%2CT%2Cstring"
|
|
title="initRaw[T: EcPKI](sospk: var T; data: string): bool">initRaw[T: EcPKI](sospk: var T; data: string): bool</a></li>
|
|
<li><a class="reference" href="#initRaw%2Ctypedesc%5BT%5D%2Cstring"
|
|
title="initRaw[T: EcPKI](t: typedesc[T]; data: string): T">initRaw[T: EcPKI](t: typedesc[T]; data: string): T</a></li>
|
|
|
|
</ul>
|
|
<ul class="simple nested-toc-section">random
|
|
<li><a class="reference" href="#random%2Ctypedesc%5BEcKeyPair%5D%2CEcCurveKind%2CHmacDrbgContext"
|
|
title="random(T: typedesc[EcKeyPair]; kind: EcCurveKind; rng: var HmacDrbgContext): EcResult[
|
|
T]">random(T: typedesc[EcKeyPair]; kind: EcCurveKind; rng: var HmacDrbgContext): EcResult[
|
|
T]</a></li>
|
|
<li><a class="reference" href="#random%2Ctypedesc%5BEcPrivateKey%5D%2CEcCurveKind%2CHmacDrbgContext"
|
|
title="random(T: typedesc[EcPrivateKey]; kind: EcCurveKind; rng: var HmacDrbgContext): EcResult[
|
|
EcPrivateKey]">random(T: typedesc[EcPrivateKey]; kind: EcCurveKind; rng: var HmacDrbgContext): EcResult[
|
|
EcPrivateKey]</a></li>
|
|
|
|
</ul>
|
|
<ul class="simple nested-toc-section">scalarMul
|
|
<li><a class="reference" href="#scalarMul%2CEcPublicKey%2CEcPrivateKey"
|
|
title="scalarMul(pub: EcPublicKey; sec: EcPrivateKey): EcPublicKey">scalarMul(pub: EcPublicKey; sec: EcPrivateKey): EcPublicKey</a></li>
|
|
|
|
</ul>
|
|
<ul class="simple nested-toc-section">sign
|
|
<li><a class="reference" href="#sign%2CEcPrivateKey%2CopenArray%5BT%5D"
|
|
title="sign[T: byte | char](seckey: EcPrivateKey; message: openArray[T]): EcResult[
|
|
EcSignature]">sign[T: byte | char](seckey: EcPrivateKey; message: openArray[T]): EcResult[
|
|
EcSignature]</a></li>
|
|
|
|
</ul>
|
|
<ul class="simple nested-toc-section">toBytes
|
|
<li><a class="reference" href="#toBytes%2CEcPublicKey%2CopenArray%5Bbyte%5D"
|
|
title="toBytes(pubkey: EcPublicKey; data: var openArray[byte]): EcResult[int]">toBytes(pubkey: EcPublicKey; data: var openArray[byte]): EcResult[int]</a></li>
|
|
<li><a class="reference" href="#toBytes%2CEcPrivateKey%2CopenArray%5Bbyte%5D"
|
|
title="toBytes(seckey: EcPrivateKey; data: var openArray[byte]): EcResult[int]">toBytes(seckey: EcPrivateKey; data: var openArray[byte]): EcResult[int]</a></li>
|
|
<li><a class="reference" href="#toBytes%2CEcSignature%2CopenArray%5Bbyte%5D"
|
|
title="toBytes(sig: EcSignature; data: var openArray[byte]): EcResult[int]">toBytes(sig: EcSignature; data: var openArray[byte]): EcResult[int]</a></li>
|
|
|
|
</ul>
|
|
<ul class="simple nested-toc-section">toRawBytes
|
|
<li><a class="reference" href="#toRawBytes%2CEcPublicKey%2CopenArray%5Bbyte%5D"
|
|
title="toRawBytes(pubkey: EcPublicKey; data: var openArray[byte]): EcResult[int]">toRawBytes(pubkey: EcPublicKey; data: var openArray[byte]): EcResult[int]</a></li>
|
|
<li><a class="reference" href="#toRawBytes%2CEcPrivateKey%2CopenArray%5Bbyte%5D"
|
|
title="toRawBytes(seckey: EcPrivateKey; data: var openArray[byte]): EcResult[int]">toRawBytes(seckey: EcPrivateKey; data: var openArray[byte]): EcResult[int]</a></li>
|
|
<li><a class="reference" href="#toRawBytes%2CEcSignature%2CopenArray%5Bbyte%5D"
|
|
title="toRawBytes(sig: EcSignature; data: var openArray[byte]): int">toRawBytes(sig: EcSignature; data: var openArray[byte]): int</a></li>
|
|
|
|
</ul>
|
|
<ul class="simple nested-toc-section">toSecret
|
|
<li><a class="reference" href="#toSecret%2CEcPublicKey%2CEcPrivateKey%2CopenArray%5Bbyte%5D"
|
|
title="toSecret(pubkey: EcPublicKey; seckey: EcPrivateKey; data: var openArray[byte]): int">toSecret(pubkey: EcPublicKey; seckey: EcPrivateKey; data: var openArray[byte]): int</a></li>
|
|
|
|
</ul>
|
|
<ul class="simple nested-toc-section">verify
|
|
<li><a class="reference" href="#verify%2CEcSignature%2CopenArray%5BT%5D%2CEcPublicKey"
|
|
title="verify[T: byte | char](sig: EcSignature; message: openArray[T];
|
|
pubkey: EcPublicKey): bool">verify[T: byte | char](sig: EcSignature; message: openArray[T];
|
|
pubkey: EcPublicKey): bool</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">getPrivateKeyLength
|
|
<li><a class="reference" href="#getPrivateKeyLength.t%2CEcCurveKind"
|
|
title="getPrivateKeyLength(curve: EcCurveKind): int">getPrivateKeyLength(curve: EcCurveKind): int</a></li>
|
|
|
|
</ul>
|
|
<ul class="simple nested-toc-section">getPublicKeyLength
|
|
<li><a class="reference" href="#getPublicKeyLength.t%2CEcCurveKind"
|
|
title="getPublicKeyLength(curve: EcCurveKind): int">getPublicKeyLength(curve: EcCurveKind): int</a></li>
|
|
|
|
</ul>
|
|
|
|
</ul>
|
|
</li>
|
|
<li>
|
|
<a class="reference reference-toplevel" href="#19" id="69">Exports</a>
|
|
<ul class="simple simple-toc-section">
|
|
|
|
</ul>
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</div>
|
|
<a
|
|
href="https://github.com/status-im/nim-libp2p/tree/yamux-over-dcutr/libp2p/crypto/ecnist.nim#L1"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/ecnist.nim#L1" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
<div class="nine columns" id="content">
|
|
<div id="tocRoot"></div>
|
|
|
|
<p class="module-desc"><p>This module implements constant-time ECDSA and ECDHE for NIST elliptic curves secp256r1, secp384r1 and secp521r1.</p>
|
|
<p>This module uses unmodified parts of code from BearSSL library <<a class="reference external" href="https://bearssl.org/">https://bearssl.org/</a>> Copyright(C) 2018 Thomas Pornin <pornin@bolet.org>.</p>
|
|
</p>
|
|
<div class="section" id="6">
|
|
<h1><a class="toc-backref" href="#6">Imports</a></h1>
|
|
<dl class="item">
|
|
<a class="reference external" href="minasn1.html">minasn1</a>, <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="EcCurveKind" class="tohide">
|
|
<dt><pre><a href="ecnist.html#EcCurveKind"><span class="Identifier">EcCurveKind</span></a> <span class="Other">=</span> <span class="Keyword">enum</span>
|
|
<span class="Identifier">Secp256r1</span> <span class="Other">=</span> <span class="DecNumber">23</span><span class="Other">,</span> <span class="Identifier">Secp384r1</span> <span class="Other">=</span> <span class="DecNumber">24</span><span class="Other">,</span> <span class="Identifier">Secp521r1</span> <span class="Other">=</span> <span class="DecNumber">25</span></pre></dt>
|
|
<dd>
|
|
|
|
|
|
<a
|
|
href="https://github.com/status-im/nim-libp2p/tree/yamux-over-dcutr/libp2p/crypto/ecnist.nim#L60"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/ecnist.nim#L60" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="ECDHEScheme" class="tohide">
|
|
<dt><pre><a href="ecnist.html#ECDHEScheme"><span class="Identifier">ECDHEScheme</span></a> <span class="Other">=</span> <a href="ecnist.html#EcCurveKind"><span class="Identifier">EcCurveKind</span></a></pre></dt>
|
|
<dd>
|
|
|
|
|
|
<a
|
|
href="https://github.com/status-im/nim-libp2p/tree/yamux-over-dcutr/libp2p/crypto/ecnist.nim#L998"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/ecnist.nim#L998" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="EcError" class="tohide">
|
|
<dt><pre><a href="ecnist.html#EcError"><span class="Identifier">EcError</span></a> <span class="Other">=</span> <span class="Keyword">enum</span>
|
|
<span class="Identifier">EcRngError</span><span class="Other">,</span> <span class="Identifier">EcKeyGenError</span><span class="Other">,</span> <span class="Identifier">EcPublicKeyError</span><span class="Other">,</span> <span class="Identifier">EcKeyIncorrectError</span><span class="Other">,</span>
|
|
<span class="Identifier">EcSignatureError</span></pre></dt>
|
|
<dd>
|
|
|
|
|
|
<a
|
|
href="https://github.com/status-im/nim-libp2p/tree/yamux-over-dcutr/libp2p/crypto/ecnist.nim#L67"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/ecnist.nim#L67" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="EcKeyPair" class="tohide">
|
|
<dt><pre><a href="ecnist.html#EcKeyPair"><span class="Identifier">EcKeyPair</span></a> <span class="Other">=</span> <span class="Keyword">object</span>
|
|
<span class="Identifier">seckey</span><span class="Operator">*</span><span class="Other">:</span> <a href="ecnist.html#EcPrivateKey"><span class="Identifier">EcPrivateKey</span></a>
|
|
<span class="Identifier">pubkey</span><span class="Operator">*</span><span class="Other">:</span> <a href="ecnist.html#EcPublicKey"><span class="Identifier">EcPublicKey</span></a>
|
|
</pre></dt>
|
|
<dd>
|
|
|
|
|
|
<a
|
|
href="https://github.com/status-im/nim-libp2p/tree/yamux-over-dcutr/libp2p/crypto/ecnist.nim#L53"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/ecnist.nim#L53" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="EcPKI" class="tohide">
|
|
<dt><pre><a href="ecnist.html#EcPKI"><span class="Identifier">EcPKI</span></a> <span class="Other">=</span> <a href="ecnist.html#EcPrivateKey"><span class="Identifier">EcPrivateKey</span></a> <span class="Operator">|</span> <a href="ecnist.html#EcPublicKey"><span class="Identifier">EcPublicKey</span></a> <span class="Operator">|</span> <a href="ecnist.html#EcSignature"><span class="Identifier">EcSignature</span></a></pre></dt>
|
|
<dd>
|
|
|
|
|
|
<a
|
|
href="https://github.com/status-im/nim-libp2p/tree/yamux-over-dcutr/libp2p/crypto/ecnist.nim#L65"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/ecnist.nim#L65" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="EcPrivateKey" class="tohide">
|
|
<dt><pre><a href="ecnist.html#EcPrivateKey"><span class="Identifier">EcPrivateKey</span></a> <span class="Other">=</span> <span class="Keyword">ref</span> <span class="Keyword">object</span>
|
|
<span class="Identifier">buffer</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">array</span><span class="Other">[</span><span class="Identifier">EC_KBUF_PRIV_MAX_SIZE</span><span class="Other">,</span> <span class="Identifier">byte</span><span class="Other">]</span>
|
|
<span class="Identifier">key</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">ec</span><span class="Other">.</span><span class="Identifier">EcPrivateKey</span>
|
|
</pre></dt>
|
|
<dd>
|
|
|
|
|
|
<a
|
|
href="https://github.com/status-im/nim-libp2p/tree/yamux-over-dcutr/libp2p/crypto/ecnist.nim#L45"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/ecnist.nim#L45" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="EcPublicKey" class="tohide">
|
|
<dt><pre><a href="ecnist.html#EcPublicKey"><span class="Identifier">EcPublicKey</span></a> <span class="Other">=</span> <span class="Keyword">ref</span> <span class="Keyword">object</span>
|
|
<span class="Identifier">buffer</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">array</span><span class="Other">[</span><span class="Identifier">EC_KBUF_PUB_MAX_SIZE</span><span class="Other">,</span> <span class="Identifier">byte</span><span class="Other">]</span>
|
|
<span class="Identifier">key</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">ec</span><span class="Other">.</span><span class="Identifier">EcPublicKey</span>
|
|
</pre></dt>
|
|
<dd>
|
|
|
|
|
|
<a
|
|
href="https://github.com/status-im/nim-libp2p/tree/yamux-over-dcutr/libp2p/crypto/ecnist.nim#L49"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/ecnist.nim#L49" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="EcResult" class="tohide">
|
|
<dt><pre><a href="ecnist.html#EcResult"><span class="Identifier">EcResult</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="ecnist.html#EcError"><span class="Identifier">EcError</span></a><span class="Other">]</span></pre></dt>
|
|
<dd>
|
|
|
|
|
|
<a
|
|
href="https://github.com/status-im/nim-libp2p/tree/yamux-over-dcutr/libp2p/crypto/ecnist.nim#L74"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/ecnist.nim#L74" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="EcSignature" class="tohide">
|
|
<dt><pre><a href="ecnist.html#EcSignature"><span class="Identifier">EcSignature</span></a> <span class="Other">=</span> <span class="Keyword">ref</span> <span class="Keyword">object</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>
|
|
</pre></dt>
|
|
<dd>
|
|
|
|
|
|
<a
|
|
href="https://github.com/status-im/nim-libp2p/tree/yamux-over-dcutr/libp2p/crypto/ecnist.nim#L57"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/ecnist.nim#L57" 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="EcSupportedCurvesCint" class="tohide">
|
|
<dt><pre><a href="ecnist.html#EcSupportedCurvesCint"><span class="Identifier">EcSupportedCurvesCint</span></a> <span class="Other">=</span> <span class="Other">[</span><span class="DecNumber">23</span><span class="Other">,</span> <span class="DecNumber">24</span><span class="Other">,</span> <span class="DecNumber">25</span><span class="Other">]</span></pre></dt>
|
|
<dd>
|
|
|
|
|
|
<a
|
|
href="https://github.com/status-im/nim-libp2p/tree/yamux-over-dcutr/libp2p/crypto/ecnist.nim#L77"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/ecnist.nim#L77" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="PubKey256Length" class="tohide">
|
|
<dt><pre><a href="ecnist.html#PubKey256Length"><span class="Identifier">PubKey256Length</span></a> <span class="Other">=</span> <span class="DecNumber">65</span></pre></dt>
|
|
<dd>
|
|
|
|
|
|
<a
|
|
href="https://github.com/status-im/nim-libp2p/tree/yamux-over-dcutr/libp2p/crypto/ecnist.nim#L31"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/ecnist.nim#L31" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="PubKey384Length" class="tohide">
|
|
<dt><pre><a href="ecnist.html#PubKey384Length"><span class="Identifier">PubKey384Length</span></a> <span class="Other">=</span> <span class="DecNumber">97</span></pre></dt>
|
|
<dd>
|
|
|
|
|
|
<a
|
|
href="https://github.com/status-im/nim-libp2p/tree/yamux-over-dcutr/libp2p/crypto/ecnist.nim#L32"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/ecnist.nim#L32" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="PubKey521Length" class="tohide">
|
|
<dt><pre><a href="ecnist.html#PubKey521Length"><span class="Identifier">PubKey521Length</span></a> <span class="Other">=</span> <span class="DecNumber">133</span></pre></dt>
|
|
<dd>
|
|
|
|
|
|
<a
|
|
href="https://github.com/status-im/nim-libp2p/tree/yamux-over-dcutr/libp2p/crypto/ecnist.nim#L33"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/ecnist.nim#L33" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="SecKey256Length" class="tohide">
|
|
<dt><pre><a href="ecnist.html#SecKey256Length"><span class="Identifier">SecKey256Length</span></a> <span class="Other">=</span> <span class="DecNumber">32</span></pre></dt>
|
|
<dd>
|
|
|
|
|
|
<a
|
|
href="https://github.com/status-im/nim-libp2p/tree/yamux-over-dcutr/libp2p/crypto/ecnist.nim#L34"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/ecnist.nim#L34" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="SecKey384Length" class="tohide">
|
|
<dt><pre><a href="ecnist.html#SecKey384Length"><span class="Identifier">SecKey384Length</span></a> <span class="Other">=</span> <span class="DecNumber">48</span></pre></dt>
|
|
<dd>
|
|
|
|
|
|
<a
|
|
href="https://github.com/status-im/nim-libp2p/tree/yamux-over-dcutr/libp2p/crypto/ecnist.nim#L35"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/ecnist.nim#L35" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="SecKey521Length" class="tohide">
|
|
<dt><pre><a href="ecnist.html#SecKey521Length"><span class="Identifier">SecKey521Length</span></a> <span class="Other">=</span> <span class="DecNumber">66</span></pre></dt>
|
|
<dd>
|
|
|
|
|
|
<a
|
|
href="https://github.com/status-im/nim-libp2p/tree/yamux-over-dcutr/libp2p/crypto/ecnist.nim#L36"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/ecnist.nim#L36" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="Secret256Length" class="tohide">
|
|
<dt><pre><a href="ecnist.html#Secret256Length"><span class="Identifier">Secret256Length</span></a> <span class="Other">=</span> <span class="DecNumber">32</span></pre></dt>
|
|
<dd>
|
|
|
|
|
|
<a
|
|
href="https://github.com/status-im/nim-libp2p/tree/yamux-over-dcutr/libp2p/crypto/ecnist.nim#L40"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/ecnist.nim#L40" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="Secret384Length" class="tohide">
|
|
<dt><pre><a href="ecnist.html#Secret384Length"><span class="Identifier">Secret384Length</span></a> <span class="Other">=</span> <span class="DecNumber">48</span></pre></dt>
|
|
<dd>
|
|
|
|
|
|
<a
|
|
href="https://github.com/status-im/nim-libp2p/tree/yamux-over-dcutr/libp2p/crypto/ecnist.nim#L41"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/ecnist.nim#L41" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="Secret521Length" class="tohide">
|
|
<dt><pre><a href="ecnist.html#Secret521Length"><span class="Identifier">Secret521Length</span></a> <span class="Other">=</span> <span class="DecNumber">66</span></pre></dt>
|
|
<dd>
|
|
|
|
|
|
<a
|
|
href="https://github.com/status-im/nim-libp2p/tree/yamux-over-dcutr/libp2p/crypto/ecnist.nim#L42"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/ecnist.nim#L42" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="Sig256Length" class="tohide">
|
|
<dt><pre><a href="ecnist.html#Sig256Length"><span class="Identifier">Sig256Length</span></a> <span class="Other">=</span> <span class="DecNumber">64</span></pre></dt>
|
|
<dd>
|
|
|
|
|
|
<a
|
|
href="https://github.com/status-im/nim-libp2p/tree/yamux-over-dcutr/libp2p/crypto/ecnist.nim#L37"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/ecnist.nim#L37" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="Sig384Length" class="tohide">
|
|
<dt><pre><a href="ecnist.html#Sig384Length"><span class="Identifier">Sig384Length</span></a> <span class="Other">=</span> <span class="DecNumber">96</span></pre></dt>
|
|
<dd>
|
|
|
|
|
|
<a
|
|
href="https://github.com/status-im/nim-libp2p/tree/yamux-over-dcutr/libp2p/crypto/ecnist.nim#L38"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/ecnist.nim#L38" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="Sig521Length" class="tohide">
|
|
<dt><pre><a href="ecnist.html#Sig521Length"><span class="Identifier">Sig521Length</span></a> <span class="Other">=</span> <span class="DecNumber">132</span></pre></dt>
|
|
<dd>
|
|
|
|
|
|
<a
|
|
href="https://github.com/status-im/nim-libp2p/tree/yamux-over-dcutr/libp2p/crypto/ecnist.nim#L39"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/ecnist.nim#L39" 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="$,EcPublicKey" class="tohide">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#%24%2CEcPublicKey"><span class="Identifier">`$`</span></a><span class="Other">(</span><span class="Identifier">pubkey</span><span class="Other">:</span> <a href="ecnist.html#EcPublicKey"><span class="Identifier">EcPublicKey</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 EC public key.
|
|
<a
|
|
href="https://github.com/status-im/nim-libp2p/tree/yamux-over-dcutr/libp2p/crypto/ecnist.nim#L298"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/ecnist.nim#L298" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="$,EcPrivateKey" class="tohide">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#%24%2CEcPrivateKey"><span class="Identifier">`$`</span></a><span class="Other">(</span><span class="Identifier">seckey</span><span class="Other">:</span> <a href="ecnist.html#EcPrivateKey"><span class="Identifier">EcPrivateKey</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 EC private key.
|
|
<a
|
|
href="https://github.com/status-im/nim-libp2p/tree/yamux-over-dcutr/libp2p/crypto/ecnist.nim#L282"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/ecnist.nim#L282" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="$,EcSignature" class="tohide">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#%24%2CEcSignature"><span class="Identifier">`$`</span></a><span class="Other">(</span><span class="Identifier">sig</span><span class="Other">:</span> <a href="ecnist.html#EcSignature"><span class="Identifier">EcSignature</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 hexadecimal string representation of EC signature.
|
|
<a
|
|
href="https://github.com/status-im/nim-libp2p/tree/yamux-over-dcutr/libp2p/crypto/ecnist.nim#L314"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/ecnist.nim#L314" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="==,EcSignature,EcSignature" class="tohide">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#%3D%3D%2CEcSignature%2CEcSignature"><span class="Identifier">`==`</span></a><span class="Other">(</span><span class="Identifier">a</span><span class="Other">,</span> <span class="Identifier">b</span><span class="Other">:</span> <a href="ecnist.html#EcSignature"><span class="Identifier">EcSignature</span></a><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>
|
|
|
|
Return <tt class="docutils literal"><span class="pre">true</span></tt> if both signatures <tt class="docutils literal"><span class="pre">sig1</span></tt> and <tt class="docutils literal"><span class="pre">sig2</span></tt> are equal.
|
|
<a
|
|
href="https://github.com/status-im/nim-libp2p/tree/yamux-over-dcutr/libp2p/crypto/ecnist.nim#L576"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/ecnist.nim#L576" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="==,EcPublicKey,EcPublicKey" class="tohide">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#%3D%3D%2CEcPublicKey%2CEcPublicKey"><span class="Identifier">`==`</span></a><span class="Other">(</span><span class="Identifier">pubkey1</span><span class="Other">,</span> <span class="Identifier">pubkey2</span><span class="Other">:</span> <a href="ecnist.html#EcPublicKey"><span class="Identifier">EcPublicKey</span></a><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>
|
|
|
|
Returns <tt class="docutils literal"><span class="pre">true</span></tt> if both keys <tt class="docutils literal"><span class="pre">pubkey1</span></tt> and <tt class="docutils literal"><span class="pre">pubkey2</span></tt> are equal.
|
|
<a
|
|
href="https://github.com/status-im/nim-libp2p/tree/yamux-over-dcutr/libp2p/crypto/ecnist.nim#L536"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/ecnist.nim#L536" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="==,EcPrivateKey,EcPrivateKey" class="tohide">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#%3D%3D%2CEcPrivateKey%2CEcPrivateKey"><span class="Identifier">`==`</span></a><span class="Other">(</span><span class="Identifier">seckey1</span><span class="Other">,</span> <span class="Identifier">seckey2</span><span class="Other">:</span> <a href="ecnist.html#EcPrivateKey"><span class="Identifier">EcPrivateKey</span></a><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>
|
|
|
|
Returns <tt class="docutils literal"><span class="pre">true</span></tt> if both keys <tt class="docutils literal"><span class="pre">seckey1</span></tt> and <tt class="docutils literal"><span class="pre">seckey2</span></tt> are equal.
|
|
<a
|
|
href="https://github.com/status-im/nim-libp2p/tree/yamux-over-dcutr/libp2p/crypto/ecnist.nim#L556"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/ecnist.nim#L556" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="clear,T" class="tohide">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#clear%2CT"><span class="Identifier">clear</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">:</span> <a href="ecnist.html#EcPKI"><span class="Identifier">EcPKI</span></a> <span class="Operator">|</span> <a href="ecnist.html#EcKeyPair"><span class="Identifier">EcKeyPair</span></a><span class="Other">]</span><span class="Other">(</span><span class="Identifier">pki</span><span class="Other">:</span> <span class="Keyword">var</span> <span class="Identifier">T</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>
|
|
|
|
Wipe and clear EC <tt class="docutils literal"><span class="pre"><span class="Identifier">private</span> <span class="Identifier">key</span></span></tt>, <tt class="docutils literal"><span class="pre"><span class="Identifier">public</span> <span class="Identifier">key</span></span></tt> or <tt class="docutils literal"><span class="pre"><span class="Identifier">signature</span></span></tt> object.
|
|
<a
|
|
href="https://github.com/status-im/nim-libp2p/tree/yamux-over-dcutr/libp2p/crypto/ecnist.nim#L204"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/ecnist.nim#L204" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="copy,T,T" class="tohide">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#copy%2CT%2CT"><span class="Identifier">copy</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">:</span> <a href="ecnist.html#EcPKI"><span class="Identifier">EcPKI</span></a><span class="Other">]</span><span class="Other">(</span><span class="Identifier">dst</span><span class="Other">:</span> <span class="Keyword">var</span> <span class="Identifier">T</span><span class="Other">;</span> <span class="Identifier">src</span><span class="Other">:</span> <span class="Identifier">T</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>.}</pre></dt>
|
|
<dd>
|
|
|
|
<p>Copy EC <tt class="docutils literal"><span class="pre"><span class="Identifier">private</span> <span class="Identifier">key</span></span></tt>, <tt class="docutils literal"><span class="pre"><span class="Identifier">public</span> <span class="Identifier">key</span></span></tt> or <tt class="docutils literal"><span class="pre"><span class="Identifier">signature</span></span></tt> <tt class="docutils literal"><span class="pre">src</span></tt> to <tt class="docutils literal"><span class="pre">dst</span></tt>.</p>
|
|
<p>Returns <tt class="docutils literal"><span class="pre">true</span></tt> on success, <tt class="docutils literal"><span class="pre">false</span></tt> otherwise.</p>
|
|
|
|
<a
|
|
href="https://github.com/status-im/nim-libp2p/tree/yamux-over-dcutr/libp2p/crypto/ecnist.nim#L164"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/ecnist.nim#L164" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="copy,T" class="tohide">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#copy%2CT"><span class="Identifier">copy</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">:</span> <a href="ecnist.html#EcPKI"><span class="Identifier">EcPKI</span></a><span class="Other">]</span><span class="Other">(</span><span class="Identifier">src</span><span class="Other">:</span> <span class="Identifier">T</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">T</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>
|
|
|
|
Returns copy of EC <tt class="docutils literal"><span class="pre"><span class="Identifier">private</span> <span class="Identifier">key</span></span></tt>, <tt class="docutils literal"><span class="pre"><span class="Identifier">public</span> <span class="Identifier">key</span></span></tt> or <tt class="docutils literal"><span class="pre"><span class="Identifier">signature</span></span></tt> object <tt class="docutils literal"><span class="pre">src</span></tt>.
|
|
<a
|
|
href="https://github.com/status-im/nim-libp2p/tree/yamux-over-dcutr/libp2p/crypto/ecnist.nim#L198"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/ecnist.nim#L198" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="ephemeral,EcCurveKind,HmacDrbgContext" class="tohide">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#ephemeral%2CEcCurveKind%2CHmacDrbgContext"><span class="Identifier">ephemeral</span></a><span class="Other">(</span><span class="Identifier">scheme</span><span class="Other">:</span> <a href="ecnist.html#ECDHEScheme"><span class="Identifier">ECDHEScheme</span></a><span class="Other">;</span> <span class="Identifier">rng</span><span class="Other">:</span> <span class="Keyword">var</span> <span class="Identifier">HmacDrbgContext</span><span class="Other">)</span><span class="Other">:</span> <a href="ecnist.html#EcResult"><span class="Identifier">EcResult</span></a><span class="Other">[</span>
|
|
<a href="ecnist.html#EcKeyPair"><span class="Identifier">EcKeyPair</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>
|
|
|
|
Generate ephemeral keys used to perform ECDHE.
|
|
<a
|
|
href="https://github.com/status-im/nim-libp2p/tree/yamux-over-dcutr/libp2p/crypto/ecnist.nim#L1000"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/ecnist.nim#L1000" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="ephemeral,string,HmacDrbgContext" class="tohide">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#ephemeral%2Cstring%2CHmacDrbgContext"><span class="Identifier">ephemeral</span></a><span class="Other">(</span><span class="Identifier">scheme</span><span class="Other">:</span> <span class="Identifier">string</span><span class="Other">;</span> <span class="Identifier">rng</span><span class="Other">:</span> <span class="Keyword">var</span> <span class="Identifier">HmacDrbgContext</span><span class="Other">)</span><span class="Other">:</span> <a href="ecnist.html#EcResult"><span class="Identifier">EcResult</span></a><span class="Other">[</span><a href="ecnist.html#EcKeyPair"><span class="Identifier">EcKeyPair</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>
|
|
|
|
<p>Generate ephemeral keys used to perform ECDHE using string encoding.</p>
|
|
<p>Currently supported encoding strings are P-256, P-384, P-521, if encoding string is not supported P-521 key will be generated.</p>
|
|
|
|
<a
|
|
href="https://github.com/status-im/nim-libp2p/tree/yamux-over-dcutr/libp2p/crypto/ecnist.nim#L1013"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/ecnist.nim#L1013" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="getBytes,EcPublicKey" class="tohide">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#getBytes%2CEcPublicKey"><span class="Identifier">getBytes</span></a><span class="Other">(</span><span class="Identifier">pubkey</span><span class="Other">:</span> <a href="ecnist.html#EcPublicKey"><span class="Identifier">EcPublicKey</span></a><span class="Other">)</span><span class="Other">:</span> <a href="ecnist.html#EcResult"><span class="Identifier">EcResult</span></a><span class="Other">[</span><span class="Identifier">seq</span><span class="Other">[</span><span class="Identifier">byte</span><span class="Other">]</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>
|
|
|
|
Serialize EC public key <tt class="docutils literal"><span class="pre">pubkey</span></tt> to ASN.1 DER binary form and return it.
|
|
<a
|
|
href="https://github.com/status-im/nim-libp2p/tree/yamux-over-dcutr/libp2p/crypto/ecnist.nim#L477"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/ecnist.nim#L477" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="getBytes,EcPrivateKey" class="tohide">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#getBytes%2CEcPrivateKey"><span class="Identifier">getBytes</span></a><span class="Other">(</span><span class="Identifier">seckey</span><span class="Other">:</span> <a href="ecnist.html#EcPrivateKey"><span class="Identifier">EcPrivateKey</span></a><span class="Other">)</span><span class="Other">:</span> <a href="ecnist.html#EcResult"><span class="Identifier">EcResult</span></a><span class="Other">[</span><span class="Identifier">seq</span><span class="Other">[</span><span class="Identifier">byte</span><span class="Other">]</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>
|
|
|
|
Serialize EC private key <tt class="docutils literal"><span class="pre">seckey</span></tt> to ASN.1 DER binary form and return it.
|
|
<a
|
|
href="https://github.com/status-im/nim-libp2p/tree/yamux-over-dcutr/libp2p/crypto/ecnist.nim#L464"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/ecnist.nim#L464" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="getBytes,EcSignature" class="tohide">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#getBytes%2CEcSignature"><span class="Identifier">getBytes</span></a><span class="Other">(</span><span class="Identifier">sig</span><span class="Other">:</span> <a href="ecnist.html#EcSignature"><span class="Identifier">EcSignature</span></a><span class="Other">)</span><span class="Other">:</span> <a href="ecnist.html#EcResult"><span class="Identifier">EcResult</span></a><span class="Other">[</span><span class="Identifier">seq</span><span class="Other">[</span><span class="Identifier">byte</span><span class="Other">]</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>
|
|
|
|
Serialize EC signature <tt class="docutils literal"><span class="pre">sig</span></tt> to ASN.1 DER binary form and return it.
|
|
<a
|
|
href="https://github.com/status-im/nim-libp2p/tree/yamux-over-dcutr/libp2p/crypto/ecnist.nim#L490"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/ecnist.nim#L490" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="getPublicKey,EcPrivateKey" class="tohide">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#getPublicKey%2CEcPrivateKey"><span class="Identifier">getPublicKey</span></a><span class="Other">(</span><span class="Identifier">seckey</span><span class="Other">:</span> <a href="ecnist.html#EcPrivateKey"><span class="Identifier">EcPrivateKey</span></a><span class="Other">)</span><span class="Other">:</span> <a href="ecnist.html#EcResult"><span class="Identifier">EcResult</span></a><span class="Other">[</span><a href="ecnist.html#EcPublicKey"><span class="Identifier">EcPublicKey</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>
|
|
|
|
Calculate and return EC public key from private key <tt class="docutils literal"><span class="pre">seckey</span></tt>.
|
|
<a
|
|
href="https://github.com/status-im/nim-libp2p/tree/yamux-over-dcutr/libp2p/crypto/ecnist.nim#L251"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/ecnist.nim#L251" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="getRawBytes,EcPublicKey" class="tohide">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#getRawBytes%2CEcPublicKey"><span class="Identifier">getRawBytes</span></a><span class="Other">(</span><span class="Identifier">pubkey</span><span class="Other">:</span> <a href="ecnist.html#EcPublicKey"><span class="Identifier">EcPublicKey</span></a><span class="Other">)</span><span class="Other">:</span> <a href="ecnist.html#EcResult"><span class="Identifier">EcResult</span></a><span class="Other">[</span><span class="Identifier">seq</span><span class="Other">[</span><span class="Identifier">byte</span><span class="Other">]</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>
|
|
|
|
Serialize EC public key <tt class="docutils literal"><span class="pre">pubkey</span></tt> to raw binary form and return it.
|
|
<a
|
|
href="https://github.com/status-im/nim-libp2p/tree/yamux-over-dcutr/libp2p/crypto/ecnist.nim#L513"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/ecnist.nim#L513" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="getRawBytes,EcPrivateKey" class="tohide">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#getRawBytes%2CEcPrivateKey"><span class="Identifier">getRawBytes</span></a><span class="Other">(</span><span class="Identifier">seckey</span><span class="Other">:</span> <a href="ecnist.html#EcPrivateKey"><span class="Identifier">EcPrivateKey</span></a><span class="Other">)</span><span class="Other">:</span> <a href="ecnist.html#EcResult"><span class="Identifier">EcResult</span></a><span class="Other">[</span><span class="Identifier">seq</span><span class="Other">[</span><span class="Identifier">byte</span><span class="Other">]</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>
|
|
|
|
Serialize EC private key <tt class="docutils literal"><span class="pre">seckey</span></tt> to raw binary form and return it.
|
|
<a
|
|
href="https://github.com/status-im/nim-libp2p/tree/yamux-over-dcutr/libp2p/crypto/ecnist.nim#L500"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/ecnist.nim#L500" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="getRawBytes,EcSignature" class="tohide">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#getRawBytes%2CEcSignature"><span class="Identifier">getRawBytes</span></a><span class="Other">(</span><span class="Identifier">sig</span><span class="Other">:</span> <a href="ecnist.html#EcSignature"><span class="Identifier">EcSignature</span></a><span class="Other">)</span><span class="Other">:</span> <a href="ecnist.html#EcResult"><span class="Identifier">EcResult</span></a><span class="Other">[</span><span class="Identifier">seq</span><span class="Other">[</span><span class="Identifier">byte</span><span class="Other">]</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>
|
|
|
|
Serialize EC signature <tt class="docutils literal"><span class="pre">sig</span></tt> to raw binary form and return it.
|
|
<a
|
|
href="https://github.com/status-im/nim-libp2p/tree/yamux-over-dcutr/libp2p/crypto/ecnist.nim#L526"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/ecnist.nim#L526" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="getSecret,EcPublicKey,EcPrivateKey" class="tohide">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#getSecret%2CEcPublicKey%2CEcPrivateKey"><span class="Identifier">getSecret</span></a><span class="Other">(</span><span class="Identifier">pubkey</span><span class="Other">:</span> <a href="ecnist.html#EcPublicKey"><span class="Identifier">EcPublicKey</span></a><span class="Other">;</span> <span class="Identifier">seckey</span><span class="Other">:</span> <a href="ecnist.html#EcPrivateKey"><span class="Identifier">EcPrivateKey</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">seq</span><span class="Other">[</span><span class="Identifier">byte</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="Identifier">RootEffect</span><span class="Other">]</span></span>.}</pre></dt>
|
|
<dd>
|
|
|
|
<p>Calculate ECDHE shared secret using Go's elliptic curve approach, using remote public key <tt class="docutils literal"><span class="pre">pubkey</span></tt> and local private key <tt class="docutils literal"><span class="pre">seckey</span></tt> and return shared secret.</p>
|
|
<p>If error happens length of result array will be <tt class="docutils literal"><span class="pre">0</span></tt>.</p>
|
|
|
|
<a
|
|
href="https://github.com/status-im/nim-libp2p/tree/yamux-over-dcutr/libp2p/crypto/ecnist.nim#L929"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/ecnist.nim#L929" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="init,EcPrivateKey,openArray[byte]" class="tohide">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#init%2CEcPrivateKey%2CopenArray%5Bbyte%5D"><span class="Identifier">init</span></a><span class="Other">(</span><span class="Identifier">key</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="ecnist.html#EcPrivateKey"><span class="Identifier">EcPrivateKey</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">Result</span><span class="Other">[</span><span class="Identifier">void</span><span class="Other">,</span> <a href="minasn1.html#Asn1Error"><span class="Identifier">Asn1Error</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="Identifier">RootEffect</span><span class="Other">]</span></span>.}</pre></dt>
|
|
<dd>
|
|
|
|
<p>Initialize EC <tt class="docutils literal"><span class="pre"><span class="Identifier">private</span> <span class="Identifier">key</span></span></tt> or <tt class="docutils literal"><span class="pre"><span class="Identifier">signature</span></span></tt> <tt class="docutils literal"><span class="pre">key</span></tt> from ASN.1 DER binary representation <tt class="docutils literal"><span class="pre">data</span></tt>.</p>
|
|
<p>Procedure returns <tt class="docutils literal"><span class="pre">Result[void, Asn1Error]</span></tt>.</p>
|
|
|
|
<a
|
|
href="https://github.com/status-im/nim-libp2p/tree/yamux-over-dcutr/libp2p/crypto/ecnist.nim#L598"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/ecnist.nim#L598" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="init,EcPublicKey,openArray[byte]" class="tohide">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#init%2CEcPublicKey%2CopenArray%5Bbyte%5D"><span class="Identifier">init</span></a><span class="Other">(</span><span class="Identifier">pubkey</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="ecnist.html#EcPublicKey"><span class="Identifier">EcPublicKey</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">Result</span><span class="Other">[</span><span class="Identifier">void</span><span class="Other">,</span>
|
|
<a href="minasn1.html#Asn1Error"><span class="Identifier">Asn1Error</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="Identifier">RootEffect</span><span class="Other">]</span></span>.}</pre></dt>
|
|
<dd>
|
|
|
|
<p>Initialize EC public key <tt class="docutils literal"><span class="pre">pubkey</span></tt> from ASN.1 DER binary representation <tt class="docutils literal"><span class="pre">data</span></tt>.</p>
|
|
<p>Procedure returns <tt class="docutils literal"><span class="pre">Result[void, Asn1Error]</span></tt>.</p>
|
|
|
|
<a
|
|
href="https://github.com/status-im/nim-libp2p/tree/yamux-over-dcutr/libp2p/crypto/ecnist.nim#L651"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/ecnist.nim#L651" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="init,EcSignature,openArray[byte]" class="tohide">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#init%2CEcSignature%2CopenArray%5Bbyte%5D"><span class="Identifier">init</span></a><span class="Other">(</span><span class="Identifier">sig</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="ecnist.html#EcSignature"><span class="Identifier">EcSignature</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">Result</span><span class="Other">[</span><span class="Identifier">void</span><span class="Other">,</span> <a href="minasn1.html#Asn1Error"><span class="Identifier">Asn1Error</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>
|
|
|
|
<p>Initialize EC signature <tt class="docutils literal"><span class="pre">sig</span></tt> from raw binary representation <tt class="docutils literal"><span class="pre">data</span></tt>.</p>
|
|
<p>Procedure returns <tt class="docutils literal"><span class="pre">Result[void, Asn1Error]</span></tt>.</p>
|
|
|
|
<a
|
|
href="https://github.com/status-im/nim-libp2p/tree/yamux-over-dcutr/libp2p/crypto/ecnist.nim#L710"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/ecnist.nim#L710" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="init,typedesc[EcPrivateKey],openArray[byte]" class="tohide">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#init%2Ctypedesc%5BEcPrivateKey%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="ecnist.html#EcPrivateKey"><span class="Identifier">EcPrivateKey</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="ecnist.html#EcResult"><span class="Identifier">EcResult</span></a><span class="Other">[</span>
|
|
<a href="ecnist.html#EcPrivateKey"><span class="Identifier">EcPrivateKey</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>
|
|
|
|
Initialize EC private key from ASN.1 DER binary representation <tt class="docutils literal"><span class="pre">data</span></tt> and return constructed object.
|
|
<a
|
|
href="https://github.com/status-im/nim-libp2p/tree/yamux-over-dcutr/libp2p/crypto/ecnist.nim#L729"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/ecnist.nim#L729" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="init,typedesc[EcPublicKey],openArray[byte]" class="tohide">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#init%2Ctypedesc%5BEcPublicKey%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="ecnist.html#EcPublicKey"><span class="Identifier">EcPublicKey</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="ecnist.html#EcResult"><span class="Identifier">EcResult</span></a><span class="Other">[</span><a href="ecnist.html#EcPublicKey"><span class="Identifier">EcPublicKey</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>
|
|
|
|
Initialize EC public key from ASN.1 DER binary representation <tt class="docutils literal"><span class="pre">data</span></tt> and return constructed object.
|
|
<a
|
|
href="https://github.com/status-im/nim-libp2p/tree/yamux-over-dcutr/libp2p/crypto/ecnist.nim#L740"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/ecnist.nim#L740" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="init,typedesc[EcSignature],openArray[byte]" class="tohide">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#init%2Ctypedesc%5BEcSignature%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="ecnist.html#EcSignature"><span class="Identifier">EcSignature</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="ecnist.html#EcResult"><span class="Identifier">EcResult</span></a><span class="Other">[</span><a href="ecnist.html#EcSignature"><span class="Identifier">EcSignature</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>
|
|
|
|
Initialize EC signature from raw binary representation <tt class="docutils literal"><span class="pre">data</span></tt> and return constructed object.
|
|
<a
|
|
href="https://github.com/status-im/nim-libp2p/tree/yamux-over-dcutr/libp2p/crypto/ecnist.nim#L751"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/ecnist.nim#L751" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="init,T,string" class="tohide">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#init%2CT%2Cstring"><span class="Identifier">init</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">:</span> <a href="ecnist.html#EcPKI"><span class="Identifier">EcPKI</span></a><span class="Other">]</span><span class="Other">(</span><span class="Identifier">sospk</span><span class="Other">:</span> <span class="Keyword">var</span> <span class="Identifier">T</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> <span class="Identifier">Result</span><span class="Other">[</span><span class="Identifier">void</span><span class="Other">,</span> <a href="minasn1.html#Asn1Error"><span class="Identifier">Asn1Error</span></a><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>
|
|
|
|
<p>Initialize EC <tt class="docutils literal"><span class="pre"><span class="Identifier">private</span> <span class="Identifier">key</span></span></tt>, <tt class="docutils literal"><span class="pre"><span class="Identifier">public</span> <span class="Identifier">key</span></span></tt> or <tt class="docutils literal"><span class="pre"><span class="Identifier">signature</span></span></tt> <tt class="docutils literal"><span class="pre">sospk</span></tt> from ASN.1 DER hexadecimal string representation <tt class="docutils literal"><span class="pre">data</span></tt>.</p>
|
|
<p>Procedure returns <tt class="docutils literal"><span class="pre">Asn1Status</span></tt>.</p>
|
|
|
|
<a
|
|
href="https://github.com/status-im/nim-libp2p/tree/yamux-over-dcutr/libp2p/crypto/ecnist.nim#L721"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/ecnist.nim#L721" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="init,typedesc[T],string" class="tohide">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#init%2Ctypedesc%5BT%5D%2Cstring"><span class="Identifier">init</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">:</span> <a href="ecnist.html#EcPKI"><span class="Identifier">EcPKI</span></a><span class="Other">]</span><span class="Other">(</span><span class="Identifier">t</span><span class="Other">:</span> <span class="Identifier">typedesc</span><span class="Other">[</span><span class="Identifier">T</span><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="ecnist.html#EcResult"><span class="Identifier">EcResult</span></a><span class="Other">[</span><span class="Identifier">T</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>
|
|
|
|
Initialize EC <tt class="docutils literal"><span class="pre"><span class="Identifier">private</span> <span class="Identifier">key</span></span></tt>, <tt class="docutils literal"><span class="pre"><span class="Identifier">public</span> <span class="Identifier">key</span></span></tt> or <tt class="docutils literal"><span class="pre"><span class="Identifier">signature</span></span></tt> from hexadecimal string representation <tt class="docutils literal"><span class="pre">data</span></tt> and return constructed object.
|
|
<a
|
|
href="https://github.com/status-im/nim-libp2p/tree/yamux-over-dcutr/libp2p/crypto/ecnist.nim#L762"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/ecnist.nim#L762" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="initRaw,EcPrivateKey,openArray[byte]" class="tohide">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#initRaw%2CEcPrivateKey%2CopenArray%5Bbyte%5D"><span class="Identifier">initRaw</span></a><span class="Other">(</span><span class="Identifier">key</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="ecnist.html#EcPrivateKey"><span class="Identifier">EcPrivateKey</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="Identifier">RootEffect</span><span class="Other">]</span></span>.}</pre></dt>
|
|
<dd>
|
|
|
|
<p>Initialize EC <tt class="docutils literal"><span class="pre"><span class="Identifier">private</span> <span class="Identifier">key</span></span></tt> or <tt class="docutils literal"><span class="pre"><span class="Identifier">scalar</span></span></tt> <tt class="docutils literal"><span class="pre">key</span></tt> from raw binary representation <tt class="docutils literal"><span class="pre">data</span></tt>.</p>
|
|
<p>Length of <tt class="docutils literal"><span class="pre">data</span></tt> array must be <tt class="docutils literal"><span class="pre">SecKey256Length</span></tt>, <tt class="docutils literal"><span class="pre">SecKey384Length</span></tt> or <tt class="docutils literal"><span class="pre">SecKey521Length</span></tt>.</p>
|
|
<p>Procedure returns <tt class="docutils literal"><span class="pre">true</span></tt> on success, <tt class="docutils literal"><span class="pre">false</span></tt> otherwise.</p>
|
|
|
|
<a
|
|
href="https://github.com/status-im/nim-libp2p/tree/yamux-over-dcutr/libp2p/crypto/ecnist.nim#L767"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/ecnist.nim#L767" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="initRaw,EcPublicKey,openArray[byte]" class="tohide">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#initRaw%2CEcPublicKey%2CopenArray%5Bbyte%5D"><span class="Identifier">initRaw</span></a><span class="Other">(</span><span class="Identifier">pubkey</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="ecnist.html#EcPublicKey"><span class="Identifier">EcPublicKey</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="Identifier">RootEffect</span><span class="Other">]</span></span>.}</pre></dt>
|
|
<dd>
|
|
|
|
<p>Initialize EC public key <tt class="docutils literal"><span class="pre">pubkey</span></tt> from raw binary representation <tt class="docutils literal"><span class="pre">data</span></tt>.</p>
|
|
<p>Length of <tt class="docutils literal"><span class="pre">data</span></tt> array must be <tt class="docutils literal"><span class="pre">PubKey256Length</span></tt>, <tt class="docutils literal"><span class="pre">PubKey384Length</span></tt> or <tt class="docutils literal"><span class="pre">PubKey521Length</span></tt>.</p>
|
|
<p>Procedure returns <tt class="docutils literal"><span class="pre">true</span></tt> on success, <tt class="docutils literal"><span class="pre">false</span></tt> otherwise.</p>
|
|
|
|
<a
|
|
href="https://github.com/status-im/nim-libp2p/tree/yamux-over-dcutr/libp2p/crypto/ecnist.nim#L796"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/ecnist.nim#L796" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="initRaw,EcSignature,openArray[byte]" class="tohide">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#initRaw%2CEcSignature%2CopenArray%5Bbyte%5D"><span class="Identifier">initRaw</span></a><span class="Other">(</span><span class="Identifier">sig</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="ecnist.html#EcSignature"><span class="Identifier">EcSignature</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>
|
|
|
|
<p>Initialize EC signature <tt class="docutils literal"><span class="pre">sig</span></tt> from raw binary representation <tt class="docutils literal"><span class="pre">data</span></tt>.</p>
|
|
<p>Length of <tt class="docutils literal"><span class="pre">data</span></tt> array must be <tt class="docutils literal"><span class="pre">Sig256Length</span></tt>, <tt class="docutils literal"><span class="pre">Sig384Length</span></tt> or <tt class="docutils literal"><span class="pre">Sig521Length</span></tt>.</p>
|
|
<p>Procedure returns <tt class="docutils literal"><span class="pre">true</span></tt> on success, <tt class="docutils literal"><span class="pre">false</span></tt> otherwise.</p>
|
|
|
|
<a
|
|
href="https://github.com/status-im/nim-libp2p/tree/yamux-over-dcutr/libp2p/crypto/ecnist.nim#L827"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/ecnist.nim#L827" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="initRaw,typedesc[EcPrivateKey],openArray[byte]" class="tohide">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#initRaw%2Ctypedesc%5BEcPrivateKey%5D%2CopenArray%5Bbyte%5D"><span class="Identifier">initRaw</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="ecnist.html#EcPrivateKey"><span class="Identifier">EcPrivateKey</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="ecnist.html#EcResult"><span class="Identifier">EcResult</span></a><span class="Other">[</span>
|
|
<a href="ecnist.html#EcPrivateKey"><span class="Identifier">EcPrivateKey</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>
|
|
|
|
Initialize EC private key from raw binary representation <tt class="docutils literal"><span class="pre">data</span></tt> and return constructed object.
|
|
<a
|
|
href="https://github.com/status-im/nim-libp2p/tree/yamux-over-dcutr/libp2p/crypto/ecnist.nim#L849"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/ecnist.nim#L849" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="initRaw,typedesc[EcPublicKey],openArray[byte]" class="tohide">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#initRaw%2Ctypedesc%5BEcPublicKey%5D%2CopenArray%5Bbyte%5D"><span class="Identifier">initRaw</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="ecnist.html#EcPublicKey"><span class="Identifier">EcPublicKey</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="ecnist.html#EcResult"><span class="Identifier">EcResult</span></a><span class="Other">[</span>
|
|
<a href="ecnist.html#EcPublicKey"><span class="Identifier">EcPublicKey</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>
|
|
|
|
Initialize EC public key from raw binary representation <tt class="docutils literal"><span class="pre">data</span></tt> and return constructed object.
|
|
<a
|
|
href="https://github.com/status-im/nim-libp2p/tree/yamux-over-dcutr/libp2p/crypto/ecnist.nim#L859"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/ecnist.nim#L859" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="initRaw,typedesc[EcSignature],openArray[byte]" class="tohide">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#initRaw%2Ctypedesc%5BEcSignature%5D%2CopenArray%5Bbyte%5D"><span class="Identifier">initRaw</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="ecnist.html#EcSignature"><span class="Identifier">EcSignature</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="ecnist.html#EcResult"><span class="Identifier">EcResult</span></a><span class="Other">[</span>
|
|
<a href="ecnist.html#EcSignature"><span class="Identifier">EcSignature</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>
|
|
|
|
Initialize EC signature from raw binary representation <tt class="docutils literal"><span class="pre">data</span></tt> and return constructed object.
|
|
<a
|
|
href="https://github.com/status-im/nim-libp2p/tree/yamux-over-dcutr/libp2p/crypto/ecnist.nim#L869"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/ecnist.nim#L869" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="initRaw,T,string" class="tohide">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#initRaw%2CT%2Cstring"><span class="Identifier">initRaw</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">:</span> <a href="ecnist.html#EcPKI"><span class="Identifier">EcPKI</span></a><span class="Other">]</span><span class="Other">(</span><span class="Identifier">sospk</span><span class="Other">:</span> <span class="Keyword">var</span> <span class="Identifier">T</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> <span class="Identifier">bool</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>
|
|
|
|
<p>Initialize EC <tt class="docutils literal"><span class="pre"><span class="Identifier">private</span> <span class="Identifier">key</span></span></tt>, <tt class="docutils literal"><span class="pre"><span class="Identifier">public</span> <span class="Identifier">key</span></span></tt> or <tt class="docutils literal"><span class="pre"><span class="Identifier">signature</span></span></tt> <tt class="docutils literal"><span class="pre">sospk</span></tt> from raw hexadecimal string representation <tt class="docutils literal"><span class="pre">data</span></tt>.</p>
|
|
<p>Procedure returns <tt class="docutils literal"><span class="pre">true</span></tt> on success, <tt class="docutils literal"><span class="pre">false</span></tt> otherwise.</p>
|
|
|
|
<a
|
|
href="https://github.com/status-im/nim-libp2p/tree/yamux-over-dcutr/libp2p/crypto/ecnist.nim#L842"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/ecnist.nim#L842" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="initRaw,typedesc[T],string" class="tohide">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#initRaw%2Ctypedesc%5BT%5D%2Cstring"><span class="Identifier">initRaw</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">:</span> <a href="ecnist.html#EcPKI"><span class="Identifier">EcPKI</span></a><span class="Other">]</span><span class="Other">(</span><span class="Identifier">t</span><span class="Other">:</span> <span class="Identifier">typedesc</span><span class="Other">[</span><span class="Identifier">T</span><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> <span class="Identifier">T</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>
|
|
|
|
Initialize EC <tt class="docutils literal"><span class="pre"><span class="Identifier">private</span> <span class="Identifier">key</span></span></tt>, <tt class="docutils literal"><span class="pre"><span class="Identifier">public</span> <span class="Identifier">key</span></span></tt> or <tt class="docutils literal"><span class="pre"><span class="Identifier">signature</span></span></tt> from raw hexadecimal string representation <tt class="docutils literal"><span class="pre">data</span></tt> and return constructed object.
|
|
<a
|
|
href="https://github.com/status-im/nim-libp2p/tree/yamux-over-dcutr/libp2p/crypto/ecnist.nim#L879"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/ecnist.nim#L879" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="random,typedesc[EcKeyPair],EcCurveKind,HmacDrbgContext" class="tohide">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#random%2Ctypedesc%5BEcKeyPair%5D%2CEcCurveKind%2CHmacDrbgContext"><span class="Identifier">random</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="ecnist.html#EcKeyPair"><span class="Identifier">EcKeyPair</span></a><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">kind</span><span class="Other">:</span> <a href="ecnist.html#EcCurveKind"><span class="Identifier">EcCurveKind</span></a><span class="Other">;</span> <span class="Identifier">rng</span><span class="Other">:</span> <span class="Keyword">var</span> <span class="Identifier">HmacDrbgContext</span><span class="Other">)</span><span class="Other">:</span> <a href="ecnist.html#EcResult"><span class="Identifier">EcResult</span></a><span class="Other">[</span>
|
|
<span class="Identifier">T</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>Generate new random EC private and public keypair using BearSSL's HMAC-SHA256-DRBG algorithm.</p>
|
|
<p><tt class="docutils literal"><span class="pre">kind</span></tt> elliptic curve kind of your choice (secp256r1, secp384r1 or secp521r1).</p>
|
|
|
|
<a
|
|
href="https://github.com/status-im/nim-libp2p/tree/yamux-over-dcutr/libp2p/crypto/ecnist.nim#L268"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/ecnist.nim#L268" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="random,typedesc[EcPrivateKey],EcCurveKind,HmacDrbgContext" class="tohide">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#random%2Ctypedesc%5BEcPrivateKey%5D%2CEcCurveKind%2CHmacDrbgContext"><span class="Identifier">random</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="ecnist.html#EcPrivateKey"><span class="Identifier">EcPrivateKey</span></a><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">kind</span><span class="Other">:</span> <a href="ecnist.html#EcCurveKind"><span class="Identifier">EcCurveKind</span></a><span class="Other">;</span>
|
|
<span class="Identifier">rng</span><span class="Other">:</span> <span class="Keyword">var</span> <span class="Identifier">HmacDrbgContext</span><span class="Other">)</span><span class="Other">:</span> <a href="ecnist.html#EcResult"><span class="Identifier">EcResult</span></a><span class="Other">[</span><a href="ecnist.html#EcPrivateKey"><span class="Identifier">EcPrivateKey</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>Generate new random EC private key using BearSSL's HMAC-SHA256-DRBG algorithm.</p>
|
|
<p><tt class="docutils literal"><span class="pre">kind</span></tt> elliptic curve kind of your choice (secp256r1, secp384r1 or secp521r1).</p>
|
|
|
|
<a
|
|
href="https://github.com/status-im/nim-libp2p/tree/yamux-over-dcutr/libp2p/crypto/ecnist.nim#L234"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/ecnist.nim#L234" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="scalarMul,EcPublicKey,EcPrivateKey" class="tohide">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#scalarMul%2CEcPublicKey%2CEcPrivateKey"><span class="Identifier">scalarMul</span></a><span class="Other">(</span><span class="Identifier">pub</span><span class="Other">:</span> <a href="ecnist.html#EcPublicKey"><span class="Identifier">EcPublicKey</span></a><span class="Other">;</span> <span class="Identifier">sec</span><span class="Other">:</span> <a href="ecnist.html#EcPrivateKey"><span class="Identifier">EcPrivateKey</span></a><span class="Other">)</span><span class="Other">:</span> <a href="ecnist.html#EcPublicKey"><span class="Identifier">EcPublicKey</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 class="Other">,</span>
|
|
<span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">RootEffect</span><span class="Other">]</span></span>.}</pre></dt>
|
|
<dd>
|
|
|
|
<p>Return scalar multiplication of <tt class="docutils literal"><span class="pre">pub</span></tt> and <tt class="docutils literal"><span class="pre">sec</span></tt>.</p>
|
|
<p>Returns point in curve as <tt class="docutils literal"><span class="pre">pub * sec</span></tt> or <tt class="docutils literal"><span class="pre">nil</span></tt> otherwise.</p>
|
|
|
|
<a
|
|
href="https://github.com/status-im/nim-libp2p/tree/yamux-over-dcutr/libp2p/crypto/ecnist.nim#L884"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/ecnist.nim#L884" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="sign,EcPrivateKey,openArray[T]" class="tohide">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#sign%2CEcPrivateKey%2CopenArray%5BT%5D"><span class="Identifier">sign</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">:</span> <span class="Identifier">byte</span> <span class="Operator">|</span> <span class="Identifier">char</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">seckey</span><span class="Other">:</span> <a href="ecnist.html#EcPrivateKey"><span class="Identifier">EcPrivateKey</span></a><span class="Other">;</span> <span class="Identifier">message</span><span class="Other">:</span> <span class="Identifier">openArray</span><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <a href="ecnist.html#EcResult"><span class="Identifier">EcResult</span></a><span class="Other">[</span>
|
|
<a href="ecnist.html#EcSignature"><span class="Identifier">EcSignature</span></a><span class="Other">]</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">gcsafe</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
|
|
<dd>
|
|
|
|
Get ECDSA signature of data <tt class="docutils literal"><span class="pre">message</span></tt> using private key <tt class="docutils literal"><span class="pre">seckey</span></tt>.
|
|
<a
|
|
href="https://github.com/status-im/nim-libp2p/tree/yamux-over-dcutr/libp2p/crypto/ecnist.nim#L942"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/ecnist.nim#L942" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="toBytes,EcPublicKey,openArray[byte]" class="tohide">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#toBytes%2CEcPublicKey%2CopenArray%5Bbyte%5D"><span class="Identifier">toBytes</span></a><span class="Other">(</span><span class="Identifier">pubkey</span><span class="Other">:</span> <a href="ecnist.html#EcPublicKey"><span class="Identifier">EcPublicKey</span></a><span class="Other">;</span> <span class="Identifier">data</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> <a href="ecnist.html#EcResult"><span class="Identifier">EcResult</span></a><span class="Other">[</span><span class="Identifier">int</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>
|
|
|
|
<p>Serialize EC public key <tt class="docutils literal"><span class="pre">pubkey</span></tt> to ASN.1 DER binary form and store it to <tt class="docutils literal"><span class="pre">data</span></tt>.</p>
|
|
<p>Procedure returns number of bytes (octets) needed to store EC public key, or <tt class="docutils literal"><span class="pre"><span class="DecNumber">0</span></span></tt> if public key is not in supported curve.</p>
|
|
|
|
<a
|
|
href="https://github.com/status-im/nim-libp2p/tree/yamux-over-dcutr/libp2p/crypto/ecnist.nim#L414"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/ecnist.nim#L414" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="toBytes,EcPrivateKey,openArray[byte]" class="tohide">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#toBytes%2CEcPrivateKey%2CopenArray%5Bbyte%5D"><span class="Identifier">toBytes</span></a><span class="Other">(</span><span class="Identifier">seckey</span><span class="Other">:</span> <a href="ecnist.html#EcPrivateKey"><span class="Identifier">EcPrivateKey</span></a><span class="Other">;</span> <span class="Identifier">data</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> <a href="ecnist.html#EcResult"><span class="Identifier">EcResult</span></a><span class="Other">[</span><span class="Identifier">int</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>
|
|
|
|
<p>Serialize EC private key <tt class="docutils literal"><span class="pre">seckey</span></tt> to ASN.1 DER binary form and store it to <tt class="docutils literal"><span class="pre">data</span></tt>.</p>
|
|
<p>Procedure returns number of bytes (octets) needed to store EC private key, or <tt class="docutils literal"><span class="pre"><span class="DecNumber">0</span></span></tt> if private key is not in supported curve.</p>
|
|
|
|
<a
|
|
href="https://github.com/status-im/nim-libp2p/tree/yamux-over-dcutr/libp2p/crypto/ecnist.nim#L364"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/ecnist.nim#L364" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="toBytes,EcSignature,openArray[byte]" class="tohide">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#toBytes%2CEcSignature%2CopenArray%5Bbyte%5D"><span class="Identifier">toBytes</span></a><span class="Other">(</span><span class="Identifier">sig</span><span class="Other">:</span> <a href="ecnist.html#EcSignature"><span class="Identifier">EcSignature</span></a><span class="Other">;</span> <span class="Identifier">data</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> <a href="ecnist.html#EcResult"><span class="Identifier">EcResult</span></a><span class="Other">[</span><span class="Identifier">int</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>
|
|
|
|
<p>Serialize EC signature <tt class="docutils literal"><span class="pre">sig</span></tt> to ASN.1 DER binary form and store it to <tt class="docutils literal"><span class="pre">data</span></tt>.</p>
|
|
<p>Procedure returns number of bytes (octets) needed to store EC signature, or <tt class="docutils literal"><span class="pre"><span class="DecNumber">0</span></span></tt> if signature is not in supported curve.</p>
|
|
|
|
<a
|
|
href="https://github.com/status-im/nim-libp2p/tree/yamux-over-dcutr/libp2p/crypto/ecnist.nim#L451"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/ecnist.nim#L451" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="toRawBytes,EcPublicKey,openArray[byte]" class="tohide">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#toRawBytes%2CEcPublicKey%2CopenArray%5Bbyte%5D"><span class="Identifier">toRawBytes</span></a><span class="Other">(</span><span class="Identifier">pubkey</span><span class="Other">:</span> <a href="ecnist.html#EcPublicKey"><span class="Identifier">EcPublicKey</span></a><span class="Other">;</span> <span class="Identifier">data</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> <a href="ecnist.html#EcResult"><span class="Identifier">EcResult</span></a><span class="Other">[</span><span class="Identifier">int</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>
|
|
|
|
<p>Serialize EC public key <tt class="docutils literal"><span class="pre">pubkey</span></tt> to uncompressed form specified in section 4.3.6 of ANSI X9.62.</p>
|
|
<p>Returns number of bytes (octets) needed to store EC public key, or <tt class="docutils literal"><span class="pre"><span class="DecNumber">0</span></span></tt> if public key is not in supported curve.</p>
|
|
|
|
<a
|
|
href="https://github.com/status-im/nim-libp2p/tree/yamux-over-dcutr/libp2p/crypto/ecnist.nim#L337"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/ecnist.nim#L337" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="toRawBytes,EcPrivateKey,openArray[byte]" class="tohide">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#toRawBytes%2CEcPrivateKey%2CopenArray%5Bbyte%5D"><span class="Identifier">toRawBytes</span></a><span class="Other">(</span><span class="Identifier">seckey</span><span class="Other">:</span> <a href="ecnist.html#EcPrivateKey"><span class="Identifier">EcPrivateKey</span></a><span class="Other">;</span> <span class="Identifier">data</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> <a href="ecnist.html#EcResult"><span class="Identifier">EcResult</span></a><span class="Other">[</span><span class="Identifier">int</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>
|
|
|
|
<p>Serialize EC private key <tt class="docutils literal"><span class="pre">seckey</span></tt> to raw binary form and store it to <tt class="docutils literal"><span class="pre">data</span></tt>.</p>
|
|
<p>Returns number of bytes (octets) needed to store EC private key, or <tt class="docutils literal"><span class="pre"><span class="DecNumber">0</span></span></tt> if private key is not in supported curve.</p>
|
|
|
|
<a
|
|
href="https://github.com/status-im/nim-libp2p/tree/yamux-over-dcutr/libp2p/crypto/ecnist.nim#L321"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/ecnist.nim#L321" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="toRawBytes,EcSignature,openArray[byte]" class="tohide">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#toRawBytes%2CEcSignature%2CopenArray%5Bbyte%5D"><span class="Identifier">toRawBytes</span></a><span class="Other">(</span><span class="Identifier">sig</span><span class="Other">:</span> <a href="ecnist.html#EcSignature"><span class="Identifier">EcSignature</span></a><span class="Other">;</span> <span class="Identifier">data</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>Serialize EC signature <tt class="docutils literal"><span class="pre">sig</span></tt> to raw binary form and store it to <tt class="docutils literal"><span class="pre">data</span></tt>.</p>
|
|
<p>Returns number of bytes (octets) needed to store EC signature, or <tt class="docutils literal"><span class="pre"><span class="DecNumber">0</span></span></tt> if signature is not in supported curve.</p>
|
|
|
|
<a
|
|
href="https://github.com/status-im/nim-libp2p/tree/yamux-over-dcutr/libp2p/crypto/ecnist.nim#L353"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/ecnist.nim#L353" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="toSecret,EcPublicKey,EcPrivateKey,openArray[byte]" class="tohide">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#toSecret%2CEcPublicKey%2CEcPrivateKey%2CopenArray%5Bbyte%5D"><span class="Identifier">toSecret</span></a><span class="Other">(</span><span class="Identifier">pubkey</span><span class="Other">:</span> <a href="ecnist.html#EcPublicKey"><span class="Identifier">EcPublicKey</span></a><span class="Other">;</span> <span class="Identifier">seckey</span><span class="Other">:</span> <a href="ecnist.html#EcPrivateKey"><span class="Identifier">EcPrivateKey</span></a><span class="Other">;</span>
|
|
<span class="Identifier">data</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="Identifier">RootEffect</span><span class="Other">]</span></span>.}</pre></dt>
|
|
<dd>
|
|
|
|
<p>Calculate ECDHE shared secret using Go's elliptic/curve approach, using remote public key <tt class="docutils literal"><span class="pre">pubkey</span></tt> and local private key <tt class="docutils literal"><span class="pre">seckey</span></tt> and store shared secret to <tt class="docutils literal"><span class="pre">data</span></tt>.</p>
|
|
<p>Returns number of bytes (octets) needed to store shared secret, or <tt class="docutils literal"><span class="pre">0</span></tt> on error.</p>
|
|
<p><tt class="docutils literal"><span class="pre">data</span></tt> array length must be at least 32 bytes for <tt class="docutils literal"><span class="pre"><span class="Identifier">secp256r1</span></span></tt>, 48 bytes for <tt class="docutils literal"><span class="pre"><span class="Identifier">secp384r1</span></span></tt> and 66 bytes for <tt class="docutils literal"><span class="pre"><span class="Identifier">secp521r1</span></span></tt>.</p>
|
|
|
|
<a
|
|
href="https://github.com/status-im/nim-libp2p/tree/yamux-over-dcutr/libp2p/crypto/ecnist.nim#L905"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/ecnist.nim#L905" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="verify,EcSignature,openArray[T],EcPublicKey" class="tohide">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#verify%2CEcSignature%2CopenArray%5BT%5D%2CEcPublicKey"><span class="Identifier">verify</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">:</span> <span class="Identifier">byte</span> <span class="Operator">|</span> <span class="Identifier">char</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">sig</span><span class="Other">:</span> <a href="ecnist.html#EcSignature"><span class="Identifier">EcSignature</span></a><span class="Other">;</span> <span class="Identifier">message</span><span class="Other">:</span> <span class="Identifier">openArray</span><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">;</span>
|
|
<span class="Identifier">pubkey</span><span class="Other">:</span> <a href="ecnist.html#EcPublicKey"><span class="Identifier">EcPublicKey</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">bool</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>
|
|
|
|
<p>Verify ECDSA signature <tt class="docutils literal"><span class="pre">sig</span></tt> using public key <tt class="docutils literal"><span class="pre">pubkey</span></tt> and data <tt class="docutils literal"><span class="pre">message</span></tt>.</p>
|
|
<p>Return <tt class="docutils literal"><span class="pre">true</span></tt> if message verification succeeded, <tt class="docutils literal"><span class="pre">false</span></tt> if verification failed.</p>
|
|
|
|
<a
|
|
href="https://github.com/status-im/nim-libp2p/tree/yamux-over-dcutr/libp2p/crypto/ecnist.nim#L972"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/ecnist.nim#L972" 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="getPrivateKeyLength.t,EcCurveKind" class="tohide">
|
|
<dt><pre><span class="Keyword">template</span> <a href="#getPrivateKeyLength.t%2CEcCurveKind"><span class="Identifier">getPrivateKeyLength</span></a><span class="Other">(</span><span class="Identifier">curve</span><span class="Other">:</span> <a href="ecnist.html#EcCurveKind"><span class="Identifier">EcCurveKind</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">int</span></pre></dt>
|
|
<dd>
|
|
|
|
|
|
<a
|
|
href="https://github.com/status-im/nim-libp2p/tree/yamux-over-dcutr/libp2p/crypto/ecnist.nim#L155"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/ecnist.nim#L155" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="getPublicKeyLength.t,EcCurveKind" class="tohide">
|
|
<dt><pre><span class="Keyword">template</span> <a href="#getPublicKeyLength.t%2CEcCurveKind"><span class="Identifier">getPublicKeyLength</span></a><span class="Other">(</span><span class="Identifier">curve</span><span class="Other">:</span> <a href="ecnist.html#EcCurveKind"><span class="Identifier">EcCurveKind</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">int</span></pre></dt>
|
|
<dd>
|
|
|
|
|
|
<a
|
|
href="https://github.com/status-im/nim-libp2p/tree/yamux-over-dcutr/libp2p/crypto/ecnist.nim#L146"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/ecnist.nim#L146" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
|
|
</dl></div>
|
|
<div class="section" id="19">
|
|
<h1><a class="toc-backref" href="#19">Exports</a></h1>
|
|
<dl class="item">
|
|
<a href="minasn1.html#Asn1Error"><span class="Identifier">Asn1Error</span></a>
|
|
</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-22 00:02:27 UTC</small>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
</body>
|
|
</html>
|