1
1
# NETCore.Encrypt [ 中文文档] ( http://www.cnblogs.com/piscesLoveCc/p/7423205.html )
2
2
[ ![ NuGet] ( https://img.shields.io/nuget/v/NETCore.Encrypt.svg )] ( https://nuget.org/packages/NETCore.Encrypt )
3
- [ ![ NETCore CLR] ( https://img.shields.io/badge/.NETCore%20Clr-2.0 -brightgreen.svg )] ( https://www.microsoft.com/net/core )
4
- [ ![ NetStandard 2.0.3 ] ( https://img.shields.io/badge/NetStandard-2.0.3 -orange.svg )] ( https://www.microsoft.com/net/core )
3
+ [ ![ NETCore CLR] ( https://img.shields.io/badge/.NETCore%20Clr-3.1 -brightgreen.svg )] ( https://www.microsoft.com/net/core )
4
+ [ ![ NetStandard 2.1 ] ( https://img.shields.io/badge/NetStandard-2.1 -orange.svg )] ( https://www.microsoft.com/net/core )
5
5
[ ![ license] ( https://img.shields.io/github/license/myloveCc/NETCore.Encrypt.svg )] ( https://github.com/myloveCc/NETCore.Encrypt/blob/master/License )
6
6
[ ![ GitHub-Actions-Img]] [ GitHub-Actions-Url ]
7
7
@@ -221,12 +221,12 @@ dotnet add package NETCore.Encrypt --version 2.0.9
221
221
222
222
// Rsa to pem format key
223
223
224
- // PKCS1
224
+ // PKCS1 pem
225
225
var pkcs1KeyTuple = EncryptProvider .RSAToPem (false );
226
226
var publicPem = pkcs1KeyTuple .publicPem ;
227
227
var privatePem = pkcs1KeyTuple .privatePem ;
228
228
229
- // PKCS8
229
+ // PKCS8 pem
230
230
var pkcs8KeyTuple = EncryptProvider .RSAToPem (true );
231
231
publicPem = pkcs8KeyTuple .publicPem ;
232
232
privatePem = pkcs8KeyTuple .privatePem ;
@@ -243,7 +243,35 @@ dotnet add package NETCore.Encrypt --version 2.0.9
243
243
var decryptedStr = EncryptProvider .RSADecryptWithPem (pemPrivateKey , enctypedStr );
244
244
245
245
```
246
-
246
+ - #### RSA with PKCS #1 / PKCS #8 【PRE 】
247
+
248
+ ```csharp
249
+
250
+ // Rsa to pkcs1 format key
251
+
252
+ // PKCS1
253
+ var pkcs1KeyTuple = EncryptProvider .RsaToPkcs1 ();
254
+ var publicPkcs1 = pkcs1KeyTuple .publicPkcs1 ;
255
+ var privatePkcs1 = pkcs1KeyTuple .privatePkcs1 ;
256
+
257
+ // Rsa to pkcs8 format key
258
+
259
+ // PKCS8
260
+ var pkcs8KeyTuple = EncryptProvider .RsaToPkcs8 ();
261
+ var publicPkcs8 = pkcs1KeyTuple .publicPkcs8 ;
262
+ var privatePkcs8 = pkcs1KeyTuple .privatePkcs8 ;
263
+
264
+ // Rsa from pkcs public key
265
+
266
+ var rsa = EncryptProvider .RSAFromPublicPkcs (pkcsPublicKey ); // Pkcs #1 | Pkcs #8
267
+ rsa = EncryptProvider .RSAFromPrivatePkcs1 (privatePkcs1 );
268
+ rsa = EncryptProvider .RSAFromPrivatePkcs8 (privatePkcs8 );
269
+
270
+ // Rsa encrypt and decrypt with pkcs key
271
+
272
+
273
+
274
+ ```
247
275
## MD5
248
276
249
277
```csharp
0 commit comments