2023-09-08 10:24:11 +00:00
<?xml version="1.0" encoding="utf-8" ?>
2023-11-16 14:59:42 +00:00
< !DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2023-09-08 10:24:11 +00:00
<!-- This file is generated by Nim. -->
2023-11-16 14:59:42 +00:00
< html xmlns = "http://www.w3.org/1999/xhtml" xml:lang = "en" lang = "en" >
2023-09-08 10:24:11 +00:00
< head >
< meta http-equiv = "Content-Type" content = "text/html; charset=utf-8" / >
2023-11-16 14:59:42 +00:00
2023-09-08 10:24:11 +00:00
< 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=" >
2023-11-16 14:59:42 +00:00
<!-- 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' / >
2023-09-08 10:24:11 +00:00
<!-- CSS -->
2023-11-16 14:59:42 +00:00
< title > libp2p/crypto/rsa< / title >
2023-09-08 10:24:11 +00:00
< link rel = "stylesheet" type = "text/css" href = "../../nimdoc.out.css" >
< script type = "text/javascript" src = "../../dochack.js" > < / script >
2023-11-16 14:59:42 +00:00
< 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 >
2023-09-08 10:24:11 +00:00
< / head >
< body >
2023-11-16 14:59:42 +00:00
< div class = "document" id = "documentId" >
< div class = "container" >
< h1 class = "title" > libp2p/crypto/rsa< / h1 >
< div class = "row" >
2023-09-08 10:24:11 +00:00
< div class = "three columns" >
2023-11-16 14:59:42 +00:00
< 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" >
2023-09-08 10:24:11 +00:00
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 >
2023-11-16 14:59:42 +00:00
< ul class = "simple simple-toc-section" >
< / ul >
2023-09-08 10:24:11 +00:00
< / li >
< li >
2023-11-16 14:59:42 +00:00
< a class = "reference reference-toplevel" href = "#7" id = "57" > Types< / a >
< ul class = "simple simple-toc-section" >
< li > < a class = "reference" href = "#RsaError"
title="RsaError = enum
2023-09-08 10:24:11 +00:00
RsaGenError, RsaKeyIncorrectError, RsaSignatureError, RsaLowSecurityError">RsaError< / a > < / li >
2023-11-16 14:59:42 +00:00
< li > < a class = "reference" href = "#RsaKeyPair"
title="RsaKeyPair = RsaPrivateKey">RsaKeyPair< / a > < / li >
< li > < a class = "reference" href = "#RsaKP"
title="RsaKP = RsaPrivateKey | RsaKeyPair">RsaKP< / a > < / li >
< li > < a class = "reference" href = "#RsaPKI"
title="RsaPKI = RsaPrivateKey | RsaPublicKey | RsaSignature">RsaPKI< / a > < / li >
< li > < a class = "reference" href = "#RsaPrivateKey"
title="RsaPrivateKey = ref object
2023-09-08 10:24:11 +00:00
buffer*: seq[byte]
seck*: rsa.RsaPrivateKey
pubk*: rsa.RsaPublicKey
pexp*: ptr byte
pexplen*: uint">RsaPrivateKey< / a > < / li >
2023-11-16 14:59:42 +00:00
< li > < a class = "reference" href = "#RsaPublicKey"
title="RsaPublicKey = ref object
2023-09-08 10:24:11 +00:00
buffer*: seq[byte]
key*: rsa.RsaPublicKey">RsaPublicKey< / a > < / li >
2023-11-16 14:59:42 +00:00
< li > < a class = "reference" href = "#RsaResult"
title="RsaResult[T] = Result[T, RsaError]">RsaResult< / a > < / li >
< li > < a class = "reference" href = "#RsaSignature"
title="RsaSignature = ref object
2023-09-08 10:24:11 +00:00
buffer*: seq[byte]">RsaSignature< / a > < / li >
2023-11-16 14:59:42 +00:00
< / ul >
2023-09-08 10:24:11 +00:00
< / li >
< li >
2023-11-16 14:59:42 +00:00
< a class = "reference reference-toplevel" href = "#10" id = "60" > Consts< / a >
< ul class = "simple simple-toc-section" >
< li > < a class = "reference" href = "#DefaultKeySize"
title="DefaultKeySize = 3072">DefaultKeySize< / a > < / li >
< li > < a class = "reference" href = "#DefaultPublicExponent"
title="DefaultPublicExponent = 65537'u32">DefaultPublicExponent< / a > < / li >
< li > < a class = "reference" href = "#MinKeySize"
title="MinKeySize = 2048">MinKeySize< / a > < / li >
< li > < a class = "reference" href = "#RsaOidSha1"
title="RsaOidSha1 = [5'u, 0x0000002B, 0x0000000E, 0x00000003, 0x00000002, 0x0000001A]">RsaOidSha1< / a > < / li >
< li > < a class = "reference" href = "#RsaOidSha224"
title="RsaOidSha224 = [9'u, 0x00000060, 0x00000086, 0x00000048, 0x00000001, 0x00000065,
2023-09-08 10:24:11 +00:00
0x00000003, 0x00000004, 0x00000002, 0x00000004]">RsaOidSha224< / a > < / li >
2023-11-16 14:59:42 +00:00
< li > < a class = "reference" href = "#RsaOidSha256"
title="RsaOidSha256 = [9'u, 0x00000060, 0x00000086, 0x00000048, 0x00000001, 0x00000065,
2023-09-08 10:24:11 +00:00
0x00000003, 0x00000004, 0x00000002, 0x00000001]">RsaOidSha256< / a > < / li >
2023-11-16 14:59:42 +00:00
< li > < a class = "reference" href = "#RsaOidSha384"
title="RsaOidSha384 = [9'u, 0x00000060, 0x00000086, 0x00000048, 0x00000001, 0x00000065,
2023-09-08 10:24:11 +00:00
0x00000003, 0x00000004, 0x00000002, 0x00000002]">RsaOidSha384< / a > < / li >
2023-11-16 14:59:42 +00:00
< li > < a class = "reference" href = "#RsaOidSha512"
title="RsaOidSha512 = [9'u, 0x00000060, 0x00000086, 0x00000048, 0x00000001, 0x00000065,
2023-09-08 10:24:11 +00:00
0x00000003, 0x00000004, 0x00000002, 0x00000003]">RsaOidSha512< / a > < / li >
2023-11-16 14:59:42 +00:00
< / ul >
2023-09-08 10:24:11 +00:00
< / li >
< li >
2023-11-16 14:59:42 +00:00
< a class = "reference reference-toplevel" href = "#12" id = "62" > Procs< / a >
< ul class = "simple simple-toc-section" >
2023-09-08 10:24:11 +00:00
< ul class = "simple nested-toc-section" > $
2023-11-16 14:59:42 +00:00
< li > < a class = "reference" href = "#%24%2CRsaPrivateKey"
title="`$`(key: RsaPrivateKey): string">`$`(key: RsaPrivateKey): string< / a > < / li >
< li > < a class = "reference" href = "#%24%2CRsaPublicKey"
title="`$`(key: RsaPublicKey): string">`$`(key: RsaPublicKey): string< / a > < / li >
< li > < a class = "reference" href = "#%24%2CRsaSignature"
title="`$`(sig: RsaSignature): string">`$`(sig: RsaSignature): string< / a > < / li >
< / ul >
< ul class = "simple nested-toc-section" > ==
< li > < a class = "reference" href = "#%3D%3D%2CRsaPrivateKey%2CRsaPrivateKey"
title="`==`(a, b: RsaPrivateKey): bool">`==`(a, b: RsaPrivateKey): bool< / a > < / li >
< li > < a class = "reference" href = "#%3D%3D%2CRsaPublicKey%2CRsaPublicKey"
title="`==`(a, b: RsaPublicKey): bool">`==`(a, b: RsaPublicKey): bool< / a > < / li >
< li > < a class = "reference" href = "#%3D%3D%2CRsaSignature%2CRsaSignature"
title="`==`(a, b: RsaSignature): bool">`==`(a, b: RsaSignature): bool< / a > < / li >
< / ul >
< ul class = "simple nested-toc-section" > clear
< li > < a class = "reference" href = "#clear%2CT"
title="clear[T: RsaPKI | RsaKeyPair](pki: var T)">clear[T: RsaPKI | RsaKeyPair](pki: var T)< / a > < / li >
< / ul >
< ul class = "simple nested-toc-section" > copy
< li > < a class = "reference" href = "#copy%2CT"
title="copy[T: RsaPKI](key: T): T">copy[T: RsaPKI](key: T): T< / a > < / li >
< / ul >
< ul class = "simple nested-toc-section" > getBytes
< li > < a class = "reference" href = "#getBytes%2CRsaPrivateKey"
title="getBytes(key: RsaPrivateKey): RsaResult[seq[byte]]">getBytes(key: RsaPrivateKey): RsaResult[seq[byte]]< / a > < / li >
< li > < a class = "reference" href = "#getBytes%2CRsaPublicKey"
title="getBytes(key: RsaPublicKey): RsaResult[seq[byte]]">getBytes(key: RsaPublicKey): RsaResult[seq[byte]]< / a > < / li >
< li > < a class = "reference" href = "#getBytes%2CRsaSignature"
title="getBytes(sig: RsaSignature): RsaResult[seq[byte]]">getBytes(sig: RsaSignature): RsaResult[seq[byte]]< / a > < / li >
< / ul >
< ul class = "simple nested-toc-section" > getPublicKey
< li > < a class = "reference" href = "#getPublicKey%2CRsaPrivateKey"
title="getPublicKey(key: RsaPrivateKey): RsaPublicKey">getPublicKey(key: RsaPrivateKey): RsaPublicKey< / a > < / li >
< / ul >
< ul class = "simple nested-toc-section" > init
< li > < a class = "reference" href = "#init%2CRsaPrivateKey%2CopenArray%5Bbyte%5D"
title="init(key: var RsaPrivateKey; data: openArray[byte]): Result[void, Asn1Error]">init(key: var RsaPrivateKey; data: openArray[byte]): Result[void, Asn1Error]< / a > < / li >
< li > < a class = "reference" href = "#init%2CRsaPublicKey%2CopenArray%5Bbyte%5D"
title="init(key: var RsaPublicKey; data: openArray[byte]): Result[void, Asn1Error]">init(key: var RsaPublicKey; data: openArray[byte]): Result[void, Asn1Error]< / a > < / li >
< li > < a class = "reference" href = "#init%2CRsaSignature%2CopenArray%5Bbyte%5D"
title="init(sig: var RsaSignature; data: openArray[byte]): Result[void, Asn1Error]">init(sig: var RsaSignature; data: openArray[byte]): Result[void, Asn1Error]< / a > < / li >
< li > < a class = "reference" href = "#init%2Ctypedesc%5BRsaPrivateKey%5D%2CopenArray%5Bbyte%5D"
title="init(t: typedesc[RsaPrivateKey]; data: openArray[byte]): RsaResult[RsaPrivateKey]">init(t: typedesc[RsaPrivateKey]; data: openArray[byte]): RsaResult[RsaPrivateKey]< / a > < / li >
< li > < a class = "reference" href = "#init%2Ctypedesc%5BRsaPublicKey%5D%2CopenArray%5Bbyte%5D"
title="init(t: typedesc[RsaPublicKey]; data: openArray[byte]): RsaResult[RsaPublicKey]">init(t: typedesc[RsaPublicKey]; data: openArray[byte]): RsaResult[RsaPublicKey]< / a > < / li >
< li > < a class = "reference" href = "#init%2Ctypedesc%5BRsaSignature%5D%2CopenArray%5Bbyte%5D"
title="init(t: typedesc[RsaSignature]; data: openArray[byte]): RsaResult[RsaSignature]">init(t: typedesc[RsaSignature]; data: openArray[byte]): RsaResult[RsaSignature]< / a > < / li >
< li > < a class = "reference" href = "#init%2CT%2Cstring"
title="init[T: RsaPKI](sospk: var T; data: string): Result[void, Asn1Error]">init[T: RsaPKI](sospk: var T; data: string): Result[void, Asn1Error]< / a > < / li >
< li > < a class = "reference" href = "#init%2Ctypedesc%5BT%5D%2Cstring"
title="init[T: RsaPKI](t: typedesc[T]; data: string): T">init[T: RsaPKI](t: typedesc[T]; data: string): T< / a > < / li >
< / ul >
< ul class = "simple nested-toc-section" > pubkey
< li > < a class = "reference" href = "#pubkey%2CRsaKeyPair"
title="pubkey(pair: RsaKeyPair): RsaPublicKey">pubkey(pair: RsaKeyPair): RsaPublicKey< / a > < / li >
< / ul >
< ul class = "simple nested-toc-section" > random
< li > < a class = "reference" href = "#random%2Ctypedesc%5BT%5D%2CHmacDrbgContext"
title="random[T: RsaKP](t: typedesc[T]; rng: var HmacDrbgContext;
2023-09-08 10:24:11 +00:00
bits = DefaultKeySize; pubexp = DefaultPublicExponent): RsaResult[
T]">random[T: RsaKP](t: typedesc[T]; rng: var HmacDrbgContext;
bits = DefaultKeySize; pubexp = DefaultPublicExponent): RsaResult[
T]< / a > < / li >
2023-11-16 14:59:42 +00:00
< / ul >
< ul class = "simple nested-toc-section" > seckey
< li > < a class = "reference" href = "#seckey%2CRsaKeyPair"
title="seckey(pair: RsaKeyPair): RsaPrivateKey">seckey(pair: RsaKeyPair): RsaPrivateKey< / a > < / li >
2023-09-08 10:24:11 +00:00
2023-11-16 14:59:42 +00:00
< / ul >
< ul class = "simple nested-toc-section" > sign
< li > < a class = "reference" href = "#sign%2CRsaPrivateKey%2CopenArray%5BT%5D"
title="sign[T: byte | char](key: RsaPrivateKey; message: openArray[T]): RsaResult[
2023-09-08 10:24:11 +00:00
RsaSignature]">sign[T: byte | char](key: RsaPrivateKey; message: openArray[T]): RsaResult[
RsaSignature]< / a > < / li >
2023-11-16 14:59:42 +00:00
< / ul >
< ul class = "simple nested-toc-section" > toBytes
< li > < a class = "reference" href = "#toBytes%2CRsaPrivateKey%2CopenArray%5Bbyte%5D"
title="toBytes(key: RsaPrivateKey; data: var openArray[byte]): RsaResult[int]">toBytes(key: RsaPrivateKey; data: var openArray[byte]): RsaResult[int]< / a > < / li >
< li > < a class = "reference" href = "#toBytes%2CRsaPublicKey%2CopenArray%5Bbyte%5D"
title="toBytes(key: RsaPublicKey; data: var openArray[byte]): RsaResult[int]">toBytes(key: RsaPublicKey; data: var openArray[byte]): RsaResult[int]< / a > < / li >
< li > < a class = "reference" href = "#toBytes%2CRsaSignature%2CopenArray%5Bbyte%5D"
title="toBytes(sig: RsaSignature; data: var openArray[byte]): RsaResult[int]">toBytes(sig: RsaSignature; data: var openArray[byte]): RsaResult[int]< / a > < / li >
< / ul >
< ul class = "simple nested-toc-section" > verify
< li > < a class = "reference" href = "#verify%2CRsaSignature%2CopenArray%5BT%5D%2CRsaPublicKey"
title="verify[T: byte | char](sig: RsaSignature; message: openArray[T];
2023-09-08 10:24:11 +00:00
pubkey: RsaPublicKey): bool">verify[T: byte | char](sig: RsaSignature; message: openArray[T];
pubkey: RsaPublicKey): bool< / a > < / li >
2023-11-16 14:59:42 +00:00
< / ul >
2023-09-08 10:24:11 +00:00
2023-11-16 14:59:42 +00:00
< / ul >
2023-09-08 10:24:11 +00:00
< / li >
< li >
2023-11-16 14:59:42 +00:00
< a class = "reference reference-toplevel" href = "#18" id = "68" > Templates< / a >
< ul class = "simple simple-toc-section" >
2023-09-08 10:24:11 +00:00
< ul class = "simple nested-toc-section" > getArray
2023-11-16 14:59:42 +00:00
< li > < a class = "reference" href = "#getArray.t%2Cuntyped%2Cuntyped%2Cuntyped"
title="getArray(bs, os, ls: untyped): untyped">getArray(bs, os, ls: untyped): untyped< / a > < / li >
2023-09-08 10:24:11 +00:00
2023-11-16 14:59:42 +00:00
< / ul >
2023-09-08 10:24:11 +00:00
2023-11-16 14:59:42 +00:00
< / ul >
2023-09-08 10:24:11 +00:00
< / li >
< li >
< a class = "reference reference-toplevel" href = "#19" id = "69" > Exports< / a >
2023-11-16 14:59:42 +00:00
< ul class = "simple simple-toc-section" >
< / ul >
2023-09-08 10:24:11 +00:00
< / li >
< / ul >
< / div >
2023-11-16 14:59:42 +00:00
< a
href="https://github.com/status-im/nim-libp2p/tree/unstable/libp2p/crypto/rsa.nim#L1"
class="link-seesrc" target="_blank">Source< / a >
< a href = "https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/rsa.nim#L1" class = "link-seesrc" target = "_blank" > Edit< / a >
2023-09-08 10:24:11 +00:00
2023-11-16 14:59:42 +00:00
< div class = "nine columns" id = "content" >
< div id = "tocRoot" > < / div >
< p class = "module-desc" > < p > This module implements constant-time RSA PKCS#1.5 DSA.< / p >
2023-09-08 10:24:11 +00:00
< 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 >
2023-11-16 14:59:42 +00:00
< 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 >
< / dl > < / div >
2023-09-08 10:24:11 +00:00
< div class = "section" id = "7" >
2023-11-16 14:59:42 +00:00
< h1 > < a class = "toc-backref" href = "#7" > Types< / a > < / h1 >
< dl class = "item" >
< div id = "RsaError" class = "tohide" >
2023-09-08 10:24:11 +00:00
< dt > < pre > < a href = "rsa.html#RsaError" > < span class = "Identifier" > RsaError< / span > < / a > < span class = "Other" > =< / span > < span class = "Keyword" > enum< / span >
< span class = "Identifier" > RsaGenError< / span > < span class = "Other" > ,< / span > < span class = "Identifier" > RsaKeyIncorrectError< / span > < span class = "Other" > ,< / span > < span class = "Identifier" > RsaSignatureError< / span > < span class = "Other" > ,< / span > < span class = "Identifier" > RsaLowSecurityError< / span > < / pre > < / dt >
< dd >
2023-11-16 14:59:42 +00:00
< a
href="https://github.com/status-im/nim-libp2p/tree/unstable/libp2p/crypto/rsa.nim#L81"
class="link-seesrc" target="_blank">Source< / a >
< a href = "https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/rsa.nim#L81" class = "link-seesrc" target = "_blank" > Edit< / a >
2023-09-08 10:24:11 +00:00
< / dd >
< / div >
< div id = "RsaKeyPair" class = "tohide" >
< dt > < pre > < a href = "rsa.html#RsaKeyPair" > < span class = "Identifier" > RsaKeyPair< / span > < / a > < span class = "Other" > =< / span > < a href = "rsa.html#RsaPrivateKey" > < span class = "Identifier" > RsaPrivateKey< / span > < / a > < / pre > < / dt >
< dd >
2023-11-16 14:59:42 +00:00
< a
href="https://github.com/status-im/nim-libp2p/tree/unstable/libp2p/crypto/rsa.nim#L73"
class="link-seesrc" target="_blank">Source< / a >
< a href = "https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/rsa.nim#L73" class = "link-seesrc" target = "_blank" > Edit< / a >
2023-09-08 10:24:11 +00:00
< / dd >
< / div >
< div id = "RsaKP" class = "tohide" >
< dt > < pre > < a href = "rsa.html#RsaKP" > < span class = "Identifier" > RsaKP< / span > < / a > < span class = "Other" > =< / span > < a href = "rsa.html#RsaPrivateKey" > < span class = "Identifier" > RsaPrivateKey< / span > < / a > < span class = "Operator" > |< / span > < a href = "rsa.html#RsaKeyPair" > < span class = "Identifier" > RsaKeyPair< / span > < / a > < / pre > < / dt >
< dd >
2023-11-16 14:59:42 +00:00
< a
href="https://github.com/status-im/nim-libp2p/tree/unstable/libp2p/crypto/rsa.nim#L79"
class="link-seesrc" target="_blank">Source< / a >
< a href = "https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/rsa.nim#L79" class = "link-seesrc" target = "_blank" > Edit< / a >
2023-09-08 10:24:11 +00:00
< / dd >
< / div >
< div id = "RsaPKI" class = "tohide" >
< dt > < pre > < a href = "rsa.html#RsaPKI" > < span class = "Identifier" > RsaPKI< / span > < / a > < span class = "Other" > =< / span > < a href = "rsa.html#RsaPrivateKey" > < span class = "Identifier" > RsaPrivateKey< / span > < / a > < span class = "Operator" > |< / span > < a href = "rsa.html#RsaPublicKey" > < span class = "Identifier" > RsaPublicKey< / span > < / a > < span class = "Operator" > |< / span > < a href = "rsa.html#RsaSignature" > < span class = "Identifier" > RsaSignature< / span > < / a > < / pre > < / dt >
< dd >
2023-11-16 14:59:42 +00:00
< a
href="https://github.com/status-im/nim-libp2p/tree/unstable/libp2p/crypto/rsa.nim#L78"
class="link-seesrc" target="_blank">Source< / a >
< a href = "https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/rsa.nim#L78" class = "link-seesrc" target = "_blank" > Edit< / a >
2023-09-08 10:24:11 +00:00
< / dd >
< / div >
< div id = "RsaPrivateKey" class = "tohide" >
< dt > < pre > < a href = "rsa.html#RsaPrivateKey" > < span class = "Identifier" > RsaPrivateKey< / 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 >
< span class = "Identifier" > seck< / span > < span class = "Operator" > *< / span > < span class = "Other" > :< / span > < span class = "Identifier" > rsa< / span > < span class = "Other" > .< / span > < span class = "Identifier" > RsaPrivateKey< / span >
< span class = "Identifier" > pubk< / span > < span class = "Operator" > *< / span > < span class = "Other" > :< / span > < span class = "Identifier" > rsa< / span > < span class = "Other" > .< / span > < span class = "Identifier" > RsaPublicKey< / span >
< span class = "Identifier" > pexp< / span > < span class = "Operator" > *< / span > < span class = "Other" > :< / span > < span class = "Keyword" > ptr< / span > < span class = "Identifier" > byte< / span >
< span class = "Identifier" > pexplen< / span > < span class = "Operator" > *< / span > < span class = "Other" > :< / span > < span class = "Identifier" > uint< / span >
< / pre > < / dt >
< dd >
2023-11-16 14:59:42 +00:00
< a
href="https://github.com/status-im/nim-libp2p/tree/unstable/libp2p/crypto/rsa.nim#L62"
class="link-seesrc" target="_blank">Source< / a >
< a href = "https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/rsa.nim#L62" class = "link-seesrc" target = "_blank" > Edit< / a >
2023-09-08 10:24:11 +00:00
< / dd >
< / div >
< div id = "RsaPublicKey" class = "tohide" >
< dt > < pre > < a href = "rsa.html#RsaPublicKey" > < span class = "Identifier" > RsaPublicKey< / 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 >
< span class = "Identifier" > key< / span > < span class = "Operator" > *< / span > < span class = "Other" > :< / span > < span class = "Identifier" > rsa< / span > < span class = "Other" > .< / span > < span class = "Identifier" > RsaPublicKey< / span >
< / pre > < / dt >
< dd >
2023-11-16 14:59:42 +00:00
< a
href="https://github.com/status-im/nim-libp2p/tree/unstable/libp2p/crypto/rsa.nim#L69"
class="link-seesrc" target="_blank">Source< / a >
< a href = "https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/rsa.nim#L69" class = "link-seesrc" target = "_blank" > Edit< / a >
2023-09-08 10:24:11 +00:00
< / dd >
< / div >
< div id = "RsaResult" class = "tohide" >
< dt > < pre > < a href = "rsa.html#RsaResult" > < span class = "Identifier" > RsaResult< / 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 = "rsa.html#RsaError" > < span class = "Identifier" > RsaError< / span > < / a > < span class = "Other" > ]< / span > < / pre > < / dt >
< dd >
2023-11-16 14:59:42 +00:00
< a
href="https://github.com/status-im/nim-libp2p/tree/unstable/libp2p/crypto/rsa.nim#L87"
class="link-seesrc" target="_blank">Source< / a >
< a href = "https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/rsa.nim#L87" class = "link-seesrc" target = "_blank" > Edit< / a >
2023-09-08 10:24:11 +00:00
< / dd >
< / div >
< div id = "RsaSignature" class = "tohide" >
< dt > < pre > < a href = "rsa.html#RsaSignature" > < span class = "Identifier" > RsaSignature< / 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 >
2023-11-16 14:59:42 +00:00
< a
href="https://github.com/status-im/nim-libp2p/tree/unstable/libp2p/crypto/rsa.nim#L75"
class="link-seesrc" target="_blank">Source< / a >
< a href = "https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/rsa.nim#L75" class = "link-seesrc" target = "_blank" > Edit< / a >
2023-09-08 10:24:11 +00:00
< / dd >
< / div >
2023-11-16 14:59:42 +00:00
< / dl > < / div >
2023-09-08 10:24:11 +00:00
< div class = "section" id = "10" >
2023-11-16 14:59:42 +00:00
< h1 > < a class = "toc-backref" href = "#10" > Consts< / a > < / h1 >
< dl class = "item" >
< div id = "DefaultKeySize" class = "tohide" >
2023-09-08 10:24:11 +00:00
< dt > < pre > < a href = "rsa.html#DefaultKeySize" > < span class = "Identifier" > DefaultKeySize< / span > < / a > < span class = "Other" > =< / span > < span class = "DecNumber" > 3072< / span > < / pre > < / dt >
< dd >
Default RSA key size in bits.
2023-11-16 14:59:42 +00:00
< a
href="https://github.com/status-im/nim-libp2p/tree/unstable/libp2p/crypto/rsa.nim#L33"
class="link-seesrc" target="_blank">Source< / a >
< a href = "https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/rsa.nim#L33" class = "link-seesrc" target = "_blank" > Edit< / a >
2023-09-08 10:24:11 +00:00
< / dd >
< / div >
< div id = "DefaultPublicExponent" class = "tohide" >
< dt > < pre > < a href = "rsa.html#DefaultPublicExponent" > < span class = "Identifier" > DefaultPublicExponent< / span > < / a > < span class = "Other" > =< / span > < span class = "DecNumber" > 65537'u32< / span > < / pre > < / dt >
< dd >
Default value for RSA public exponent. < a class = "reference external" href = "https://golang.org/src/crypto/rsa/rsa.go#226" > https://golang.org/src/crypto/rsa/rsa.go#226< / a >
2023-11-16 14:59:42 +00:00
< a
href="https://github.com/status-im/nim-libp2p/tree/unstable/libp2p/crypto/rsa.nim#L27"
class="link-seesrc" target="_blank">Source< / a >
< a href = "https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/rsa.nim#L27" class = "link-seesrc" target = "_blank" > Edit< / a >
2023-09-08 10:24:11 +00:00
< / dd >
< / div >
< div id = "MinKeySize" class = "tohide" >
< dt > < pre > < a href = "rsa.html#MinKeySize" > < span class = "Identifier" > MinKeySize< / span > < / a > < span class = "Other" > =< / span > < span class = "DecNumber" > 2048< / span > < / pre > < / dt >
< dd >
Minimal allowed RSA key size in bits. < a class = "reference external" href = "https://github.com/libp2p/go-libp2p-core/blob/master/crypto/rsa_common.go#L13" > https://github.com/libp2p/go-libp2p-core/blob/master/crypto/rsa_common.go#L13< / a >
2023-11-16 14:59:42 +00:00
< a
href="https://github.com/status-im/nim-libp2p/tree/unstable/libp2p/crypto/rsa.nim#L30"
class="link-seesrc" target="_blank">Source< / a >
< a href = "https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/rsa.nim#L30" class = "link-seesrc" target = "_blank" > Edit< / a >
2023-09-08 10:24:11 +00:00
< / dd >
< / div >
< div id = "RsaOidSha1" class = "tohide" >
< dt > < pre > < a href = "rsa.html#RsaOidSha1" > < span class = "Identifier" > RsaOidSha1< / span > < / a > < span class = "Other" > =< / span > < span class = "Other" > [< / span > < span class = "DecNumber" > 5'u< / span > < span class = "Other" > ,< / span > < span class = "DecNumber" > 0x0000002B< / span > < span class = "Other" > ,< / span > < span class = "DecNumber" > 0x0000000E< / span > < span class = "Other" > ,< / span > < span class = "DecNumber" > 0x00000003< / span > < span class = "Other" > ,< / span > < span class = "DecNumber" > 0x00000002< / span > < span class = "Other" > ,< / span > < span class = "DecNumber" > 0x0000001A< / span > < span class = "Other" > ]< / span > < / pre > < / dt >
< dd >
RSA PKCS#1.5 SHA-1 hash object identifier.
2023-11-16 14:59:42 +00:00
< a
href="https://github.com/status-im/nim-libp2p/tree/unstable/libp2p/crypto/rsa.nim#L36"
class="link-seesrc" target="_blank">Source< / a >
< a href = "https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/rsa.nim#L36" class = "link-seesrc" target = "_blank" > Edit< / a >
2023-09-08 10:24:11 +00:00
< / dd >
< / div >
< div id = "RsaOidSha224" class = "tohide" >
< dt > < pre > < a href = "rsa.html#RsaOidSha224" > < span class = "Identifier" > RsaOidSha224< / span > < / a > < span class = "Other" > =< / span > < span class = "Other" > [< / span > < span class = "DecNumber" > 9'u< / span > < span class = "Other" > ,< / span > < span class = "DecNumber" > 0x00000060< / span > < span class = "Other" > ,< / span > < span class = "DecNumber" > 0x00000086< / span > < span class = "Other" > ,< / span > < span class = "DecNumber" > 0x00000048< / span > < span class = "Other" > ,< / span > < span class = "DecNumber" > 0x00000001< / span > < span class = "Other" > ,< / span > < span class = "DecNumber" > 0x00000065< / span > < span class = "Other" > ,< / span >
< span class = "DecNumber" > 0x00000003< / span > < span class = "Other" > ,< / span > < span class = "DecNumber" > 0x00000004< / span > < span class = "Other" > ,< / span > < span class = "DecNumber" > 0x00000002< / span > < span class = "Other" > ,< / span > < span class = "DecNumber" > 0x00000004< / span > < span class = "Other" > ]< / span > < / pre > < / dt >
< dd >
RSA PKCS#1.5 SHA-224 hash object identifier.
2023-11-16 14:59:42 +00:00
< a
href="https://github.com/status-im/nim-libp2p/tree/unstable/libp2p/crypto/rsa.nim#L40"
class="link-seesrc" target="_blank">Source< / a >
< a href = "https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/rsa.nim#L40" class = "link-seesrc" target = "_blank" > Edit< / a >
2023-09-08 10:24:11 +00:00
< / dd >
< / div >
< div id = "RsaOidSha256" class = "tohide" >
< dt > < pre > < a href = "rsa.html#RsaOidSha256" > < span class = "Identifier" > RsaOidSha256< / span > < / a > < span class = "Other" > =< / span > < span class = "Other" > [< / span > < span class = "DecNumber" > 9'u< / span > < span class = "Other" > ,< / span > < span class = "DecNumber" > 0x00000060< / span > < span class = "Other" > ,< / span > < span class = "DecNumber" > 0x00000086< / span > < span class = "Other" > ,< / span > < span class = "DecNumber" > 0x00000048< / span > < span class = "Other" > ,< / span > < span class = "DecNumber" > 0x00000001< / span > < span class = "Other" > ,< / span > < span class = "DecNumber" > 0x00000065< / span > < span class = "Other" > ,< / span >
< span class = "DecNumber" > 0x00000003< / span > < span class = "Other" > ,< / span > < span class = "DecNumber" > 0x00000004< / span > < span class = "Other" > ,< / span > < span class = "DecNumber" > 0x00000002< / span > < span class = "Other" > ,< / span > < span class = "DecNumber" > 0x00000001< / span > < span class = "Other" > ]< / span > < / pre > < / dt >
< dd >
RSA PKCS#1.5 SHA-256 hash object identifier.
2023-11-16 14:59:42 +00:00
< a
href="https://github.com/status-im/nim-libp2p/tree/unstable/libp2p/crypto/rsa.nim#L45"
class="link-seesrc" target="_blank">Source< / a >
< a href = "https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/rsa.nim#L45" class = "link-seesrc" target = "_blank" > Edit< / a >
2023-09-08 10:24:11 +00:00
< / dd >
< / div >
< div id = "RsaOidSha384" class = "tohide" >
< dt > < pre > < a href = "rsa.html#RsaOidSha384" > < span class = "Identifier" > RsaOidSha384< / span > < / a > < span class = "Other" > =< / span > < span class = "Other" > [< / span > < span class = "DecNumber" > 9'u< / span > < span class = "Other" > ,< / span > < span class = "DecNumber" > 0x00000060< / span > < span class = "Other" > ,< / span > < span class = "DecNumber" > 0x00000086< / span > < span class = "Other" > ,< / span > < span class = "DecNumber" > 0x00000048< / span > < span class = "Other" > ,< / span > < span class = "DecNumber" > 0x00000001< / span > < span class = "Other" > ,< / span > < span class = "DecNumber" > 0x00000065< / span > < span class = "Other" > ,< / span >
< span class = "DecNumber" > 0x00000003< / span > < span class = "Other" > ,< / span > < span class = "DecNumber" > 0x00000004< / span > < span class = "Other" > ,< / span > < span class = "DecNumber" > 0x00000002< / span > < span class = "Other" > ,< / span > < span class = "DecNumber" > 0x00000002< / span > < span class = "Other" > ]< / span > < / pre > < / dt >
< dd >
RSA PKCS#1.5 SHA-384 hash object identifier.
2023-11-16 14:59:42 +00:00
< a
href="https://github.com/status-im/nim-libp2p/tree/unstable/libp2p/crypto/rsa.nim#L50"
class="link-seesrc" target="_blank">Source< / a >
< a href = "https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/rsa.nim#L50" class = "link-seesrc" target = "_blank" > Edit< / a >
2023-09-08 10:24:11 +00:00
< / dd >
< / div >
< div id = "RsaOidSha512" class = "tohide" >
< dt > < pre > < a href = "rsa.html#RsaOidSha512" > < span class = "Identifier" > RsaOidSha512< / span > < / a > < span class = "Other" > =< / span > < span class = "Other" > [< / span > < span class = "DecNumber" > 9'u< / span > < span class = "Other" > ,< / span > < span class = "DecNumber" > 0x00000060< / span > < span class = "Other" > ,< / span > < span class = "DecNumber" > 0x00000086< / span > < span class = "Other" > ,< / span > < span class = "DecNumber" > 0x00000048< / span > < span class = "Other" > ,< / span > < span class = "DecNumber" > 0x00000001< / span > < span class = "Other" > ,< / span > < span class = "DecNumber" > 0x00000065< / span > < span class = "Other" > ,< / span >
< span class = "DecNumber" > 0x00000003< / span > < span class = "Other" > ,< / span > < span class = "DecNumber" > 0x00000004< / span > < span class = "Other" > ,< / span > < span class = "DecNumber" > 0x00000002< / span > < span class = "Other" > ,< / span > < span class = "DecNumber" > 0x00000003< / span > < span class = "Other" > ]< / span > < / pre > < / dt >
< dd >
RSA PKCS#1.5 SHA-512 hash object identifier.
2023-11-16 14:59:42 +00:00
< a
href="https://github.com/status-im/nim-libp2p/tree/unstable/libp2p/crypto/rsa.nim#L55"
class="link-seesrc" target="_blank">Source< / a >
< a href = "https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/rsa.nim#L55" class = "link-seesrc" target = "_blank" > Edit< / a >
2023-09-08 10:24:11 +00:00
< / dd >
< / div >
2023-11-16 14:59:42 +00:00
< / dl > < / div >
2023-09-08 10:24:11 +00:00
< div class = "section" id = "12" >
2023-11-16 14:59:42 +00:00
< h1 > < a class = "toc-backref" href = "#12" > Procs< / a > < / h1 >
< dl class = "item" >
< div id = "$,RsaPrivateKey" class = "tohide" >
< dt > < pre > < span class = "Keyword" > proc< / span > < a href = "#%24%2CRsaPrivateKey" > < span class = "Identifier" > `$`< / span > < / a > < span class = "Other" > (< / span > < span class = "Identifier" > key< / span > < span class = "Other" > :< / span > < a href = "rsa.html#RsaPrivateKey" > < span class = "Identifier" > RsaPrivateKey< / 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 >
2023-09-08 10:24:11 +00:00
< dd >
Return string representation of RSA private key.
2023-11-16 14:59:42 +00:00
< a
href="https://github.com/status-im/nim-libp2p/tree/unstable/libp2p/crypto/rsa.nim#L621"
class="link-seesrc" target="_blank">Source< / a >
< a href = "https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/rsa.nim#L621" class = "link-seesrc" target = "_blank" > Edit< / a >
2023-09-08 10:24:11 +00:00
< / dd >
< / div >
< div id = "$,RsaPublicKey" class = "tohide" >
2023-11-16 14:59:42 +00:00
< dt > < pre > < span class = "Keyword" > proc< / span > < a href = "#%24%2CRsaPublicKey" > < span class = "Identifier" > `$`< / span > < / a > < span class = "Other" > (< / span > < span class = "Identifier" > key< / span > < span class = "Other" > :< / span > < a href = "rsa.html#RsaPublicKey" > < span class = "Identifier" > RsaPublicKey< / 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 >
2023-09-08 10:24:11 +00:00
< dd >
Return string representation of RSA public key.
2023-11-16 14:59:42 +00:00
< a
href="https://github.com/status-im/nim-libp2p/tree/unstable/libp2p/crypto/rsa.nim#L650"
class="link-seesrc" target="_blank">Source< / a >
< a href = "https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/rsa.nim#L650" class = "link-seesrc" target = "_blank" > Edit< / a >
2023-09-08 10:24:11 +00:00
< / dd >
< / div >
< div id = "$,RsaSignature" class = "tohide" >
2023-11-16 14:59:42 +00:00
< dt > < pre > < span class = "Keyword" > proc< / span > < a href = "#%24%2CRsaSignature" > < span class = "Identifier" > `$`< / span > < / a > < span class = "Other" > (< / span > < span class = "Identifier" > sig< / span > < span class = "Other" > :< / span > < a href = "rsa.html#RsaSignature" > < span class = "Identifier" > RsaSignature< / 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 >
2023-09-08 10:24:11 +00:00
< dd >
Return string representation of RSA signature.
2023-11-16 14:59:42 +00:00
< a
href="https://github.com/status-im/nim-libp2p/tree/unstable/libp2p/crypto/rsa.nim#L664"
class="link-seesrc" target="_blank">Source< / a >
< a href = "https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/rsa.nim#L664" class = "link-seesrc" target = "_blank" > Edit< / a >
2023-09-08 10:24:11 +00:00
< / dd >
< / div >
2023-11-16 14:59:42 +00:00
< div id = "==,RsaPrivateKey,RsaPrivateKey" class = "tohide" >
< dt > < pre > < span class = "Keyword" > proc< / span > < a href = "#%3D%3D%2CRsaPrivateKey%2CRsaPrivateKey" > < 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 = "rsa.html#RsaPrivateKey" > < span class = "Identifier" > RsaPrivateKey< / 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 >
2023-09-08 10:24:11 +00:00
< dd >
< p > Compare two RSA private keys for equality.< / p >
< p > Result is true if < tt class = "docutils literal" > < span class = "pre" > a< / span > < / tt > and < tt class = "docutils literal" > < span class = "pre" > b< / span > < / tt > are both < tt class = "docutils literal" > < span class = "pre" > nil< / span > < / tt > or < tt class = "docutils literal" > < span class = "pre" > a< / span > < / tt > and < tt class = "docutils literal" > < span class = "pre" > b< / span > < / tt > are equal by value.< / p >
2023-11-16 14:59:42 +00:00
< a
href="https://github.com/status-im/nim-libp2p/tree/unstable/libp2p/crypto/rsa.nim#L673"
class="link-seesrc" target="_blank">Source< / a >
< a href = "https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/rsa.nim#L673" class = "link-seesrc" target = "_blank" > Edit< / a >
2023-09-08 10:24:11 +00:00
< / dd >
< / div >
< div id = "==,RsaPublicKey,RsaPublicKey" class = "tohide" >
2023-11-16 14:59:42 +00:00
< dt > < pre > < span class = "Keyword" > proc< / span > < a href = "#%3D%3D%2CRsaPublicKey%2CRsaPublicKey" > < 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 = "rsa.html#RsaPublicKey" > < span class = "Identifier" > RsaPublicKey< / 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 >
2023-09-08 10:24:11 +00:00
< dd >
Compare two RSA public keys for equality.
2023-11-16 14:59:42 +00:00
< a
href="https://github.com/status-im/nim-libp2p/tree/unstable/libp2p/crypto/rsa.nim#L731"
class="link-seesrc" target="_blank">Source< / a >
< a href = "https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/rsa.nim#L731" class = "link-seesrc" target = "_blank" > Edit< / a >
2023-09-08 10:24:11 +00:00
< / dd >
< / div >
< div id = "==,RsaSignature,RsaSignature" class = "tohide" >
2023-11-16 14:59:42 +00:00
< dt > < pre > < span class = "Keyword" > proc< / span > < a href = "#%3D%3D%2CRsaSignature%2CRsaSignature" > < 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 = "rsa.html#RsaSignature" > < span class = "Identifier" > RsaSignature< / 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 >
2023-09-08 10:24:11 +00:00
< dd >
Compare two RSA signatures for equality.
2023-11-16 14:59:42 +00:00
< a
href="https://github.com/status-im/nim-libp2p/tree/unstable/libp2p/crypto/rsa.nim#L709"
class="link-seesrc" target="_blank">Source< / a >
< a href = "https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/rsa.nim#L709" class = "link-seesrc" target = "_blank" > Edit< / a >
2023-09-08 10:24:11 +00:00
< / dd >
< / div >
2023-11-16 14:59:42 +00:00
< div id = "clear,T" class = "tohide" >
2023-09-08 10:24:11 +00:00
< 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 = "rsa.html#RsaPKI" > < span class = "Identifier" > RsaPKI< / span > < / a > < span class = "Operator" > |< / span > < a href = "rsa.html#RsaKeyPair" > < span class = "Identifier" > RsaKeyPair< / 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 private key, public key or scalar object.
2023-11-16 14:59:42 +00:00
< a
href="https://github.com/status-im/nim-libp2p/tree/unstable/libp2p/crypto/rsa.nim#L251"
class="link-seesrc" target="_blank">Source< / a >
< a href = "https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/rsa.nim#L251" class = "link-seesrc" target = "_blank" > Edit< / a >
2023-09-08 10:24:11 +00:00
< / dd >
< / div >
2023-11-16 14:59:42 +00:00
< div id = "copy,T" class = "tohide" >
2023-09-08 10:24:11 +00:00
< 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 = "rsa.html#RsaPKI" > < span class = "Identifier" > RsaPKI< / span > < / a > < span class = "Other" > ]< / span > < span class = "Other" > (< / span > < span class = "Identifier" > key< / span > < span class = "Other" > :< / span > < span class = "Identifier" > T< / span > < span class = "Other" > )< / span > < span class = "Other" > :< / span > < span class = "Identifier" > T< / 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 >
Create copy of RSA private key, public key or signature.
2023-11-16 14:59:42 +00:00
< a
href="https://github.com/status-im/nim-libp2p/tree/unstable/libp2p/crypto/rsa.nim#L168"
class="link-seesrc" target="_blank">Source< / a >
< a href = "https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/rsa.nim#L168" class = "link-seesrc" target = "_blank" > Edit< / a >
2023-09-08 10:24:11 +00:00
< / dd >
< / div >
2023-11-16 14:59:42 +00:00
< div id = "getBytes,RsaPrivateKey" class = "tohide" >
< dt > < pre > < span class = "Keyword" > proc< / span > < a href = "#getBytes%2CRsaPrivateKey" > < span class = "Identifier" > getBytes< / span > < / a > < span class = "Other" > (< / span > < span class = "Identifier" > key< / span > < span class = "Other" > :< / span > < a href = "rsa.html#RsaPrivateKey" > < span class = "Identifier" > RsaPrivateKey< / span > < / a > < span class = "Other" > )< / span > < span class = "Other" > :< / span > < a href = "rsa.html#RsaResult" > < span class = "Identifier" > RsaResult< / 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 >
2023-09-08 10:24:11 +00:00
< dd >
Serialize RSA private key < tt class = "docutils literal" > < span class = "pre" > key< / span > < / tt > to ASN.1 DER binary form and return it.
2023-11-16 14:59:42 +00:00
< a
href="https://github.com/status-im/nim-libp2p/tree/unstable/libp2p/crypto/rsa.nim#L368"
class="link-seesrc" target="_blank">Source< / a >
< a href = "https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/rsa.nim#L368" class = "link-seesrc" target = "_blank" > Edit< / a >
2023-09-08 10:24:11 +00:00
< / dd >
< / div >
< div id = "getBytes,RsaPublicKey" class = "tohide" >
2023-11-16 14:59:42 +00:00
< dt > < pre > < span class = "Keyword" > proc< / span > < a href = "#getBytes%2CRsaPublicKey" > < span class = "Identifier" > getBytes< / span > < / a > < span class = "Other" > (< / span > < span class = "Identifier" > key< / span > < span class = "Other" > :< / span > < a href = "rsa.html#RsaPublicKey" > < span class = "Identifier" > RsaPublicKey< / span > < / a > < span class = "Other" > )< / span > < span class = "Other" > :< / span > < a href = "rsa.html#RsaResult" > < span class = "Identifier" > RsaResult< / 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 >
2023-09-08 10:24:11 +00:00
< dd >
Serialize RSA public key < tt class = "docutils literal" > < span class = "pre" > key< / span > < / tt > to ASN.1 DER binary form and return it.
2023-11-16 14:59:42 +00:00
< a
href="https://github.com/status-im/nim-libp2p/tree/unstable/libp2p/crypto/rsa.nim#L381"
class="link-seesrc" target="_blank">Source< / a >
< a href = "https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/rsa.nim#L381" class = "link-seesrc" target = "_blank" > Edit< / a >
2023-09-08 10:24:11 +00:00
< / dd >
< / div >
< div id = "getBytes,RsaSignature" class = "tohide" >
2023-11-16 14:59:42 +00:00
< dt > < pre > < span class = "Keyword" > proc< / span > < a href = "#getBytes%2CRsaSignature" > < span class = "Identifier" > getBytes< / span > < / a > < span class = "Other" > (< / span > < span class = "Identifier" > sig< / span > < span class = "Other" > :< / span > < a href = "rsa.html#RsaSignature" > < span class = "Identifier" > RsaSignature< / span > < / a > < span class = "Other" > )< / span > < span class = "Other" > :< / span > < a href = "rsa.html#RsaResult" > < span class = "Identifier" > RsaResult< / 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 >
2023-09-08 10:24:11 +00:00
< dd >
Serialize RSA signature < tt class = "docutils literal" > < span class = "pre" > sig< / span > < / tt > to raw binary form and return it.
2023-11-16 14:59:42 +00:00
< a
href="https://github.com/status-im/nim-libp2p/tree/unstable/libp2p/crypto/rsa.nim#L394"
class="link-seesrc" target="_blank">Source< / a >
< a href = "https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/rsa.nim#L394" class = "link-seesrc" target = "_blank" > Edit< / a >
2023-09-08 10:24:11 +00:00
< / dd >
< / div >
2023-11-16 14:59:42 +00:00
< div id = "getPublicKey,RsaPrivateKey" class = "tohide" >
< dt > < pre > < span class = "Keyword" > proc< / span > < a href = "#getPublicKey%2CRsaPrivateKey" > < span class = "Identifier" > getPublicKey< / span > < / a > < span class = "Other" > (< / span > < span class = "Identifier" > key< / span > < span class = "Other" > :< / span > < a href = "rsa.html#RsaPrivateKey" > < span class = "Identifier" > RsaPrivateKey< / span > < / a > < span class = "Other" > )< / span > < span class = "Other" > :< / span > < a href = "rsa.html#RsaPublicKey" > < span class = "Identifier" > RsaPublicKey< / 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 = "Other" > ]< / span > < / span > .}< / pre > < / dt >
2023-09-08 10:24:11 +00:00
< dd >
Get RSA public key from RSA private key.
2023-11-16 14:59:42 +00:00
< a
href="https://github.com/status-im/nim-libp2p/tree/unstable/libp2p/crypto/rsa.nim#L229"
class="link-seesrc" target="_blank">Source< / a >
< a href = "https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/rsa.nim#L229" class = "link-seesrc" target = "_blank" > Edit< / a >
2023-09-08 10:24:11 +00:00
< / dd >
< / div >
2023-11-16 14:59:42 +00:00
< div id = "init,RsaPrivateKey,openArray[byte]" class = "tohide" >
2023-09-08 10:24:11 +00:00
< dt > < pre > < span class = "Keyword" > proc< / span > < a href = "#init%2CRsaPrivateKey%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 = "rsa.html#RsaPrivateKey" > < span class = "Identifier" > RsaPrivateKey< / 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 > {.
2023-11-16 14:59:42 +00:00
< 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 >
2023-09-08 10:24:11 +00:00
< dd >
< p > Initialize RSA private key < 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" > Asn1Status< / span > < / tt > .< / p >
2023-11-16 14:59:42 +00:00
< a
href="https://github.com/status-im/nim-libp2p/tree/unstable/libp2p/crypto/rsa.nim#L406"
class="link-seesrc" target="_blank">Source< / a >
< a href = "https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/rsa.nim#L406" class = "link-seesrc" target = "_blank" > Edit< / a >
2023-09-08 10:24:11 +00:00
< / dd >
< / div >
< div id = "init,RsaPublicKey,openArray[byte]" class = "tohide" >
< dt > < pre > < span class = "Keyword" > proc< / span > < a href = "#init%2CRsaPublicKey%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 = "rsa.html#RsaPublicKey" > < span class = "Identifier" > RsaPublicKey< / 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 > {.
2023-11-16 14:59:42 +00:00
< 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 >
2023-09-08 10:24:11 +00:00
< dd >
< p > Initialize RSA public key < 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" > Asn1Status< / span > < / tt > .< / p >
2023-11-16 14:59:42 +00:00
< a
href="https://github.com/status-im/nim-libp2p/tree/unstable/libp2p/crypto/rsa.nim#L497"
class="link-seesrc" target="_blank">Source< / a >
< a href = "https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/rsa.nim#L497" class = "link-seesrc" target = "_blank" > Edit< / a >
2023-09-08 10:24:11 +00:00
< / dd >
< / div >
< div id = "init,RsaSignature,openArray[byte]" class = "tohide" >
< dt > < pre > < span class = "Keyword" > proc< / span > < a href = "#init%2CRsaSignature%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 = "rsa.html#RsaSignature" > < span class = "Identifier" > RsaSignature< / 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 > {.
2023-11-16 14:59:42 +00:00
< 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 >
2023-09-08 10:24:11 +00:00
< dd >
< p > Initialize RSA signature < tt class = "docutils literal" > < span class = "pre" > sig< / 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, Asn1Status]< / span > < / tt > .< / p >
2023-11-16 14:59:42 +00:00
< a
href="https://github.com/status-im/nim-libp2p/tree/unstable/libp2p/crypto/rsa.nim#L566"
class="link-seesrc" target="_blank">Source< / a >
< a href = "https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/rsa.nim#L566" class = "link-seesrc" target = "_blank" > Edit< / a >
2023-09-08 10:24:11 +00:00
< / dd >
< / div >
< div id = "init,typedesc[RsaPrivateKey],openArray[byte]" class = "tohide" >
< dt > < pre > < span class = "Keyword" > proc< / span > < a href = "#init%2Ctypedesc%5BRsaPrivateKey%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 = "rsa.html#RsaPrivateKey" > < span class = "Identifier" > RsaPrivateKey< / 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 = "rsa.html#RsaResult" > < span class = "Identifier" > RsaResult< / span > < / a > < span class = "Other" > [< / span >
< a href = "rsa.html#RsaPrivateKey" > < span class = "Identifier" > RsaPrivateKey< / 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 RSA private key from ASN.1 DER binary representation < tt class = "docutils literal" > < span class = "pre" > data< / span > < / tt > and return constructed object.
2023-11-16 14:59:42 +00:00
< a
href="https://github.com/status-im/nim-libp2p/tree/unstable/libp2p/crypto/rsa.nim#L586"
class="link-seesrc" target="_blank">Source< / a >
< a href = "https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/rsa.nim#L586" class = "link-seesrc" target = "_blank" > Edit< / a >
2023-09-08 10:24:11 +00:00
< / dd >
< / div >
< div id = "init,typedesc[RsaPublicKey],openArray[byte]" class = "tohide" >
< dt > < pre > < span class = "Keyword" > proc< / span > < a href = "#init%2Ctypedesc%5BRsaPublicKey%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 = "rsa.html#RsaPublicKey" > < span class = "Identifier" > RsaPublicKey< / 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 = "rsa.html#RsaResult" > < span class = "Identifier" > RsaResult< / span > < / a > < span class = "Other" > [< / span >
< a href = "rsa.html#RsaPublicKey" > < span class = "Identifier" > RsaPublicKey< / 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 RSA public key from ASN.1 DER binary representation < tt class = "docutils literal" > < span class = "pre" > data< / span > < / tt > and return constructed object.
2023-11-16 14:59:42 +00:00
< a
href="https://github.com/status-im/nim-libp2p/tree/unstable/libp2p/crypto/rsa.nim#L596"
class="link-seesrc" target="_blank">Source< / a >
< a href = "https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/rsa.nim#L596" class = "link-seesrc" target = "_blank" > Edit< / a >
2023-09-08 10:24:11 +00:00
< / dd >
< / div >
< div id = "init,typedesc[RsaSignature],openArray[byte]" class = "tohide" >
< dt > < pre > < span class = "Keyword" > proc< / span > < a href = "#init%2Ctypedesc%5BRsaSignature%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 = "rsa.html#RsaSignature" > < span class = "Identifier" > RsaSignature< / 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 = "rsa.html#RsaResult" > < span class = "Identifier" > RsaResult< / span > < / a > < span class = "Other" > [< / span >
< a href = "rsa.html#RsaSignature" > < span class = "Identifier" > RsaSignature< / 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 RSA signature from raw binary representation < tt class = "docutils literal" > < span class = "pre" > data< / span > < / tt > and return constructed object.
2023-11-16 14:59:42 +00:00
< a
href="https://github.com/status-im/nim-libp2p/tree/unstable/libp2p/crypto/rsa.nim#L606"
class="link-seesrc" target="_blank">Source< / a >
< a href = "https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/rsa.nim#L606" class = "link-seesrc" target = "_blank" > Edit< / a >
2023-09-08 10:24:11 +00:00
< / 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 = "rsa.html#RsaPKI" > < span class = "Identifier" > RsaPKI< / 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" > scalar< / span > < / span > < / tt > < tt class = "docutils literal" > < span class = "pre" > sospk< / span > < / tt > from hexadecimal string representation < tt class = "docutils literal" > < span class = "pre" > data< / span > < / tt > .< / p >
< p > Procedure returns < tt class = "docutils literal" > < span class = "pre" > Result[void, Asn1Status]< / span > < / tt > .< / p >
2023-11-16 14:59:42 +00:00
< a
href="https://github.com/status-im/nim-libp2p/tree/unstable/libp2p/crypto/rsa.nim#L578"
class="link-seesrc" target="_blank">Source< / a >
< a href = "https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/rsa.nim#L578" class = "link-seesrc" target = "_blank" > Edit< / a >
2023-09-08 10:24:11 +00:00
< / 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 = "rsa.html#RsaPKI" > < span class = "Identifier" > RsaPKI< / 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 RSA < 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.
2023-11-16 14:59:42 +00:00
< a
href="https://github.com/status-im/nim-libp2p/tree/unstable/libp2p/crypto/rsa.nim#L616"
class="link-seesrc" target="_blank">Source< / a >
< a href = "https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/rsa.nim#L616" class = "link-seesrc" target = "_blank" > Edit< / a >
2023-09-08 10:24:11 +00:00
< / dd >
< / div >
2023-11-16 14:59:42 +00:00
< div id = "pubkey,RsaKeyPair" class = "tohide" >
< dt > < pre > < span class = "Keyword" > proc< / span > < a href = "#pubkey%2CRsaKeyPair" > < span class = "Identifier" > pubkey< / span > < / a > < span class = "Other" > (< / span > < span class = "Identifier" > pair< / span > < span class = "Other" > :< / span > < a href = "rsa.html#RsaKeyPair" > < span class = "Identifier" > RsaKeyPair< / span > < / a > < span class = "Other" > )< / span > < span class = "Other" > :< / span > < a href = "rsa.html#RsaPublicKey" > < span class = "Identifier" > RsaPublicKey< / span > < / a > {.< span class = "Identifier" > inline< / span > < span class = "Other" > ,< / span > < span > < span class = "Other pragmadots" > ...< / span > < / span > < span class = "pragmawrap" > < span class = "Identifier" > raises< / span > < span class = "Other" > :< / span > < span class = "Other" > [< / span > < span class = "Other" > ]< / span > < span class = "Other" > ,< / span > < span class = "Identifier" > tags< / span > < span class = "Other" > :< / span > < span class = "Other" > [< / span > < span class = "Other" > ]< / span > < / span > .}< / pre > < / dt >
2023-09-08 10:24:11 +00:00
< dd >
Get RSA public key from pair < tt class = "docutils literal" > < span class = "pre" > pair< / span > < / tt > .
2023-11-16 14:59:42 +00:00
< a
href="https://github.com/status-im/nim-libp2p/tree/unstable/libp2p/crypto/rsa.nim#L247"
class="link-seesrc" target="_blank">Source< / a >
< a href = "https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/rsa.nim#L247" class = "link-seesrc" target = "_blank" > Edit< / a >
2023-09-08 10:24:11 +00:00
< / dd >
< / div >
2023-11-16 14:59:42 +00:00
< div id = "random,typedesc[T],HmacDrbgContext" class = "tohide" >
2023-09-08 10:24:11 +00:00
< dt > < pre > < span class = "Keyword" > proc< / span > < a href = "#random%2Ctypedesc%5BT%5D%2CHmacDrbgContext" > < span class = "Identifier" > random< / span > < / a > < span class = "Other" > [< / span > < span class = "Identifier" > T< / span > < span class = "Other" > :< / span > < a href = "rsa.html#RsaKP" > < span class = "Identifier" > RsaKP< / 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" > rng< / span > < span class = "Other" > :< / span > < span class = "Keyword" > var< / span > < span class = "Identifier" > HmacDrbgContext< / span > < span class = "Other" > ;< / span >
< span class = "Identifier" > bits< / span > < span class = "Other" > =< / span > < span class = "Identifier" > DefaultKeySize< / span > < span class = "Other" > ;< / span > < span class = "Identifier" > pubexp< / span > < span class = "Other" > =< / span > < span class = "Identifier" > DefaultPublicExponent< / span > < span class = "Other" > )< / span > < span class = "Other" > :< / span > < a href = "rsa.html#RsaResult" > < span class = "Identifier" > RsaResult< / 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 RSA private key using BearSSL's HMAC-SHA256-DRBG algorithm.< / p >
2023-11-16 14:59:42 +00:00
< p > < tt class = "docutils literal" > < span class = "pre" > bits< / span > < / tt > number of bits in RSA key, must be in range [2048, 4096] (default = 3072).< / p >
2023-09-08 10:24:11 +00:00
< p > < tt class = "docutils literal" > < span class = "pre" > pubexp< / span > < / tt > is RSA public exponent, which must be prime (default = 3).< / p >
2023-11-16 14:59:42 +00:00
< a
href="https://github.com/status-im/nim-libp2p/tree/unstable/libp2p/crypto/rsa.nim#L118"
class="link-seesrc" target="_blank">Source< / a >
< a href = "https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/rsa.nim#L118" class = "link-seesrc" target = "_blank" > Edit< / a >
2023-09-08 10:24:11 +00:00
< / dd >
< / div >
2023-11-16 14:59:42 +00:00
< div id = "seckey,RsaKeyPair" class = "tohide" >
< dt > < pre > < span class = "Keyword" > proc< / span > < a href = "#seckey%2CRsaKeyPair" > < span class = "Identifier" > seckey< / span > < / a > < span class = "Other" > (< / span > < span class = "Identifier" > pair< / span > < span class = "Other" > :< / span > < a href = "rsa.html#RsaKeyPair" > < span class = "Identifier" > RsaKeyPair< / span > < / a > < span class = "Other" > )< / span > < span class = "Other" > :< / span > < a href = "rsa.html#RsaPrivateKey" > < span class = "Identifier" > RsaPrivateKey< / span > < / a > {.< span class = "Identifier" > inline< / span > < span class = "Other" > ,< / span > < span > < span class = "Other pragmadots" > ...< / span > < / span > < span class = "pragmawrap" > < span class = "Identifier" > raises< / span > < span class = "Other" > :< / span > < span class = "Other" > [< / span > < span class = "Other" > ]< / span > < span class = "Other" > ,< / span > < span class = "Identifier" > tags< / span > < span class = "Other" > :< / span > < span class = "Other" > [< / span > < span class = "Other" > ]< / span > < / span > .}< / pre > < / dt >
2023-09-08 10:24:11 +00:00
< dd >
Get RSA private key from pair < tt class = "docutils literal" > < span class = "pre" > pair< / span > < / tt > .
2023-11-16 14:59:42 +00:00
< a
href="https://github.com/status-im/nim-libp2p/tree/unstable/libp2p/crypto/rsa.nim#L243"
class="link-seesrc" target="_blank">Source< / a >
< a href = "https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/rsa.nim#L243" class = "link-seesrc" target = "_blank" > Edit< / a >
2023-09-08 10:24:11 +00:00
< / dd >
< / div >
2023-11-16 14:59:42 +00:00
< div id = "sign,RsaPrivateKey,openArray[T]" class = "tohide" >
2023-09-08 10:24:11 +00:00
< dt > < pre > < span class = "Keyword" > proc< / span > < a href = "#sign%2CRsaPrivateKey%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" > key< / span > < span class = "Other" > :< / span > < a href = "rsa.html#RsaPrivateKey" > < span class = "Identifier" > RsaPrivateKey< / 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 = "rsa.html#RsaResult" > < span class = "Identifier" > RsaResult< / span > < / a > < span class = "Other" > [< / span >
< a href = "rsa.html#RsaSignature" > < span class = "Identifier" > RsaSignature< / 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 RSA PKCS1.5 signature of data < tt class = "docutils literal" > < span class = "pre" > message< / span > < / tt > using SHA256 and private key < tt class = "docutils literal" > < span class = "pre" > key< / span > < / tt > .
2023-11-16 14:59:42 +00:00
< a
href="https://github.com/status-im/nim-libp2p/tree/unstable/libp2p/crypto/rsa.nim#L746"
class="link-seesrc" target="_blank">Source< / a >
< a href = "https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/rsa.nim#L746" class = "link-seesrc" target = "_blank" > Edit< / a >
2023-09-08 10:24:11 +00:00
< / dd >
< / div >
2023-11-16 14:59:42 +00:00
< div id = "toBytes,RsaPrivateKey,openArray[byte]" class = "tohide" >
2023-09-08 10:24:11 +00:00
< dt > < pre > < span class = "Keyword" > proc< / span > < a href = "#toBytes%2CRsaPrivateKey%2CopenArray%5Bbyte%5D" > < span class = "Identifier" > toBytes< / span > < / a > < span class = "Other" > (< / span > < span class = "Identifier" > key< / span > < span class = "Other" > :< / span > < a href = "rsa.html#RsaPrivateKey" > < span class = "Identifier" > RsaPrivateKey< / 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 = "rsa.html#RsaResult" > < span class = "Identifier" > RsaResult< / span > < / a > < span class = "Other" > [< / span > < span class = "Identifier" > int< / span > < span class = "Other" > ]< / span > {.
2023-11-16 14:59:42 +00:00
< 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 >
2023-09-08 10:24:11 +00:00
< dd >
< p > Serialize RSA private key < tt class = "docutils literal" > < span class = "pre" > key< / 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 RSA private key, or < tt class = "docutils literal" > < span class = "pre" > < span class = "DecNumber" > 0< / span > < / span > < / tt > if private key is is incorrect.< / p >
2023-11-16 14:59:42 +00:00
< a
href="https://github.com/status-im/nim-libp2p/tree/unstable/libp2p/crypto/rsa.nim#L283"
class="link-seesrc" target="_blank">Source< / a >
< a href = "https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/rsa.nim#L283" class = "link-seesrc" target = "_blank" > Edit< / a >
2023-09-08 10:24:11 +00:00
< / dd >
< / div >
< div id = "toBytes,RsaPublicKey,openArray[byte]" class = "tohide" >
< dt > < pre > < span class = "Keyword" > proc< / span > < a href = "#toBytes%2CRsaPublicKey%2CopenArray%5Bbyte%5D" > < span class = "Identifier" > toBytes< / span > < / a > < span class = "Other" > (< / span > < span class = "Identifier" > key< / span > < span class = "Other" > :< / span > < a href = "rsa.html#RsaPublicKey" > < span class = "Identifier" > RsaPublicKey< / 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 = "rsa.html#RsaResult" > < span class = "Identifier" > RsaResult< / span > < / a > < span class = "Other" > [< / span > < span class = "Identifier" > int< / span > < span class = "Other" > ]< / span > {.
2023-11-16 14:59:42 +00:00
< 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 >
2023-09-08 10:24:11 +00:00
< dd >
< p > Serialize RSA public key < tt class = "docutils literal" > < span class = "pre" > key< / 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 RSA public key, or < tt class = "docutils literal" > < span class = "pre" > < span class = "DecNumber" > 0< / span > < / span > < / tt > if public key is incorrect.< / p >
2023-11-16 14:59:42 +00:00
< a
href="https://github.com/status-im/nim-libp2p/tree/unstable/libp2p/crypto/rsa.nim#L320"
class="link-seesrc" target="_blank">Source< / a >
< a href = "https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/rsa.nim#L320" class = "link-seesrc" target = "_blank" > Edit< / a >
2023-09-08 10:24:11 +00:00
< / dd >
< / div >
< div id = "toBytes,RsaSignature,openArray[byte]" class = "tohide" >
< dt > < pre > < span class = "Keyword" > proc< / span > < a href = "#toBytes%2CRsaSignature%2CopenArray%5Bbyte%5D" > < span class = "Identifier" > toBytes< / span > < / a > < span class = "Other" > (< / span > < span class = "Identifier" > sig< / span > < span class = "Other" > :< / span > < a href = "rsa.html#RsaSignature" > < span class = "Identifier" > RsaSignature< / 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 = "rsa.html#RsaResult" > < span class = "Identifier" > RsaResult< / span > < / a > < span class = "Other" > [< / span > < span class = "Identifier" > int< / span > < span class = "Other" > ]< / span > {.
2023-11-16 14:59:42 +00:00
< 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 >
2023-09-08 10:24:11 +00:00
< dd >
< p > Serialize RSA 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 > Procedure returns number of bytes (octets) needed to store RSA public key, or < tt class = "docutils literal" > < span class = "pre" > < span class = "DecNumber" > 0< / span > < / span > < / tt > if public key is incorrect.< / p >
2023-11-16 14:59:42 +00:00
< a
href="https://github.com/status-im/nim-libp2p/tree/unstable/libp2p/crypto/rsa.nim#L354"
class="link-seesrc" target="_blank">Source< / a >
< a href = "https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/rsa.nim#L354" class = "link-seesrc" target = "_blank" > Edit< / a >
2023-09-08 10:24:11 +00:00
< / dd >
< / div >
2023-11-16 14:59:42 +00:00
< div id = "verify,RsaSignature,openArray[T],RsaPublicKey" class = "tohide" >
2023-09-08 10:24:11 +00:00
< dt > < pre > < span class = "Keyword" > proc< / span > < a href = "#verify%2CRsaSignature%2CopenArray%5BT%5D%2CRsaPublicKey" > < 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 = "rsa.html#RsaSignature" > < span class = "Identifier" > RsaSignature< / 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 = "rsa.html#RsaPublicKey" > < span class = "Identifier" > RsaPublicKey< / 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 RSA 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 >
2023-11-16 14:59:42 +00:00
< a
href="https://github.com/status-im/nim-libp2p/tree/unstable/libp2p/crypto/rsa.nim#L774"
class="link-seesrc" target="_blank">Source< / a >
< a href = "https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/rsa.nim#L774" class = "link-seesrc" target = "_blank" > Edit< / a >
2023-09-08 10:24:11 +00:00
< / dd >
< / div >
2023-11-16 14:59:42 +00:00
< / dl > < / div >
2023-09-08 10:24:11 +00:00
< div class = "section" id = "18" >
2023-11-16 14:59:42 +00:00
< h1 > < a class = "toc-backref" href = "#18" > Templates< / a > < / h1 >
< dl class = "item" >
< div id = "getArray.t,untyped,untyped,untyped" class = "tohide" >
2023-09-08 10:24:11 +00:00
< dt > < pre > < span class = "Keyword" > template< / span > < a href = "#getArray.t%2Cuntyped%2Cuntyped%2Cuntyped" > < span class = "Identifier" > getArray< / span > < / a > < span class = "Other" > (< / span > < span class = "Identifier" > bs< / span > < span class = "Other" > ,< / span > < span class = "Identifier" > os< / span > < span class = "Other" > ,< / span > < span class = "Identifier" > ls< / span > < span class = "Other" > :< / span > < span class = "Identifier" > untyped< / span > < span class = "Other" > )< / span > < span class = "Other" > :< / span > < span class = "Identifier" > untyped< / span > < / pre > < / dt >
< dd >
2023-11-16 14:59:42 +00:00
< a
href="https://github.com/status-im/nim-libp2p/tree/unstable/libp2p/crypto/rsa.nim#L107"
class="link-seesrc" target="_blank">Source< / a >
< a href = "https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/rsa.nim#L107" class = "link-seesrc" target = "_blank" > Edit< / a >
2023-09-08 10:24:11 +00:00
< / dd >
< / div >
2023-11-16 14:59:42 +00:00
< / dl > < / div >
2023-09-08 10:24:11 +00:00
< div class = "section" id = "19" >
2023-11-16 14:59:42 +00:00
< 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 >
2023-09-08 10:24:11 +00:00
< / div >
< / div >
2023-11-16 14:59:42 +00:00
< div class = "row" >
2023-09-08 10:24:11 +00:00
< div class = "twelve-columns footer" >
< span class = "nim-sprite" > < / span >
2023-11-16 14:59:42 +00:00
< br / >
2024-04-25 12:58:02 +00:00
< small style = "color: var(--hint);" > Made with Nim. Generated: 2024-04-25 12:57:33 UTC< / small >
2023-09-08 10:24:11 +00:00
< / div >
< / div >
< / div >
2023-11-16 14:59:42 +00:00
< / div >
2023-09-08 10:24:11 +00:00
< / body >
< / html >