mirror of
https://gitee.com/durcframework/SOP.git
synced 2025-08-12 07:02:14 +08:00
添加C#sdk
This commit is contained in:
47
sop-sdk/sdk-csharp/SDKCSharp/Utility/RSAUtil.cs
Normal file
47
sop-sdk/sdk-csharp/SDKCSharp/Utility/RSAUtil.cs
Normal file
@@ -0,0 +1,47 @@
|
||||
using System;
|
||||
using System.Xml;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
|
||||
using Org.BouncyCastle.Asn1.Pkcs;
|
||||
using Org.BouncyCastle.Asn1.X509;
|
||||
using Org.BouncyCastle.Crypto.Generators;
|
||||
using Org.BouncyCastle.Crypto.Parameters;
|
||||
using Org.BouncyCastle.Math;
|
||||
using Org.BouncyCastle.Pkcs;
|
||||
using Org.BouncyCastle.Security;
|
||||
using Org.BouncyCastle.Crypto.Engines;
|
||||
using Org.BouncyCastle.X509;
|
||||
using Org.BouncyCastle.Crypto;
|
||||
using Org.BouncyCastle.Asn1;
|
||||
using Org.BouncyCastle.Crypto.Encodings;
|
||||
|
||||
namespace SDKCSharp.Utility
|
||||
{
|
||||
public class RSAUtil
|
||||
{
|
||||
|
||||
static Encoding UTF8 = Encoding.UTF8;
|
||||
static RSA rsa = new RSA();
|
||||
|
||||
/// <summary>
|
||||
/// 私钥加密
|
||||
/// </summary>
|
||||
/// <returns>The by private key.</returns>
|
||||
/// <param name="data">内容.</param>
|
||||
/// <param name="privateKey">私钥.</param>
|
||||
public static string EncryptByPrivateKey(string data, string privateKey)
|
||||
{
|
||||
return rsa.EncryptByPrivateKey(data, privateKey);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
Reference in New Issue
Block a user