懒得勤快 5 년 전
부모
커밋
e2cd0fbafd
1개의 변경된 파일8개의 추가작업 그리고 2개의 파일을 삭제
  1. 8 2
      Masuit.Tools/Security/RSACrypt.cs

+ 8 - 2
Masuit.Tools/Security/RSACrypt.cs

@@ -24,7 +24,8 @@ namespace Masuit.Tools.Security
     public enum RsaKeyType
     {
         XML,
-        PEM
+        PKCS1,
+        PKCS8
     }
 
     /// <summary> 
@@ -48,11 +49,16 @@ namespace Masuit.Tools.Security
             var rsa = new RSA(length);
             return type switch
             {
-                RsaKeyType.PEM => RsaKey ??= new RsaKey
+                RsaKeyType.PKCS1 => RsaKey ??= new RsaKey
                 {
                     PrivateKey = rsa.ToPEM_PKCS1(),
                     PublicKey = rsa.ToPEM_PKCS1(true)
                 },
+                RsaKeyType.PKCS8 => RsaKey ??= new RsaKey
+                {
+                    PrivateKey = rsa.ToPEM_PKCS8(),
+                    PublicKey = rsa.ToPEM_PKCS8(true)
+                },
                 RsaKeyType.XML => RsaKey ??= new RsaKey
                 {
                     PrivateKey = rsa.ToXML(),