.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.
.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.
Thanks for onovotny's bc-csharp
Install-Package XC.RSAUtil
The old package name is
XC.Framework.Security.RSAUtil
. Now renamedXC.RSAUtil
and will continue to use.
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];
Use class
RsaKeyConvert
.It supports key conversion for these three formats,namely: xml, pkcs1, pkcs8.
RsaKeyConvert.PrivateKeyXmlToPkcs1()
RsaKeyConvert.PublicKeyXmlToPem()
RsaKeyConvert.PrivateKeyXmlToPkcs8()
RsaKeyConvert.PublicKeyXmlToPem()
RsaKeyConvert.PrivateKeyPkcs1ToXml()
RsaKeyConvert.PublicKeyPemToXml()
RsaKeyConvert.PrivateKeyPkcs1ToPkcs8()
RsaKeyConvert.PrivateKeyPkcs8ToXml()
RsaKeyConvert.PublicKeyPemToXml()
RsaKeyConvert.PrivateKeyPkcs8ToPkcs1()
XML, Pkcs1, Pkcs8 respectively corresponding categories:
RsaXmlUtil
,RsaPkcs1Util
,RsaPkcs8Util
.They inherit from the abstract classRSAUtilBase
RSAUtilBase.Encrypt()
RSAUtilBase.Decrypt()
RSAUtilBase.SignData()
RSAUtilBase.VerifyData()
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()
bc-csharp - onovotny
dotnetrsa - DotnetRSA is a .NET Core Global Tool.Dotnet RSA Tool can help you generate xml pkcs1, pkcs8 three kinds of format keys, and supports three types of mutual conversion.