91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 779KB
    文件類型: .zip
    金幣: 2
    下載: 0 次
    發布日期: 2021-05-13
  • 語言: C#
  • 標簽: RSA加解密??

資源簡介

親測可用,可參考:https://blog.csdn.net/qq_37835111/article/details/87358779

資源截圖

代碼片段和文件信息

using?System;
using?System.Collections.Generic;
using?System.IO;
using?System.Security.Cryptography;
using?System.Text;

///?
///?描述:RSA公鑰加密私鑰解密工具類
///?功能:RSA公鑰加密、私鑰解密、私鑰簽名、公鑰驗簽??
///?作者:yoyohan
///?創建時間:2019-02-12?09:49:41
///?

public?sealed?class?RSACrypt1
{
????///???
????///?私鑰簽名??
????///?
??
????///?待簽名字符串??
????///?私鑰??
????///?編碼格式??
????///?簽名后字符串??
????public?static?string?sign(string?content?string?privateKey?string?input_charset)
????{
????????byte[]?Data?=?Encoding.GetEncoding(input_charset).GetBytes(content);
????????RSACryptoServiceProvider?rsa?=?DecodePemPrivateKey(privateKey);
????????SHA1?sh?=?new?SHA1CryptoServiceProvider();
????????byte[]?signData?=?rsa.SignData(Data?sh);
????????return?Convert.Tobase64String(signData);
????}

????///???
????///?公鑰驗簽??
????///?
??
????///?待驗簽字符串??
????///?簽名??
????///?公鑰??
????///?編碼格式??
????///?true(通過),false(不通過)??
????public?static?bool?verify(string?content?string?signedString?string?publicKey?string?input_charset)
????{
????????bool?result?=?false;
????????byte[]?Data?=?Encoding.GetEncoding(input_charset).GetBytes(content);
????????byte[]?data?=?Convert.Frombase64String(signedString);
????????RSAParameters?paraPub?=?ConvertFromPublicKey(publicKey);
????????RSACryptoServiceProvider?rsaPub?=?new?RSACryptoServiceProvider();
????????rsaPub.ImportParameters(paraPub);
????????SHA1?sh?=?new?SHA1CryptoServiceProvider();
????????result?=?rsaPub.VerifyData(Data?sh?data);
????????return?result;
????}

????///???
????///?公鑰加密??
????///?
??
????///?需要加密的字符串??
????///?公鑰??
????///?編碼格式??
????///?明文??
????public?static?string?encryptData(string?resData?string?publicKey?string?input_charset)
????{
????????byte[]?DataToEncrypt?=?Encoding.ASCII.GetBytes(resData);
????????string?result?=?encrypt(DataToEncrypt?publicKey?input_charset);
????????return?result;
????}


????///???
????///?私鑰解密??
????///?
??
????///?加密字符串??
????///?私鑰??
????///?編碼格式??
????///?明文??
????public?static?string?decryptData(string?resData?string?privateKey?string?input_charset)
????{
????????byte[]?DataToDecrypt?=?Convert.Frombase64String(resData);
????????string?result?=?““;
????????for?(int?j?=?0;?j?????????{
????????????byte[]?buf?=?new?byte[128];
????????????for?(int?i?=?0;?i?????????????{

????????????????

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件?????2371584??2018-04-08?23:30??RSATool\BouncyCastle.Crypto.dll
?????文件???????15569??2019-02-15?11:50??RSATool\RSACrypt1.cs
?????文件????????5394??2019-02-15?13:29??RSATool\RSACrypt2.cs
?????文件???????15628??2019-02-15?14:03??RSATool\微信截圖_20190215140253.png
?????目錄???????????0??2019-02-15?14:03??RSATool\

評論

共有 條評論