.NET 8 migration

This commit is contained in:
kdeng00
2024-06-09 15:00:47 -04:00
parent ececcb5ba3
commit c4ab90d4eb
12 changed files with 85 additions and 28 deletions
+10 -7
View File
@@ -1,20 +1,21 @@
using System;
using System.Security.Cryptography;
// using System.Security.Cryptography;
using Microsoft.IdentityModel.Tokens;
using Org.BouncyCastle.Crypto.Parameters;
using Org.BouncyCastle.OpenSsl;
// using BouncyCastle.Crypto;
namespace Icarus.Certs;
public class SigningIssuerCertificate : IDisposable
{
private readonly RSACryptoServiceProvider _rsa;
private readonly System.Security.Cryptography.RSACryptoServiceProvider _rsa;
public SigningIssuerCertificate()
{
_rsa = new RSACryptoServiceProvider();
_rsa = new System.Security.Cryptography.RSACryptoServiceProvider();
}
public RsaSecurityKey GetIssuerSigningKey(string publicKeyPath)
@@ -26,7 +27,7 @@ public class SigningIssuerCertificate : IDisposable
{
var pem = new PemReader(reader);
var o = (RsaKeyParameters)pem.ReadObject();
var parameters = new RSAParameters();
var parameters = new System.Security.Cryptography.RSAParameters();
parameters.Modulus = o.Modulus.ToByteArray();
parameters.Exponent = o.Exponent.ToByteArray();
_rsa.ImportParameters(parameters);
@@ -45,11 +46,11 @@ public class SigningIssuerCertificate : IDisposable
public class SigningAudienceCertificate : IDisposable
{
private readonly RSACryptoServiceProvider _rsa;
private readonly System.Security.Cryptography.RSACryptoServiceProvider _rsa;
public SigningAudienceCertificate()
{
_rsa = new RSACryptoServiceProvider();
_rsa = new System.Security.Cryptography.RSACryptoServiceProvider();
}
public SigningCredentials GetAudienceSigningKey(string keyPath)
@@ -60,8 +61,10 @@ public class SigningAudienceCertificate : IDisposable
using (var reader = System.IO.File.OpenText(file))
{
var pem = new PemReader(reader);
// var pem = new Org.BouncyCastle.Utilities.IO.Pem.PemReader(reader);
// var pem = new BouncyCastle.OpenSsl.PemReader(reader);
var o = (RsaKeyParameters)pem.ReadObject();
var parameters = new RSAParameters();
var parameters = new System.Security.Cryptography.RSAParameters();
parameters.Modulus = o.Modulus.ToByteArray();
parameters.Exponent = o.Exponent.ToByteArray();
_rsa.ImportParameters(parameters);