diff --git a/NET Core/LibUA/Client.cs b/NET Core/LibUA/Client.cs index e1f449e..7a872b6 100644 --- a/NET Core/LibUA/Client.cs +++ b/NET Core/LibUA/Client.cs @@ -60,7 +60,7 @@ public virtual X509Certificate2 ApplicationCertificate get { return null; } } - public virtual RSACng ApplicationPrivateKey + public virtual RSA ApplicationPrivateKey { get { return null; } } diff --git a/NET Core/TestClient/Program.cs b/NET Core/TestClient/Program.cs index e0fe267..b2d5b9a 100644 --- a/NET Core/TestClient/Program.cs +++ b/NET Core/TestClient/Program.cs @@ -16,14 +16,14 @@ internal class Program private class DemoClient : Client { private X509Certificate2 appCertificate = null; - private RSACng cryptPrivateKey = null; + private RSA cryptPrivateKey = null; public override X509Certificate2 ApplicationCertificate { get { return appCertificate; } } - public override RSACng ApplicationPrivateKey + public override RSA ApplicationPrivateKey { get { return cryptPrivateKey; } } @@ -34,7 +34,8 @@ private void LoadCertificateAndPrivateKey() { // Try to load existing (public key) and associated private key appCertificate = new X509Certificate2("ClientCert.der"); - cryptPrivateKey = new RSACng(); + cryptPrivateKey = RSA.Create(); + cryptPrivateKey.KeySize = 2048; var rsaPrivParams = UASecurity.ImportRSAPrivateKey(File.ReadAllText("ClientKey.pem")); cryptPrivateKey.ImportParameters(rsaPrivParams); @@ -81,7 +82,8 @@ private void LoadCertificateAndPrivateKey() File.WriteAllText("ClientCert.der", UASecurity.ExportPEM(appCertificate)); File.WriteAllText("ClientKey.pem", UASecurity.ExportRSAPrivateKey(certPrivateParams)); - cryptPrivateKey = new RSACng(); + cryptPrivateKey = RSA.Create(); + cryptPrivateKey.KeySize = 2048; cryptPrivateKey.ImportParameters(certPrivateParams); } } diff --git a/NET Core/TestClient/TestClient.csproj b/NET Core/TestClient/TestClient.csproj index a316d4c..4a549c6 100644 --- a/NET Core/TestClient/TestClient.csproj +++ b/NET Core/TestClient/TestClient.csproj @@ -2,7 +2,7 @@ Exe - net7.0-windows + net8.0 diff --git a/NET Core/TestServer/Program.cs b/NET Core/TestServer/Program.cs index de33463..17936e3 100644 --- a/NET Core/TestServer/Program.cs +++ b/NET Core/TestServer/Program.cs @@ -517,7 +517,8 @@ private void LoadCertificateAndPrivateKey() { // Try to load existing (public key) and associated private key appCertificate = new X509Certificate2("ServerCert.der"); - cryptPrivateKey = new RSACng(); + cryptPrivateKey = RSA.Create(); + cryptPrivateKey.KeySize = 2048; var rsaPrivParams = UASecurity.ImportRSAPrivateKey(File.ReadAllText("ServerKey.pem")); cryptPrivateKey.ImportParameters(rsaPrivParams); @@ -564,7 +565,8 @@ private void LoadCertificateAndPrivateKey() File.WriteAllText("ServerCert.der", UASecurity.ExportPEM(appCertificate)); File.WriteAllText("ServerKey.pem", UASecurity.ExportRSAPrivateKey(certPrivateParams)); - cryptPrivateKey = new RSACng(); + cryptPrivateKey = RSA.Create(); + cryptPrivateKey.KeySize = 2048; cryptPrivateKey.ImportParameters(certPrivateParams); } } diff --git a/NET Core/TestServer/TestServer.csproj b/NET Core/TestServer/TestServer.csproj index a316d4c..4a549c6 100644 --- a/NET Core/TestServer/TestServer.csproj +++ b/NET Core/TestServer/TestServer.csproj @@ -2,7 +2,7 @@ Exe - net7.0-windows + net8.0