XC.Framework.Security.RSAUtil 1.0.0

There is a newer version of this package available.
See the version list below for details.
Install-Package XC.Framework.Security.RSAUtil -Version 1.0.0
dotnet add package XC.Framework.Security.RSAUtil --version 1.0.0
<PackageReference Include="XC.Framework.Security.RSAUtil" Version="1.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add XC.Framework.Security.RSAUtil --version 1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: XC.Framework.Security.RSAUtil, 1.0.0"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install XC.Framework.Security.RSAUtil as a Cake Addin
#addin nuget:?package=XC.Framework.Security.RSAUtil&version=1.0.0

// Install XC.Framework.Security.RSAUtil as a Cake Tool
#tool nuget:?package=XC.Framework.Security.RSAUtil&version=1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

RSAUtil

.NET Core RSA algorithm using the help tool.It supports data encryption, decryption, signature and verification signature.It supports three key formats, namely: xml, pkcs1, pkcs8.It also supports key conversion for these three formats.Last also support pem formatting.

Doc

Generate the key

Use class RsaKeyGenerator.The result returned is a list of two-element strings,Element 1 is the private key and element 2 is the public key.

Format: XML

var keyList = RsaKeyGenerator.XmlKey(2048);
var privateKey = keyList[0];
var publicKey = keyList[1];

Format: Pkcs1

var keyList = RsaKeyGenerator.Pkcs1Key(2048);
var privateKey = keyList[0];
var publicKey = keyList[1];

Format: Pkcs8

var keyList = RsaKeyGenerator.Pkcs8Key(2048);
var privateKey = keyList[0];
var publicKey = keyList[1];

RSA key conversion

Use class RsaKeyConvert.It supports key conversion for these three formats,namely: xml, pkcs1, pkcs8.

XML->Pkcs1:
  • Private Key : RsaKeyConvert.PrivateKeyXmlToPkcs1()
  • Public Key : RsaKeyConvert.PublicKeyXmlToPem()
XML->Pkcs8:
  • Private Key : RsaKeyConvert.PrivateKeyXmlToPkcs8()
  • Public Key : RsaKeyConvert.PublicKeyXmlToPem()
Pkcs1->XML:
  • Private Key : RsaKeyConvert.PrivateKeyPkcs1ToXml()
  • Public Key : RsaKeyConvert.PublicKeyPemToXml()
Pkcs1->Pkcs8:
  • Private Key : RsaKeyConvert.PrivateKeyPkcs1ToPkcs8()
  • Public Key : No conversion required
Pkcs8->XML:
  • Private Key : RsaKeyConvert.PrivateKeyPkcs8ToXml()
  • Public Key : RsaKeyConvert.PublicKeyPemToXml()
Pkcs8->Pkcs1:
  • Private Key : RsaKeyConvert.PrivateKeyPkcs8ToPkcs1()
  • Public Key : No conversion required

Encrypt, decrypt, sign, and verify signatures

XML, Pkcs1, Pkcs8 respectively corresponding categories: RsaXmlUtil, RsaPkcs1Util, RsaPkcs8Util.They inherit from the abstract class RSAUtilBase

  • Encrypt: RSAUtilBase.Encrypt()
  • Decrypt: RSAUtilBase.Decrypt()
  • Sign: RSAUtilBase.SignData()
  • Verify: RSAUtilBase.VerifyData()

PEM formatting

Use class RsaPemFormatHelper.

  • Format Pkcs1 format private key: RsaPemFormatHelper.Pkcs1PrivateKeyFormat()
  • Remove the Pkcs1 format private key format: RsaPemFormatHelper.Pkcs1PrivateKeyFormatRemove()
  • Format Pkcs8 format private key: RsaPemFormatHelper.Pkcs8PrivateKeyFormat()
  • Remove the Pkcs8 format private key format: RsaPemFormatHelper.Pkcs8PrivateKeyFormatRemove()

NuGet packages (3)

Showing the top 3 NuGet packages that depend on XC.Framework.Security.RSAUtil:

Package Downloads
Ding.Encryption

Ding.Encryption是基于.net core平台开发的应用框架中的加密操作类库。

QMHS

Package Description

WSNet

Package Description

GitHub repositories (2)

Showing the top 2 popular GitHub repositories that depend on XC.Framework.Security.RSAUtil:

Repository Stars
dotnetcore/Alipay.AopSdk.Core
支付宝(Alipay)服务端SDK,采用.NET Standard 2.0,支持.NET Core >=2.0,与官方SDK接口完全相同。完全可以按照官方文档进行开发。除了支持支付以外,官方SDK支持的功能本SDK全部支持,比如生活号、服务窗、行业合作等,且用法几乎一样,代码都可参考官方文档代码。
feiyit/FytSoaCms
NetCore2.2开发, Vs2017 数据Mysql
Version Downloads Last updated
1.0.1 26,192 3/6/2018
1.0.0 760 1/10/2018