RSA加密解密及RSA签名和验证及证书
RSA加密解密及RSA签名和验证及证书
- 公钥是给别人的
- 发送密文使用公钥加密
- 验证签名使用公钥验证
- 私钥是自己保留的
- 接受密文使用私钥解密
- 发送签名使用私钥签名
- 上述过程逆转是不行的,比如使用私钥加密,使用公钥解密是不行的
- 证书的制作参考自使用X.509数字证书加密解密实务(一)-- 证书的获得和管理
- 打开VS开发命令,输入下面的命令:
makecert -sr CurrentUser -ss My -n CN=MyTestCert -sky exchange -pe
- 从证书中读取私钥和公钥:


/// <summary>
/// 根据私钥证书得到证书实体,得到实体后可以根据其公钥和私钥进行加解密
/// 加解密函数使用DEncrypt的RSACryption类
/// </summary>
/// <param name="pfxFileName"></param>
/// <param name="password"></param>
/// <returns></returns>
public static X509Certificate2 GetCertificateFromPfxFile(string pfxFileName,
string password)
{
try
{
return new X509Certificate2(pfxFileName, password, X509KeyStorageFlags.Exportable);
}
catch (Exception e)
{
return null;
}
}


var cer= RSACryption.GetCertificateFromPfxFile(@"D:\my.pfx", "123456");
tbPrivateKey.Text = cer.PrivateKey.ToXmlString(true);
tbPublicKey.Text = cer.PublicKey.Key.ToXmlString(false);
完整测试代码:
WPF前端:


<Window x:Class="Security.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:Security"
mc:Ignorable="d"
Title="MainWindow" Height="700" Width="1200">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="auto"></RowDefinition>
<RowDefinition Height="auto"></RowDefinition>
<RowDefinition Height="auto"></RowDefinition>
<RowDefinition Height="auto"></RowDefinition>
<RowDefinition Height="auto"></RowDefinition>
<RowDefinition Height="auto"></RowDefinition>
<RowDefinition Height="auto"></RowDefinition>
<RowDefinition Height="auto"></RowDefinition>
<RowDefinition Height="auto"></RowDefinition>
</Grid.RowDefinitions>
<StackPanel Margin="3" Orientation="Horizontal" HorizontalAlignment="Left">
<Button Margin="3" Name="GenerateKeys" Click="GenerateKeys_Click">生成Key</Button>
<Button Margin="3" Name="Encrypt" Click="Encrypt_Click">公钥加密</Button>
<Button Margin="3" Name="Decrypt" Click="Decrypt_Click">私钥解密</Button>
<Button Margin="3" Name="GetHash" Click="GetHash_Click">获取Hash</Button>
<Button Margin="3" Name="Sign" Click="Sign_Click">私钥签名</Button>
<Button Margin="3" Name="ValidateSign" Click="ValidateSign_Click">签名验证</Button>
<Button Margin="3" Name="InputPfx" Click="InputPfx_Click">导入证书</Button>
<Button Margin="3" Name="EcryptByPrivateKey" Click="EcryptByPrivateKey_Click">私钥加密</Button>
<Button Margin="3" Name="DcryptByPrivateKey" Click="DcryptByPrivateKey_Click">公钥解密</Button>
</StackPanel>
<StackPanel Grid.Row="1" Margin="3">
<TextBlock Margin="3">公钥:</TextBlock>
<TextBox Name="tbPublicKey" TextWrapping="Wrap" MinLines="2" Margin="3"></TextBox>
</StackPanel>
<StackPanel Grid.Row="2" Margin="3">
<TextBlock Margin="3">私钥:</TextBlock>
<TextBox Name="tbPrivateKey" TextWrapping="Wrap" MinLines="5" Margin="3"></TextBox>
</StackPanel>
<StackPanel Grid.Row="3" Margin="3">
<TextBlock Margin="3">待加密内容:</TextBlock>
<TextBox Name="tbContent" TextWrapping="Wrap" MinLines="3" Margin="3">i am cypher</TextBox>
</StackPanel>
<StackPanel Grid.Row="4" Margin="3">
<TextBlock Margin="3">公钥加密后内容:</TextBlock>
<TextBox Name="tbEncryptContent" TextWrapping="Wrap" MinLines="2" Margin="3"></TextBox>
</StackPanel>
<StackPanel Grid.Row="5" Margin="3">
<TextBlock Margin="3">私钥解密后内容:</TextBlock>
<TextBox Name="tbDecryptContent" TextWrapping="Wrap" Margin="3"></TextBox>
</StackPanel>
<StackPanel Grid.Row="6" Margin="3">
<TextBlock Margin="3">Hash:</TextBlock>
<TextBox Name="tbHash" Margin="3"></TextBox>
</StackPanel>
<StackPanel Grid.Row="7" Margin="3">
<TextBlock Margin="3">私钥签名后内容:</TextBlock>
<TextBox Name="tbSign" TextWrapping="Wrap" MinLines="2" Margin="3"></TextBox>
</StackPanel>
<StackPanel Grid.Row="8" Margin="3">
<TextBlock Margin="3">公钥签名验证:</TextBlock>
<TextBox Name="tbValidateSign" TextWrapping="Wrap" Margin="3"></TextBox>
</StackPanel>
</Grid>
</Window>
后端:


public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
} private void GenerateKeys_Click(object sender, RoutedEventArgs e)
{
string privateKey = "";
string publicKey = "";
RSACryption.GenerateKey(out privateKey, out publicKey);
tbPrivateKey.Text = privateKey;
tbPublicKey.Text = publicKey;
} private void Encrypt_Click(object sender, RoutedEventArgs e)
{
tbEncryptContent.Text = RSACryption.RSAEncrypt(tbPublicKey.Text, tbContent.Text);
} private void Decrypt_Click(object sender, RoutedEventArgs e)
{
tbDecryptContent.Text = RSACryption.RSADecrypt(tbPrivateKey.Text, tbEncryptContent.Text);
} private void Sign_Click(object sender, RoutedEventArgs e)
{
tbSign.Text = RSACryption.GetSignature(tbPrivateKey.Text, tbHash.Text);
} private void GetHash_Click(object sender, RoutedEventArgs e)
{
tbHash.Text = RSACryption.GetHash(tbContent.Text);
} private void ValidateSign_Click(object sender, RoutedEventArgs e)
{
tbValidateSign.Text = RSACryption.ValidateSignature(tbPublicKey.Text, tbHash.Text, tbSign.Text).ToString();
} private void InputPfx_Click(object sender, RoutedEventArgs e)
{
var cer= RSACryption.GetCertificateFromPfxFile(@"D:\my.pfx", "123456");
tbPrivateKey.Text = cer.PrivateKey.ToXmlString(true);
tbPublicKey.Text = cer.PublicKey.Key.ToXmlString(false);
} private void EcryptByPrivateKey_Click(object sender, RoutedEventArgs e)
{
tbEncryptContent.Text = RSACryption.RSAEncrypt(tbPrivateKey.Text, tbContent.Text);
} private void DcryptByPrivateKey_Click(object sender, RoutedEventArgs e)
{
tbDecryptContent.Text = RSACryption.RSADecrypt(tbPublicKey.Text, tbEncryptContent.Text);
}
}
附上转自飛雲若雪的代码:


class RSACryption
{
#region RSA 加密解密 #region RSA 的密钥产生
/// <summary>
/// RSA产生密钥
/// </summary>
/// <param name="xmlKeys">私钥</param>
/// <param name="xmlPublicKey">公钥</param>
public void RSAKey(out string xmlKeys, out string xmlPublicKey)
{
try
{
System.Security.Cryptography.RSACryptoServiceProvider rsa = new RSACryptoServiceProvider();
xmlKeys = rsa.ToXmlString(true);
xmlPublicKey = rsa.ToXmlString(false);
}
catch (Exception ex)
{
throw ex;
}
}
#endregion #region RSA加密函数
//##############################################################################
//RSA 方式加密
//KEY必须是XML的形式,返回的是字符串
//该加密方式有长度限制的!
//############################################################################## /// <summary>
/// RSA的加密函数
/// </summary>
/// <param name="xmlPublicKey">公钥</param>
/// <param name="encryptString">待加密的字符串</param>
/// <returns></returns>
public string RSAEncrypt(string xmlPublicKey, string encryptString)
{
try
{
byte[] PlainTextBArray;
byte[] CypherTextBArray;
string Result;
System.Security.Cryptography.RSACryptoServiceProvider rsa = new RSACryptoServiceProvider();
rsa.FromXmlString(xmlPublicKey);
PlainTextBArray = (new UnicodeEncoding()).GetBytes(encryptString);
CypherTextBArray = rsa.Encrypt(PlainTextBArray, false);
Result = Convert.ToBase64String(CypherTextBArray);
return Result;
}
catch (Exception ex)
{
throw ex;
}
}
/// <summary>
/// RSA的加密函数
/// </summary>
/// <param name="xmlPublicKey">公钥</param>
/// <param name="EncryptString">待加密的字节数组</param>
/// <returns></returns>
public string RSAEncrypt(string xmlPublicKey, byte[] EncryptString)
{
try
{
byte[] CypherTextBArray;
string Result;
System.Security.Cryptography.RSACryptoServiceProvider rsa = new RSACryptoServiceProvider();
rsa.FromXmlString(xmlPublicKey);
CypherTextBArray = rsa.Encrypt(EncryptString, false);
Result = Convert.ToBase64String(CypherTextBArray);
return Result;
}
catch (Exception ex)
{
throw ex;
}
}
#endregion #region RSA的解密函数
/// <summary>
/// RSA的解密函数
/// </summary>
/// <param name="xmlPrivateKey">私钥</param>
/// <param name="decryptString">待解密的字符串</param>
/// <returns></returns>
public string RSADecrypt(string xmlPrivateKey, string decryptString)
{
try
{
byte[] PlainTextBArray;
byte[] DypherTextBArray;
string Result;
System.Security.Cryptography.RSACryptoServiceProvider rsa = new RSACryptoServiceProvider();
rsa.FromXmlString(xmlPrivateKey);
PlainTextBArray = Convert.FromBase64String(decryptString);
DypherTextBArray = rsa.Decrypt(PlainTextBArray, false);
Result = (new UnicodeEncoding()).GetString(DypherTextBArray);
return Result;
}
catch (Exception ex)
{
throw ex;
}
}
/// <summary>
/// RSA的解密函数
/// </summary>
/// <param name="xmlPrivateKey">私钥</param>
/// <param name="DecryptString">待解密的字节数组</param>
/// <returns></returns>
public string RSADecrypt(string xmlPrivateKey, byte[] DecryptString)
{
try
{
byte[] DypherTextBArray;
string Result;
System.Security.Cryptography.RSACryptoServiceProvider rsa = new RSACryptoServiceProvider();
rsa.FromXmlString(xmlPrivateKey);
DypherTextBArray = rsa.Decrypt(DecryptString, false);
Result = (new UnicodeEncoding()).GetString(DypherTextBArray);
return Result;
}
catch (Exception ex)
{
throw ex;
}
}
#endregion #endregion #region RSA数字签名 #region 获取Hash描述表
/// <summary>
/// 获取Hash描述表
/// </summary>
/// <param name="strSource">待签名的字符串</param>
/// <param name="HashData">Hash描述</param>
/// <returns></returns>
public bool GetHash(string strSource, ref byte[] HashData)
{
try
{
byte[] Buffer;
System.Security.Cryptography.HashAlgorithm MD5 = System.Security.Cryptography.HashAlgorithm.Create("MD5");
Buffer = System.Text.Encoding.GetEncoding("GB2312").GetBytes(strSource);
HashData = MD5.ComputeHash(Buffer);
return true;
}
catch (Exception ex)
{
throw ex;
}
} /// <summary>
/// 获取Hash描述表
/// </summary>
/// <param name="strSource">待签名的字符串</param>
/// <param name="strHashData">Hash描述</param>
/// <returns></returns>
public bool GetHash(string strSource, ref string strHashData)
{
try
{
//从字符串中取得Hash描述
byte[] Buffer;
byte[] HashData;
System.Security.Cryptography.HashAlgorithm MD5 = System.Security.Cryptography.HashAlgorithm.Create("MD5");
Buffer = System.Text.Encoding.GetEncoding("GB2312").GetBytes(strSource);
HashData = MD5.ComputeHash(Buffer);
strHashData = Convert.ToBase64String(HashData);
return true;
}
catch (Exception ex)
{
throw ex;
}
} /// <summary>
/// 获取Hash描述表
/// </summary>
/// <param name="objFile">待签名的文件</param>
/// <param name="HashData">Hash描述</param>
/// <returns></returns>
public bool GetHash(System.IO.FileStream objFile, ref byte[] HashData)
{
try
{
//从文件中取得Hash描述
System.Security.Cryptography.HashAlgorithm MD5 = System.Security.Cryptography.HashAlgorithm.Create("MD5");
HashData = MD5.ComputeHash(objFile);
objFile.Close();
return true;
}
catch (Exception ex)
{
throw ex;
}
} /// <summary>
/// 获取Hash描述表
/// </summary>
/// <param name="objFile">待签名的文件</param>
/// <param name="strHashData">Hash描述</param>
/// <returns></returns>
public bool GetHash(System.IO.FileStream objFile, ref string strHashData)
{
try
{
//从文件中取得Hash描述
byte[] HashData;
System.Security.Cryptography.HashAlgorithm MD5 = System.Security.Cryptography.HashAlgorithm.Create("MD5");
HashData = MD5.ComputeHash(objFile);
objFile.Close();
strHashData = Convert.ToBase64String(HashData);
return true;
}
catch (Exception ex)
{
throw ex;
}
}
#endregion #region RSA签名
/// <summary>
/// RSA签名
/// </summary>
/// <param name="strKeyPrivate">私钥</param>
/// <param name="HashbyteSignature">待签名Hash描述</param>
/// <param name="EncryptedSignatureData">签名后的结果</param>
/// <returns></returns>
public bool SignatureFormatter(string strKeyPrivate, byte[] HashbyteSignature, ref byte[] EncryptedSignatureData)
{
try
{
System.Security.Cryptography.RSACryptoServiceProvider RSA = new System.Security.Cryptography.RSACryptoServiceProvider(); RSA.FromXmlString(strKeyPrivate);
System.Security.Cryptography.RSAPKCS1SignatureFormatter RSAFormatter = new System.Security.Cryptography.RSAPKCS1SignatureFormatter(RSA);
//设置签名的算法为MD5
RSAFormatter.SetHashAlgorithm("MD5");
//执行签名
EncryptedSignatureData = RSAFormatter.CreateSignature(HashbyteSignature);
return true;
}
catch (Exception ex)
{
throw ex;
}
} /// <summary>
/// RSA签名
/// </summary>
/// <param name="strKeyPrivate">私钥</param>
/// <param name="HashbyteSignature">待签名Hash描述</param>
/// <param name="m_strEncryptedSignatureData">签名后的结果</param>
/// <returns></returns>
public bool SignatureFormatter(string strKeyPrivate, byte[] HashbyteSignature, ref string strEncryptedSignatureData)
{
try
{
byte[] EncryptedSignatureData;
System.Security.Cryptography.RSACryptoServiceProvider RSA = new System.Security.Cryptography.RSACryptoServiceProvider();
RSA.FromXmlString(strKeyPrivate);
System.Security.Cryptography.RSAPKCS1SignatureFormatter RSAFormatter = new System.Security.Cryptography.RSAPKCS1SignatureFormatter(RSA);
//设置签名的算法为MD5
RSAFormatter.SetHashAlgorithm("MD5");
//执行签名
EncryptedSignatureData = RSAFormatter.CreateSignature(HashbyteSignature);
strEncryptedSignatureData = Convert.ToBase64String(EncryptedSignatureData);
return true;
}
catch (Exception ex)
{
throw ex;
}
} /// <summary>
/// RSA签名
/// </summary>
/// <param name="strKeyPrivate">私钥</param>
/// <param name="strHashbyteSignature">待签名Hash描述</param>
/// <param name="EncryptedSignatureData">签名后的结果</param>
/// <returns></returns>
public bool SignatureFormatter(string strKeyPrivate, string strHashbyteSignature, ref byte[] EncryptedSignatureData)
{
try
{
byte[] HashbyteSignature; HashbyteSignature = Convert.FromBase64String(strHashbyteSignature);
System.Security.Cryptography.RSACryptoServiceProvider RSA = new System.Security.Cryptography.RSACryptoServiceProvider(); RSA.FromXmlString(strKeyPrivate);
System.Security.Cryptography.RSAPKCS1SignatureFormatter RSAFormatter = new System.Security.Cryptography.RSAPKCS1SignatureFormatter(RSA);
//设置签名的算法为MD5
RSAFormatter.SetHashAlgorithm("MD5");
//执行签名
EncryptedSignatureData = RSAFormatter.CreateSignature(HashbyteSignature); return true;
}
catch (Exception ex)
{
throw ex;
}
} /// <summary>
/// RSA签名
/// </summary>
/// <param name="strKeyPrivate">私钥</param>
/// <param name="strHashbyteSignature">待签名Hash描述</param>
/// <param name="strEncryptedSignatureData">签名后的结果</param>
/// <returns></returns>
public bool SignatureFormatter(string strKeyPrivate, string strHashbyteSignature, ref string strEncryptedSignatureData)
{
try
{
byte[] HashbyteSignature;
byte[] EncryptedSignatureData;
HashbyteSignature = Convert.FromBase64String(strHashbyteSignature);
System.Security.Cryptography.RSACryptoServiceProvider RSA = new System.Security.Cryptography.RSACryptoServiceProvider();
RSA.FromXmlString(strKeyPrivate);
System.Security.Cryptography.RSAPKCS1SignatureFormatter RSAFormatter = new System.Security.Cryptography.RSAPKCS1SignatureFormatter(RSA);
//设置签名的算法为MD5
RSAFormatter.SetHashAlgorithm("MD5");
//执行签名
EncryptedSignatureData = RSAFormatter.CreateSignature(HashbyteSignature);
strEncryptedSignatureData = Convert.ToBase64String(EncryptedSignatureData);
return true;
}
catch (Exception ex)
{
throw ex;
}
}
#endregion #region RSA 签名验证
/// <summary>
/// RSA签名验证
/// </summary>
/// <param name="strKeyPublic">公钥</param>
/// <param name="HashbyteDeformatter">Hash描述</param>
/// <param name="DeformatterData">签名后的结果</param>
/// <returns></returns>
public bool SignatureDeformatter(string strKeyPublic, byte[] HashbyteDeformatter, byte[] DeformatterData)
{
try
{
System.Security.Cryptography.RSACryptoServiceProvider RSA = new System.Security.Cryptography.RSACryptoServiceProvider();
RSA.FromXmlString(strKeyPublic);
System.Security.Cryptography.RSAPKCS1SignatureDeformatter RSADeformatter = new System.Security.Cryptography.RSAPKCS1SignatureDeformatter(RSA);
//指定解密的时候HASH算法为MD5
RSADeformatter.SetHashAlgorithm("MD5");
if (RSADeformatter.VerifySignature(HashbyteDeformatter, DeformatterData))
{
return true;
}
else
{
return false;
}
}
catch (Exception ex)
{
throw ex;
}
}
/// <summary>
/// RSA签名验证
/// </summary>
/// <param name="strKeyPublic">公钥</param>
/// <param name="strHashbyteDeformatter">Hash描述</param>
/// <param name="DeformatterData">签名后的结果</param>
/// <returns></returns>
public bool SignatureDeformatter(string strKeyPublic, string strHashbyteDeformatter, byte[] DeformatterData)
{
try
{
byte[] HashbyteDeformatter;
HashbyteDeformatter = Convert.FromBase64String(strHashbyteDeformatter);
System.Security.Cryptography.RSACryptoServiceProvider RSA = new System.Security.Cryptography.RSACryptoServiceProvider();
RSA.FromXmlString(strKeyPublic);
System.Security.Cryptography.RSAPKCS1SignatureDeformatter RSADeformatter = new System.Security.Cryptography.RSAPKCS1SignatureDeformatter(RSA);
//指定解密的时候HASH算法为MD5
RSADeformatter.SetHashAlgorithm("MD5");
if (RSADeformatter.VerifySignature(HashbyteDeformatter, DeformatterData))
{
return true;
}
else
{
return false;
}
}
catch (Exception ex)
{
throw ex;
}
}
/// <summary>
/// RSA签名验证
/// </summary>
/// <param name="strKeyPublic">公钥</param>
/// <param name="HashbyteDeformatter">Hash描述</param>
/// <param name="strDeformatterData">签名后的结果</param>
/// <returns></returns>
public bool SignatureDeformatter(string strKeyPublic, byte[] HashbyteDeformatter, string strDeformatterData)
{
try
{
byte[] DeformatterData;
System.Security.Cryptography.RSACryptoServiceProvider RSA = new System.Security.Cryptography.RSACryptoServiceProvider();
RSA.FromXmlString(strKeyPublic);
System.Security.Cryptography.RSAPKCS1SignatureDeformatter RSADeformatter = new System.Security.Cryptography.RSAPKCS1SignatureDeformatter(RSA);
//指定解密的时候HASH算法为MD5
RSADeformatter.SetHashAlgorithm("MD5");
DeformatterData = Convert.FromBase64String(strDeformatterData);
if (RSADeformatter.VerifySignature(HashbyteDeformatter, DeformatterData))
{
return true;
}
else
{
return false;
}
}
catch (Exception ex)
{
throw ex;
}
}
/// <summary>
/// RSA签名验证
/// </summary>
/// <param name="strKeyPublic">公钥</param>
/// <param name="strHashbyteDeformatter">Hash描述</param>
/// <param name="strDeformatterData">签名后的结果</param>
/// <returns></returns>
public bool SignatureDeformatter(string strKeyPublic, string strHashbyteDeformatter, string strDeformatterData)
{
try
{
byte[] DeformatterData;
byte[] HashbyteDeformatter;
HashbyteDeformatter = Convert.FromBase64String(strHashbyteDeformatter);
System.Security.Cryptography.RSACryptoServiceProvider RSA = new System.Security.Cryptography.RSACryptoServiceProvider();
RSA.FromXmlString(strKeyPublic);
System.Security.Cryptography.RSAPKCS1SignatureDeformatter RSADeformatter = new System.Security.Cryptography.RSAPKCS1SignatureDeformatter(RSA);
//指定解密的时候HASH算法为MD5
RSADeformatter.SetHashAlgorithm("MD5");
DeformatterData = Convert.FromBase64String(strDeformatterData);
if (RSADeformatter.VerifySignature(HashbyteDeformatter, DeformatterData))
{
return true;
}
else
{
return false;
}
}
catch (Exception ex)
{
throw ex;
}
}
#endregion #endregion }
RSA加密解密及RSA签名和验证及证书的更多相关文章
- RSA加密解密及RSA签名和验证
原文:RSA加密解密及RSA签名和验证 1.RSA加密解密: (1)获取密钥,这里是产生密钥,实际应用中可以从各种存储介质上读取密钥 (2)加密 (3)解密2.RSA签名和验证 (1)获取密钥,这里是 ...
- RSA加密解密及RSA加签验签
RSA安全性应用场景说明 在刚接触RSA的时候,会混淆RSA加密解密和RSA加签验签的概念.简单来说加密解密是公钥加密私钥解密,持有公钥(多人持有)可以对数据加密,但是只有持有私钥(一人持有)才可以解 ...
- Cryptopp iOS 使用 RSA加密解密和签名验证签名
Cryptopp 是一个c++写的功能完善的密码学工具,类似于openssl 官网:https://www.cryptopp.com 以下主要演示Cryptopp 在iOS上的RSA加密解密签名与验证 ...
- RSA 加密 解密 公钥 私钥 签名 加签 验签
http://blog.csdn.net/21aspnet/article/details/7249401# http://www.ruanyifeng.com/blog/2013/06/rsa_al ...
- openssl 非对称加密 RSA 加密解密以及签名验证签名
1. 简介 openssl rsa.h 提供了密码学中公钥加密体系的一些接口, 本文主要讨论利用rsa.h接口开发以下功能 公钥私钥的生成 公钥加密,私钥解密 私钥加密,公钥解密 签名:私钥签名 验 ...
- 银联手机支付(.Net Csharp),3DES加密解密,RSA加密解密,RSA私钥加密公钥解密,.Net RSA 3DES C#
前段时间做的银联支付,折腾了好久,拼凑的一些代码,有需要的朋友可以参考,本人.Net新手,不保证准确性! 这个银联手机支付没有SDK提供,技术支持也没有.Net的,真心不好搞! RSA加解密,这里有个 ...
- RSA加密解密和读取公钥、私钥
/// <summary> /// RSA加密解密及RSA签名和验证 /// </summary> public class RSADE { ...
- RSA加密解密(转)
RSA加密解密 对于RSA产生的公钥.私钥,我们可以有两种方式可以对信息进行加密解密.私钥加密-公钥解密 和 公钥加密-私钥解密RSA公钥加密算法是1977年由罗纳德·李维斯特(Ron Rivest) ...
- C#-java RSA加密解密
using Org.BouncyCastle.Math; using Org.BouncyCastle.Crypto.Parameters; using Org.BouncyCastle.Securi ...
随机推荐
- ES6+Webpack 下使用 Web Worker
大家都知道 HTML 5 新增了很多 API,其中就包括 Web Worker,在普通的 js 文件上使用 ES5 编写相关代码应该是完全没有问题了,只需要在支持 H5 的浏览器上就能跑起来. 那如果 ...
- P3905 道路重建
P3905 道路重建我一开始想错了,我的是类似kruskal,把毁坏的边从小到大加,并且判断联通性.但是这有一个问题,你可能会多加,就是这条边没用,但是它比较小,你也加上了.居然还有10分,数据也是水 ...
- 005.iSCSI客户端配置示例-Windows
一 环境 Linux作为iSCSI服务端,Windows2008R2作为iSCSI客户端 二 服务端配置过程 2.1 客户端配置 在Linux上参照之前的配置建立三个LUN卷作为共享盘,最终配置如下: ...
- 001.DHCP简介
一 DHCP概念 DHCP指动态主机配置协议,是一个局域网的网络协议,使用UDP协议工作. 二 应用 为大量客户机自动分配地址,提供集中管理 减轻管理和维护成本,提高网络配置效率 三 分配的主要信息 ...
- MySQL 5.7基于GTID复制的常见问题和修复步骤(一)
[问题一] 复制slave报错1236,是较为常见的一种报错 Got fatal error 1236 from master when reading data from binary log: ' ...
- KNN与SVM对比&SVM与逻辑回归的对比
首先说一下两种学习方式: lazy learning 和 eager learning. 先说 eager learning, 这种学习方式是指在进行某种判断(例如,确定一个点的分类或者回归中确定 ...
- 模板 图的遍历 bfs+dfs 图的最短路径 Floyed+Dijkstra
广搜 bfs //bfs #include<iostream> #include<cstdio> using namespace std; ],top=,end=; ][]; ...
- 微信小程序自定义音频组件,自定义滚动条,单曲循环,循环播放
小程序自定义音频组件,带滚动条 摘要:首先自定义音频组件,是因为产品有这样的需求,需要如下样式的 而微信小程序API给我们提供的就是这样的 而且产品需要小程序有后台播放功能,所以我们不考虑小程序的 a ...
- 使用 IntraWeb (13) - 基本控件之 TIWLabel、TIWLink、TIWURL、TIWURLWindow
TIWLabel // TIWLink //内部链接 TIWURL //外部链接 TIWURLWindow //页内框架, 就是 <iframe></iframe> TIWLa ...
- Eclipse配置开发Go的插件——Goclipse
引言: 上篇 <Golang快速入门(不用急,但要快)> 我们大致过了一遍Go语言的基本语法,但在开始正式的项目创建前,有必要选择一个比较顺手的 IDE (编辑器),由于之前一直都是做Ja ...