XC.Framework.Security.RSAUtil 1.0.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package XC.Framework.Security.RSAUtil --version 1.0.0                
NuGet\Install-Package XC.Framework.Security.RSAUtil -Version 1.0.0                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<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                
#r "nuget: XC.Framework.Security.RSAUtil, 1.0.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. 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                

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()
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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 90,195 3/6/2018
1.0.0 1,208 1/10/2018