Skip to content

Commit

Permalink
Stop just before self signing
Browse files Browse the repository at this point in the history
  • Loading branch information
cyanfish committed Apr 1, 2024
1 parent 6d369a9 commit 1991b7f
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions NAPS2.Escl.Server/CertificateHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ static CertificateHelper()
// See https://stackoverflow.com/a/65258808/2112909
public static X509Certificate2? GenerateSelfSignedCertificate(ILogger logger)
{
return null;
try
{
if (CertificateRequestType == null)
Expand All @@ -42,12 +41,13 @@ static CertificateHelper()
var extensions = (Collection<X509Extension>) CertificateExtensionsProperty!.GetValue(request)!;
extensions.Add(new X509KeyUsageExtension(X509KeyUsageFlags.KeyEncipherment, true));

var now = DateTimeOffset.UtcNow;
var cert = (X509Certificate2) CreateSelfSignedMethod!.Invoke(request,
new object[] { now.AddDays(-1), now.AddYears(10) })!;
var pfxCert = new X509Certificate2(cert.Export(X509ContentType.Pfx));

return pfxCert;
return null;
// var now = DateTimeOffset.UtcNow;
// var cert = (X509Certificate2) CreateSelfSignedMethod!.Invoke(request,
// new object[] { now.AddDays(-1), now.AddYears(10) })!;
// var pfxCert = new X509Certificate2(cert.Export(X509ContentType.Pfx));
//
// return pfxCert;
}
catch (Exception ex)
{
Expand Down

0 comments on commit 1991b7f

Please sign in to comment.