• Stars
    star
    281
  • Rank 147,023 (Top 3 %)
  • Language
    C#
  • License
    MIT License
  • Created almost 7 years ago
  • Updated 3 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

.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.

RSAUtil 中文文档

Build Status

.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

Latest version

Install

Install-Package XC.RSAUtil

The old package name is XC.Framework.Security.RSAUtil. Now renamed XC.RSAUtil and will continue to use.

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()

Reference component

bc-csharp - onovotny

Cases

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.

More Repositories

1

azure-openai-proxy

Azure OpenAI Service Proxy. Convert OpenAI official API request to Azure OpenAI API request. Support GPT-4,Embeddings,Langchain. Adapter from OpenAI to Azure OpenAI.
Go
1,337
star
2

IdentityServer4.Samples

Samples for IdentityServer4,use .net core 2.0
JavaScript
610
star
3

Alipay.Demo.PCPayment

支付宝PC网站支付、扫码支付 演示项目,实现支付、支付同步回调、支付异步通知、订单查询、退款、退款查询、订单关闭、扫码支付功能。采用支付宝服务端SDK:Alipay.AopSdk.Core,使用ASP.NET Core MVC 。
HTML
282
star
4

dotnet-cnblogs-tool

博客园文章快捷发布工具
C#
173
star
5

IPTools

Querying IP address information, support longitude and latitude. 快速查询IP信息,支持国内和国外IP信息查询,支持查询经纬度。
C#
168
star
6

HttpCode.Core

简单、易用、高效 一个有态度的开源.Net Http请求框架!可以用制作爬虫,api请求等等。
C#
162
star
7

RSAExtensions

.NET Core >=3.0 & .NET Standard >=2.2, RSA Enhanced Extension. Provide XML format key import and export. Unified export and import of PKCS # 1, PKCS # 8, and XML formats. Supports PKCS # 1, PKCS # 8 PEM import and export.
C#
155
star
8

SolutionRenamer

Fast rename solution,using .net core 2.0
C#
145
star
9

Hangfire.MySql.Core

Hangfire Mysql storage components, support for. NET core 1.1,. NET core 2.0,. NET standard 2.0. Based on Hangfire.MySqlStorage, some bugs were fixed and .NET standard 2.0 support was provided.
C#
85
star
10

ToolGood.Words.Core

一款高性能敏感词(非法词/脏字)检测过滤组件,附带繁体简体互换,支持全角半角互换,汉字转拼音,模糊搜索等功能。支持.net standard 2.0
C#
73
star
11

DotnetCore.RSA

.NET Core use RSA examples,implement RSA/RSA2's Encrypt,Decrypt,Sign,Verify Sign.Use OpenSsl's private/public key.
C#
71
star
12

UrlFirewall

UrlFirewall is a lightweight, fast filtering middleware for http request urls.It supports blacklist, whitelist mode.Supports persisting filter rules to any media.You can use it in webapi, gateway, etc.
C#
66
star
13

BlogDemos

C#
63
star
14

NConsul

.NET API for Consul (http://www.consul.io/)
C#
61
star
15

BlogTools

博文快速多渠道发布工具包,支持博客园、阿里云栖社区、腾讯云+社区、慕课网手记 4种渠道。
C#
38
star
16

AspNetCore.Authentication.ApiToken

A asp.net core webapi token authentication & generator open source library.
C#
32
star
17

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.
C#
30
star
18

dotnetcore-image

Solution of .NET Core GDI+(Image) on Linux/Docker
C#
22
star
19

QRConsole

Print QRCode to console.
C#
18
star
20

NZookeeper

A zookeeper client library based on ZookeeperEx,easily use for Zookeeper.
C#
15
star
21

ClickHouse.DapperExtensions

Make ClickHouse available to Dapper
C#
15
star
22

FreeCert

Fast and easy generation of HTTPS certificate library (Let's Encrypt ACME).
C#
13
star
23

EntityFrameworkCore2Demo

.NET Core控制台、ASP.NET Core程序使用EntityFrameworkCore 2.0示例,包括CodeFirst、DBFirst。详细文章介绍请看:http://www.cnblogs.com/stulzq/p/7717873.html
C#
13
star
24

Influxdb.BulkInsert

Influxdb asynchronous, fast and bulk insert components.Using HTTP or UDP protocol.Influxdb 异步、快速、批量插入组件,支持http和udp协议。
C#
12
star
25

CnBlogSubscribeTool

CnBlogSubscribeTool can crawl blog home page data at regular intervals.
C#
11
star
26

DynamicDns

动态DNS,支持多个云厂商。
C#
10
star
27

ChinaRegionCode

中华人民共和国县以上行政区划代码数据
C#
10
star
28

AspNetCoreHighConcurrency.Sample

AspNetCore High Concurrency Simple Code.Describes how to use distributed locking based on redis. Lock-free and queued commodity inventory operations.
C#
9
star
29

go-linecount

Fast text file line count tool.
Go
9
star
30

kong-plugin-rate-limiting-ex

Rate Limiting Ex is the rate limit plugin for kong gateway.Based on official rate-limiting plugin, I added a property that can be customized to get the request header for the ip address.
Lua
9
star
31

hexo-deploy-agent

Go
9
star
32

ClientUpdate

Update you c/s software
C#
8
star
33

EntityFramework-Core-Migrator

EntityFramework Core Migrator
C#
7
star
34

StudyRoad

7
star
35

MonitoringSystem

prometheus & grafana help doc.
6
star
36

JenkinsSharedLibraries

Jenkins Shared Libraries
Groovy
4
star
37

hexo-statistics

Go
4
star
38

DotNetActionsExample

.NET Github Action Example
C#
4
star
39

Damocles

Open source permission system.Under development now.
C#
4
star
40

MailHelper

C#
3
star
41

blog-demo-go

my blog's article demo
Go
3
star
42

WhoisClient

A simple domain whois lookup library.
C#
3
star
43

Visual-Studio-2013-Theme-Editor

Visual Studio 2013 Theme Editor
C#
2
star
44

TestJenkins

2
star
45

Zeta

A mysterious code repository.
C#
2
star
46

stulzq

2
star
47

WindowsRemoteDesktopCleanTool

Clean up windows remote desktop records
C#
2
star
48

leetcode

1
star
49

Algorithms

C#
1
star
50

vuepress-sample

JavaScript
1
star
51

add-license--header

Easily add a License header to the source code.
1
star