using Microsoft.IdentityModel.Tokens;
using System;
using System.Collections.Generic;
using System.IO;
using System.Security.Cryptography;
using System.Text;
using TEAMModelOS.SDK.Helper.Common.JsonHelper;

namespace TEAMModelOS.SDK.Helper.Security.RSACrypt
{
    public class RsaHelper
    {
        public static SigningCredentials GenerateSigningCredentials(string file)
        {
            var privateRSA = RSAUtils.FromPrivateKey(File.ReadAllText(file));
            var signingKey = new RsaSecurityKey(privateRSA);
            var signingCredentials = new SigningCredentials(signingKey, SecurityAlgorithms.RsaSha256);
            return signingCredentials;
        }
        public static SecurityKey GenerateValidationKey(string file)
        {
            var publicRSA = RSAUtils.FromPublicKey(File.ReadAllText(file));
            var signingKey = new RsaSecurityKey(publicRSA);
            return signingKey;
        }
    }
}
