From 56cc0df92127257316bcb2b7f100501bdd3c763c Mon Sep 17 00:00:00 2001
From: Klaus Fischer <klaus.fischer@eloware.com>
Date: Wed, 8 Jun 2022 09:51:00 +0200
Subject: [PATCH] Checking the certificate creation

---
 SenderTest/SenderEncryptionWithCertificateTest.cs | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/SenderTest/SenderEncryptionWithCertificateTest.cs b/SenderTest/SenderEncryptionWithCertificateTest.cs
index 5aadfd97..9e079737 100644
--- a/SenderTest/SenderEncryptionWithCertificateTest.cs
+++ b/SenderTest/SenderEncryptionWithCertificateTest.cs
@@ -61,6 +61,12 @@ public class SenderEncryptionWithCertificateTest {
         var req = new CertificateRequest("cn=foobar", ECDsa.Create(), HashAlgorithmName.SHA256);
         var cert = req.CreateSelfSigned(DateTimeOffset.Now, DateTimeOffset.Now.AddYears(5));
 
+        if (cert.GetRSAPublicKey() == null)
+            throw new Exception("Certificate does not contain a public key");
+
+        if (cert.GetRSAPrivateKey() == null)
+            throw new Exception("Certificate does not contain a private key");
+
         // Export the certificate to a PEM file, just for
         // additional extern testing
         if (exportPath != null) {
-- 
GitLab