feat:furion rbac搭建

This commit is contained in:
橙子
2023-04-13 21:12:06 +08:00
parent 18696ec542
commit b9dad93c9d
194 changed files with 9557 additions and 75 deletions

View File

@@ -0,0 +1,34 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
using System.Threading.Tasks;
namespace Yi.Framework.Infrastructure.Helper
{
public class RSAFileHelper
{
public static RSA GetKey()
{
return GetRSA("key.pem");
}
public static RSA GetPublicKey()
{
return GetRSA("public.pem");
}
private static RSA GetRSA(string fileName)
{
string rootPath = Directory.GetCurrentDirectory();
string filePath = Path.Combine(rootPath, fileName);
if (!File.Exists(filePath))
throw new Exception("文件不存在");
string key = File.ReadAllText(filePath);
var rsa = RSA.Create();
rsa.ImportFromPem(key.AsSpan());
return rsa;
}
}
}