tiancao1001 于 2017-05-08 06:06 PM 发表评论: |
Imports System.Security.Cryptography Public Class Form1 Dim pubkey As String = "<RSAKeyValue><Modulus>xe3teTUwLgmbiwFJwWEQnshhKxgcasglGsfNVFTk0hdqKc9i7wb+gG7HOdPZLh65QyBcFfzdlrawwVkiPEL5kNTX1q3JW5J49mTVZqWd3w49reaLd8StHRYJdyGAL4ZovBhSTThETi+zYvgQ5SvCGkM6/xXOz+lkMaEgeFcjQQs=</Modulus><Exponent>AQAB</Exponent></RSAKeyValue>" Dim prikey As String = "<RSAKeyValue><Modulus>xe3teTUwLgmbiwFJwWEQnshhKxgcasglGsfNVFTk0hdqKc9i7wb+gG7HOdPZLh65QyBcFfzdlrawwVkiPEL5kNTX1q3JW5J49mTVZqWd3w49reaLd8StHRYJdyGAL4ZovBhSTThETi+zYvgQ5SvCGkM6/xXOz+lkMaEgeFcjQQs=</Modulus><Exponent>AQAB</Exponent><P>5flMAd7IrUTx92yomBdJBPDzp1Kclpaw4uXB1Ht+YXqwLW/9icI6mcv7d2O0kuVLSWj8DPZJol9V8AtvHkC3oQ==</P><Q>3FRA9UWcFrVPvGR5bewcL7YqkCMZlybV/t6nCH+gyMfbEvgk+p04F+j8WiHDykWj+BahjScjwyF5SGADbrfJKw==</Q><DP>b4WOU1XbERNfF3JM67xW/5ttPNX185zN2Ko8bbMZXWImr1IgrD5RNqXRo1rphVbGRKoxmIOSv7flr8uLrisKIQ==</DP><DQ>otSZlSq2qomgvgg7PaOLSS+F0TQ/i1emO0/tffhkqT4ah7BgE97xP6puJWZivjAteAGxrxHH+kPY0EY1AzRMNQ==</DQ><InverseQ>Sxyz0fEf5m7GrzAngLDRP/i+QDikJFfM6qPyr3Ub6Y5RRsFbeOWY1tX3jmV31zv4cgJ6donH7W2dSBPi67sSsw==</InverseQ><D>nVqofsIgSZltxTcC8fA/DFz1kxMaFHKFvSK3RKIxQC1JQ3ASkUEYN/baAElB0f6u/oTNcNWVPOqE31IDe7ErQelVc4D26RgFd5V7dSsF3nVz00s4mq1qUBnCBLPIrdb0rcQZ8FUQTsd96qW8Foave4tm8vspbM65iVUBBVdSYYE=</D></RSAKeyValue>" Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Using rsa As New RSACryptoServiceProvider() rsa.FromXmlString(prikey) ' 加密对象 Dim f As New RSAPKCS1SignatureFormatter(rsa) f.SetHashAlgorithm("SHA1") Dim source As Byte() = System.Text.ASCIIEncoding.ASCII.GetBytes(TextBox1.Text) Dim sha As New SHA1Managed() Dim result As Byte() = sha.ComputeHash(source) Dim s As String = Convert.ToBase64String(result) MsgBox(s) Dim b As Byte() = f.CreateSignature(result) TextBox2.Text = "" TextBox2.Text = Convert.ToBase64String(b) End Using TextBox3.Text = pubkey TextBox4.Text = prikey End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click Using rsa As New RSACryptoServiceProvider() rsa.FromXmlString(pubkey) Dim f As New RSAPKCS1SignatureDeformatter(rsa) f.SetHashAlgorithm("SHA1") Dim key As Byte() = Convert.FromBase64String(TextBox2.Text) Dim sha As New SHA1Managed() Dim name As Byte() = sha.ComputeHash(System.Text.ASCIIEncoding.ASCII.GetBytes(TextBox1.Text)) Dim s As String = Convert.ToBase64String(name) MsgBox(s) If f.VerifySignature(name, key) Then MessageBox.Show("Succese!") Else MessageBox.Show("Falied!") End If End Using End Sub End Class
|
|
查看所评论的日志:vb.net中使用RSA编写注册码验证 |
tiancao1001 于 2016-10-13 07:35 PM 发表评论: |
|
查看所评论的日志:托儿所、幼儿园建筑设计规范.JGJ39-2016.pdf |
tiancao1001 于 2016-06-01 01:23 PM 发表评论: |
类似电影: 日本.北野武.《菊次郎的夏天》 《中央车站》 |
|
查看所评论的日志:张丰毅《跟我走一回》 没根草 |
tiancao1001 于 2016-04-09 01:21 PM 发表评论: |
|
查看所评论的日志:电影 霸王别姬 |
tiancao1001 于 2016-04-09 01:19 PM 发表评论: |
|
查看所评论的日志:电影 霸王别姬 |
tiancao1001 于 2016-04-09 01:19 PM 发表评论: |
传于吾辈门人,诸生须当敬听; 自古人生于世,须有一计之能。 吾辈既务斯业,便当专心用功。 以后名扬四海,根据即在年轻。 何况尔诸小子,都非蠢笨愚蒙; 并且所授功课,又非勉强而行? 此刻不务正业,将来老大无成, 若听外人煽惑,终久荒废一生! 尔等父母兄弟,谁不盼尔成名? 况值讲求自立,正是寰宇竞争。 至于交结朋友,亦在五伦之中, 皆因尔等年幼,哪知世路难生! 交友稍不慎重,狐群狗党相迎, 渐渐吃喝piao赌,以至无恶不生: 文的嗓音一坏,武的功夫一扔, 彼时若呼朋友,一个也不应声! 自己名誉失败,方觉惭愧难容。 若到那般时候,后悔也是不成。 并有忠言几句,门人务必遵行, 说破其中利害,望尔日上蒸蒸。 |
|
查看所评论的日志:电影 霸王别姬 |
tiancao1001 于 2015-12-18 07:34 PM 发表评论: |
|
查看所评论的日志:门式刚架轻型房屋钢结构技术规范.GB51022-2015.pdf |
tiancao1001 于 2015-09-27 10:30 PM 发表评论: |
|
查看所评论的日志:AutoCAD VBA 二次开发教程源码 |