Comments (2)
Very useful C# code, thank you. Sometimes we need the public key and private key in the x509 certificate to complete RSA encryption and decryption. If you can add this function, it will be more perfect.
Thank you, your suggestion is very good, I will add this feature later. I am busy at work, you can try the following methods yourself.
private static RSACryptoServiceProvider GetPrivateKey(string priKeyFile, string keyPwd)
{
var pc = new X509Certificate2(priKeyFile, keyPwd, X509KeyStorageFlags.MachineKeySet);
return (RSACryptoServiceProvider) pc.PrivateKey;
}
private static RSACryptoServiceProvider GetPublicKey(string pubKeyFile)
{
var pc = new X509Certificate2(pubKeyFile);
return (RSACryptoServiceProvider) pc.PublicKey.Key;
}
from netcore.encrypt.
nice!
from netcore.encrypt.
Related Issues (20)
- 希望增加RSA PKCS#1/8 的支持 HOT 1
- 不支持 AES 128 ? key 必须在此区间 "32"-"32". (Parameter 'key') HOT 1
- Encryprion and whitespace HOT 2
- Cannot figure out how to decrypt RSA :S HOT 1
- .NET Core 3.1 Version HOT 1
- CreateAesKey returning repeated Keys HOT 3
- 希望添加 Exponent和Modulus 加密方式的支持
- Exception messages need to be in english HOT 2
- Problems with AES HOT 2
- 命名和注释改进,异常建议用更适合的异常类,例如文件不存在用FileNotFoundException
- 咨询linux系统测试结果 HOT 1
- RSA/ECB/OAEPWithSHA-256AndMGF1Padding 这种方式是怎么个加解密,你这边支持嘛 HOT 1
- MD5 Decryption HOT 1
- EncryptProvider.RSAFromPublicPkcs 方法报错 HOT 5
- Project about contains misspelled word "decrpty" HOT 1
- Is NETCore.Encrypt in a Blazor Webassembly Client .Net 7.0 project working? HOT 1
- Encryption Key Chars HOT 1
- 使用RSA加密后,为何publicKey和privateKey多了个modules如何去掉?
- 请问会支持 sm系列加密解密验签等操作吗 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from netcore.encrypt.