{"id":545,"date":"2025-02-03T10:29:48","date_gmt":"2025-02-03T09:29:48","guid":{"rendered":"https:\/\/support.eprime.it\/?p=545"},"modified":"2025-02-03T11:37:21","modified_gmt":"2025-02-03T10:37:21","slug":"authenticator-integrarlo-in-vbnet","status":"publish","type":"post","link":"https:\/\/support.eprime.it\/index.php\/2025\/02\/03\/authenticator-integrarlo-in-vbnet\/","title":{"rendered":"Authenticator &#8211; integrarlo in VbNet"},"content":{"rendered":"\t\t<div data-elementor-type=\"wp-post\" data-elementor-id=\"545\" class=\"elementor elementor-545\">\n\t\t\t\t<div class=\"elementor-element elementor-element-c1b90a8 e-flex e-con-boxed e-con e-parent\" data-id=\"c1b90a8\" data-element_type=\"container\">\n\t\t\t\t\t<div class=\"e-con-inner\">\n\t\t\t\t<div class=\"elementor-element elementor-element-118fb6a elementor-widget elementor-widget-text-editor\" data-id=\"118fb6a\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<p>Generazione chiave segreta<\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t<div class=\"elementor-element elementor-element-17b9ca2 e-flex e-con-boxed e-con e-parent\" data-id=\"17b9ca2\" data-element_type=\"container\">\n\t\t\t\t\t<div class=\"e-con-inner\">\n\t\t\t\t<div class=\"elementor-element elementor-element-bfa083b elementor-widget elementor-widget-code-block-for-elementor\" data-id=\"bfa083b\" data-element_type=\"widget\" data-widget_type=\"code-block-for-elementor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t<pre class='line-numbers theme-okaidia' data-show-toolbar='yes'><code class='language-vbnet'>Function GeneraChiaveSegreta() As String\n    Dim chiaveBytes(19) As Byte &#039; 20 byte per una chiave di base32 di 80 bit\n    Using rng As New RNGCryptoServiceProvider()\n        rng.GetBytes(chiaveBytes)\n    End Using\n\n    Dim input As Byte() = chiaveBytes\n    Dim base32Chars As String = &quot;ABCDEFGHIJKLMNOPQRSTUVWXYZ234567&quot;\n\n    Dim bits As Integer = 0\n    Dim buffer As Integer = 0\n    Dim output As New StringBuilder()\n\n    For Each b As Byte In input\n        buffer = (buffer &lt;&lt; 8) Or b\n        bits += 8\n        While bits &gt;= 5\n            output.Append(base32Chars(buffer &gt;&gt; (bits - 5)))\n            buffer = buffer And ((1 &lt;&lt; (bits - 5)) - 1)\n            bits -= 5\n        End While\n    Next\n\n    If bits &gt; 0 Then\n        buffer = buffer &lt;&lt; (5 - bits)\n        output.Append(base32Chars(buffer))\n    End If\n\n    Return output.ToString()\nEnd Function<\/code><\/pre>\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t<div class=\"elementor-element elementor-element-d8b379a e-flex e-con-boxed e-con e-parent\" data-id=\"d8b379a\" data-element_type=\"container\">\n\t\t\t\t\t<div class=\"e-con-inner\">\n\t\t\t\t<div class=\"elementor-element elementor-element-fea5d99 elementor-widget elementor-widget-text-editor\" data-id=\"fea5d99\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<p>Una volta creata la chiave segreta genero il QrCode<\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t<div class=\"elementor-element elementor-element-735e2a1 e-flex e-con-boxed e-con e-parent\" data-id=\"735e2a1\" data-element_type=\"container\">\n\t\t\t\t\t<div class=\"e-con-inner\">\n\t\t\t\t<div class=\"elementor-element elementor-element-2a5d767 elementor-widget elementor-widget-code-block-for-elementor\" data-id=\"2a5d767\" data-element_type=\"widget\" data-widget_type=\"code-block-for-elementor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t<pre class='line-numbers theme-okaidia' data-show-toolbar='yes'><code class='language-vbnet'>picQrcode.Image = GeneraQRCode(&quot;otpauth:\/\/Nome Programma: &quot; &amp; Application.Session(&quot;utente&quot;) &amp; &quot;?secret=&quot; &amp; chiavesegreta)<\/code><\/pre>\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t<div class=\"elementor-element elementor-element-66a2a10 e-flex e-con-boxed e-con e-parent\" data-id=\"66a2a10\" data-element_type=\"container\">\n\t\t\t\t\t<div class=\"e-con-inner\">\n\t\t\t\t<div class=\"elementor-element elementor-element-a94cbfd elementor-widget elementor-widget-text-editor\" data-id=\"a94cbfd\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut elit tellus, luctus nec ullamcorper mattis, pulvinar dapibus leo.<\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t","protected":false},"excerpt":{"rendered":"<p>Generazione chiave segreta Function GeneraChiaveSegreta() As String Dim chiaveBytes(19) As Byte &#039; 20 byte per una chiave di base32 di [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_uag_custom_page_level_css":"","site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[60],"tags":[],"class_list":["post-545","post","type-post","status-publish","format-standard","hentry","category-codice"],"acf":[],"uagb_featured_image_src":{"full":false,"thumbnail":false,"medium":false,"medium_large":false,"large":false,"1536x1536":false,"2048x2048":false},"uagb_author_info":{"display_name":"eprime","author_link":"https:\/\/support.eprime.it\/index.php\/profile\/eprime\/"},"uagb_comment_info":0,"uagb_excerpt":"Generazione chiave segreta Function GeneraChiaveSegreta() As String Dim chiaveBytes(19) As Byte &#039; 20 byte per una chiave di base32 di [&hellip;]","_links":{"self":[{"href":"https:\/\/support.eprime.it\/index.php\/wp-json\/wp\/v2\/posts\/545","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/support.eprime.it\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/support.eprime.it\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/support.eprime.it\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/support.eprime.it\/index.php\/wp-json\/wp\/v2\/comments?post=545"}],"version-history":[{"count":51,"href":"https:\/\/support.eprime.it\/index.php\/wp-json\/wp\/v2\/posts\/545\/revisions"}],"predecessor-version":[{"id":605,"href":"https:\/\/support.eprime.it\/index.php\/wp-json\/wp\/v2\/posts\/545\/revisions\/605"}],"wp:attachment":[{"href":"https:\/\/support.eprime.it\/index.php\/wp-json\/wp\/v2\/media?parent=545"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/support.eprime.it\/index.php\/wp-json\/wp\/v2\/categories?post=545"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/support.eprime.it\/index.php\/wp-json\/wp\/v2\/tags?post=545"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}