Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CryptographicException: Keyset does not exist #2584

Closed
WouterTinus opened this issue May 18, 2024 · 27 comments
Closed

CryptographicException: Keyset does not exist #2584

WouterTinus opened this issue May 18, 2024 · 27 comments
Milestone

Comments

@WouterTinus
Copy link
Member

          but when i do a nev certificate i still get error

Error requesting certificate "[Manual] project.iztoknet.com"
System.Security.Cryptography.CryptographicException: Keyset does not exist
at System.Security.Cryptography.X509Certificates.StorePal.Export(X509ContentType contentType, SafePasswordHandle password)
at System.Security.Cryptography.X509Certificates.X509Certificate2Collection.Export(X509ContentType contentType)
at PKISharp.WACS.DomainObjects.CertificateInfo..ctor(X509Certificate2Collection rawCollection)
at PKISharp.WACS.DomainObjects.CertificateInfoBc.GenerateInner(Pkcs12Store store, X509KeyStorageFlags flags)
at PKISharp.WACS.DomainObjects.CertificateInfoBc..ctor(Pkcs12Store store)
at PKISharp.WACS.Services.CertificateService.CreateAlternative(Byte[] bytes, String friendlyName, AsymmetricKeyParameter pk)
at PKISharp.WACS.Services.CertificateService.DownloadCertificate(AcmeOrderDetails order, String friendlyName, AsymmetricKeyParameter pk)
at PKISharp.WACS.Services.CertificateService.RequestCertificate(ICsrPlugin csrPlugin, Order order)
at PKISharp.WACS.OrderProcessor.GetFromServer(OrderContext context)

Originally posted by @iztokba in #2582 (comment)

@WouterTinus
Copy link
Member Author

I'm not able to immediately reproduce this. Can you provide the full log?

@iztokba
Copy link

iztokba commented May 18, 2024

log-20240518.txt
here is the ful log

WouterTinus added a commit that referenced this issue May 18, 2024
@WouterTinus
Copy link
Member Author

WouterTinus commented May 18, 2024

It's a weird error that I can't really explain, but here is a build with a potential fix and also adding some more logging that might provide additional hints. Please try it if you get a chance.

https://ci.appveyor.com/project/WouterTinus/win-acme-s8t9q/builds/49841629/artifacts
EDIT: see below for build 1701.

@webprofusion-chrisc
Copy link
Contributor

I wonder if the ephemeral key used in creating the temp pfx is being lost before the export somehow, I think you may need to PersistKeySet if using MachineKeySet (in your fallback) though as I think the export will try to read from disk not from memory. dotnet calls out to OS functions that are quite old: https://learn.microsoft.com/en-us/windows/win32/api/wincrypt/nf-wincrypt-pfxexportcertstore

@iztokba
Copy link

iztokba commented May 19, 2024

This version also does not work, when you want to renew the certificate, the error is still present.
The log document is attached
log-20240519.txt

@iztokba
Copy link

iztokba commented May 19, 2024

i see new error: The local system certificate with footprint fc 15 ee f6 66 2b c4 94 dc 26 bd ab 2f 85 d3 b4 58 e9 62 df is about to expire or has already expired.

mybe is this the problem

WouterTinus added a commit that referenced this issue May 19, 2024
@WouterTinus
Copy link
Member Author

WouterTinus commented May 19, 2024

dotnet calls out to OS functions that are quite old

Ugh, indeed. Dealing with X509Certificate2 and the like feels like crawling through broken glass sometimes because it's hiding so much from what happens in the background. I'm tempted to go full BouncyCastle for as much code as possible, but I'm also afraid of subtle edge cases that people have come to rely on. Perhaps that'd be a version 2.3 thing.

Anyway, I tried your suggestion of adding the PersistKeySet flag (which makes sense because we also do that for the actual store), so hopefully that solves @iztokba's issue. See build 1685: https://ci.appveyor.com/project/WouterTinus/win-acme-s8t9q/builds/49843242/artifacts

EDIT: see below for 1701.

@bieba
Copy link

bieba commented May 19, 2024

I also have the same issue. The .1685 doesn't solve the problem.

@WouterTinus
Copy link
Member Author

This seems to be a new bug introduced in 2.2.9, I'm revoking the release and gone back to testing.

@WouterTinus
Copy link
Member Author

WouterTinus commented May 19, 2024

I'm currently working on a fix for this by moving to BouncyCastle as much as possible for certificate and key handling, only at the very final stages of the Certificate Store plugin it will be moved to Windows, hopefully keeping the "Bad Data" bug away while also not running into this error.

There's a lot of testing to be done yet with different store types and settings, but anyone feeling adventurous can try build 1688 here: https://ci.appveyor.com/project/WouterTinus/win-acme-s8t9q/builds/49844762/artifacts

EDIT: see below for 1701.

@WouterTinus WouterTinus added this to the 2.2.9 milestone May 19, 2024
@bieba
Copy link

bieba commented May 20, 2024

Thanks for trying to achieve a fix, but this isn't also working.

[VERB] Autofac: creating PluginBackend<IStorePlugin> scope with parent PluginBackend<ICsrPlugin>
 [VERB] W3SVC detected and running
 [VERB] FTPSVC detected and running
 [INFO] Store with CertificateStore...
 [INFO] Installing certificate in the certificate store
 [WARN] Error converting key to legacy CryptoAPI, using CNG instead.
 [VERB] System.Security.Cryptography.CryptographicException: Der Schlüsselsatz ist nicht vorhanden.
   at System.Security.Cryptography.CngKey.Open(String keyName, CngProvider provider, CngKeyOpenOptions openOptions)
   at System.Security.Cryptography.X509Certificates.CertificatePal.GetPrivateKey[T](Func`2 createCsp, Func`2 createCng)
   at System.Security.Cryptography.X509Certificates.CertificateExtensionsCommon.GetPrivateKey[T](X509Certificate2 certificate, Predicate`1 matchesConstraints)
   at PKISharp.WACS.Plugins.StorePlugins.CertificateStoreClient.ConvertCertificate(X509Certificate2 original, X509KeyStorageFlags flags, String password)
 [DBUG] Open store WebHosting

And a little bit later:

EROR] (COMException) Unable to install certificate: Eine angegebene Anmeldesitzung ist nicht vorhanden. Sie wurde gegebenenfalls bereits beendet. (0x80070520)
 [DBUG] Exception details: COMException {ErrorCode=-2147023584, TargetSite=Void Execute(), Message="Eine angegebene Anmeldesitzung ist nicht vorhanden. Sie wurde gegebenenfalls bereits beendet. (0x80070520)", Data=[], InnerException=null, HelpLink=null, Source="Microsoft.Web.Administration", HResult=-2147023584, StackTrace="   at Microsoft.Web.Administration.Interop.IAppHostMethodInstance.Execute()\r\n   at Microsoft.Web.Administration.ConfigurationMethodInstance.Execute()\r\n   at Microsoft.Web.Administration.Binding.AddSslCertificate(Byte[] certificateHash, String certificateStoreName)\r\n   at Microsoft.Web.Administration.BindingManager.BindingTransaction.Commit()\r\n   at Microsoft.Web.Administration.BindingManager.Save()\r\n   at Microsoft.Web.Administration.ServerManager.CommitChanges()\r\n   at PKISharp.WACS.Clients.IIS.IISClient.Commit()\r\n   at PKISharp.WACS.Clients.IIS.IISClient.UpdateHttpSite(IEnumerable`1 identifiers, BindingOptions bindingOptions, Byte[] oldCertificate, IEnumerable`1 allIdentifiers)\r\n   at PKISharp.WACS.Plugins.InstallationPlugins.IIS.PKISharp.WACS.Plugins.Interfaces.IInstallationPlugin.Install(Dictionary`2 storeInfo, ICertificateInfo newCertificate, ICertificateInfo oldCertificate)\r\n   at PKISharp.WACS.OrderProcessor.HandleInstall(OrderContext context, ICertificateInfo newCertificate, CertificateInfoCache previousCertificate, Dictionary`2 storeInfo)"}

2.2.8.1635 isn't working also, at least I got the last error.

@WouterTinus
Copy link
Member Author

WouterTinus commented May 20, 2024

Hi @bieba, thanks for testing. My current theory is that all this is triggered somehow (under some circumstances, unfortunately not on my own machine) by the password protection of the temporary certificates, so I've removed that in build 1690. Would you mind giving that a spin? https://ci.appveyor.com/project/WouterTinus/win-acme-s8t9q/builds/49846932/artifacts

EDIT: see below for 1701.

@bieba
Copy link

bieba commented May 20, 2024

Nope :-/

[VERB] Autofac: creating PluginBackend<IStorePlugin> scope with parent PluginBackend<ICsrPlugin>
 [VERB] W3SVC detected and running
 [VERB] FTPSVC detected and running
 [INFO] Store with CertificateStore...
 [INFO] Installing certificate in the certificate store
 [WARN] Error converting key to legacy CryptoAPI, using CNG instead.
 [VERB] System.Security.Cryptography.CryptographicException: Der Schlüsselsatz ist nicht vorhanden.
   at System.Security.Cryptography.CngKey.Open(String keyName, CngProvider provider, CngKeyOpenOptions openOptions)
   at System.Security.Cryptography.X509Certificates.CertificatePal.GetPrivateKey[T](Func`2 createCsp, Func`2 createCng)
   at System.Security.Cryptography.X509Certificates.CertificateExtensionsCommon.GetPrivateKey[T](X509Certificate2 certificate, Predicate`1 matchesConstraints)
   at PKISharp.WACS.Plugins.StorePlugins.CertificateStoreClient.ConvertCertificate(X509Certificate2 original, X509KeyStorageFlags flags, String password)
 [DBUG] Open store WebHosting
[INFO] Committing 1 https binding changes to IIS while updating site 9
 [EROR] (COMException) Unable to install certificate: Eine angegebene Anmeldesitzung ist nicht vorhanden. Sie wurde gegebenenfalls bereits beendet. (0x80070520)
 [DBUG] Exception details: COMException {ErrorCode=-2147023584, TargetSite=Void Execute(), Message="Eine angegebene Anmeldesitzung ist nicht vorhanden. Sie wurde gegebenenfalls bereits beendet. (0x80070520)", Data=[], InnerException=null, HelpLink=null, Source="Microsoft.Web.Administration", HResult=-2147023584, StackTrace="   at Microsoft.Web.Administration.Interop.IAppHostMethodInstance.Execute()\r\n   at Microsoft.Web.Administration.ConfigurationMethodInstance.Execute()\r\n   at Microsoft.Web.Administration.Binding.AddSslCertificate(Byte[] certificateHash, String certificateStoreName)\r\n   at Microsoft.Web.Administration.BindingManager.BindingTransaction.Commit()\r\n   at Microsoft.Web.Administration.BindingManager.Save()\r\n   at Microsoft.Web.Administration.ServerManager.CommitChanges()\r\n   at PKISharp.WACS.Clients.IIS.IISClient.Commit()\r\n   at PKISharp.WACS.Clients.IIS.IISClient.UpdateHttpSite(IEnumerable`1 identifiers, BindingOptions bindingOptions, Byte[] oldCertificate, IEnumerable`1 allIdentifiers)\r\n   at PKISharp.WACS.Plugins.InstallationPlugins.IIS.PKISharp.WACS.Plugins.Interfaces.IInstallationPlugin.Install(Dictionary`2 storeInfo, ICertificateInfo newCertificate, ICertificateInfo oldCertificate)\r\n   at PKISharp.WACS.OrderProcessor.HandleInstall(OrderContext context, ICertificateInfo newCertificate, CertificateInfoCache previousCertificate, Dictionary`2 storeInfo)"}
 [EROR] Renewal for [IIS] XXX, (any host) failed, will retry on next run
 [EROR] Install failed: Eine angegebene Anmeldesitzung ist nicht vorhanden. Sie wurde gegebenenfalls bereits beendet. (0x80070520)

Regarding the last error, maybe a idea:
Currently I'm thinking that the session is resetted, maybe you're throwing the last instance of the server manager away, because you catched a exception (and your Refresh()-method gets called) and the new instance doesn't know anything about the past?

I have been looking at the certificates, they have not the exportable property set, is that necessary? I didn't change anything and because of another issue of a older version, I thought migration to a recent version would be a good idea.

It is a german localized windows server 2016.

@bieba
Copy link

bieba commented May 20, 2024

Bigger problem. The client destroys the bindings which it wanted to update, because it can't assign the certificate. As I tried to choose it manually, I got the same error message. I had to rollback to the last working one.

Bildschirmfoto 2024-05-20 um 13 41 43

Now the server has multiple corrupt certificates. I hope that this is not happen to many others.

@iztokba
Copy link

iztokba commented May 20, 2024

for me this version work super fine win-acme.v2.2.9.1688
thanks for help
if there be a new version i will tested it

@WouterTinus
Copy link
Member Author

@iztokba: which Windows version are you on?
@bieba: the new version might not be able to recover from a certificate that was already corrupted by a previous buggy build. If you're still willing to test could you try creating a cert for a brand new domain?

@jshall
Copy link

jshall commented May 20, 2024

@WouterTinus I got this same error.

In my case it seems to be that this version is not properly accounting for Transfer-Encoding: chunked.

While digging into it via Fiddler, in the ACME server response one of the certificates returned appeared to be corrupted until I use the "click to decode" option. I suspect that win-acme is also failing to do this decoding step and jumps straight to decoding the PEM data which has a chunk header right in the middle of the base64 data.

@bieba
Copy link

bieba commented May 20, 2024

The customer has a important appointment tomorrow, I am allowed to give it a new try in the late evening, not now.
As I was able to rollback to a working one, I assume that I can start with that one?
If its still not working I start over with a new domain for testing purposes.

I come back with some news late tomorrow evening.

@iztokba
Copy link

iztokba commented May 21, 2024

i have winsrv2016 standard

@WouterTinus
Copy link
Member Author

@jshall: to be clear, which error, which build of win-acme and which version of Windows?

@jshall
Copy link

jshall commented May 21, 2024

Windows version: Microsoft Windows Server 2016 Standard (10.0.14393)
win-acme version: 2.2.9.1680 (release, pluggable, standalone, 64-bit)

win-acme log excert:

2024-05-20 15:03:28.646 -04:00 [INF] Downloading certificate dev-sql02
2024-05-20 15:03:28.651 -04:00 [DBG] [HTTP] Send POST to "https://ca-agent.indwes.edu/acme/cert/1da387e7-5ec0-42f7-94ed-140a5f028e76"
2024-05-20 15:03:28.651 -04:00 [VRB] [HTTP] Request content: {"protected":"eyJhbGciOiJFUzI1NiIsInVybCI6Imh0dHBzOi8vY2EtYWdlbnQuaW5kd2VzLmVkdS9hY21lL2NlcnQvMWRhMzg3ZTctNWVjMC00MmY3LTk0ZWQtMTQwYTVmMDI4ZTc2Iiwibm9uY2UiOiI2SWpvZnBBZGRYb0QyRURkbWtWS1NCZ0tuQjAiLCJraWQiOiJodHRwczovL2NhLWFnZW50LmluZHdlcy5lZHUvYWNtZS9hY2N0LzZhOWM3M2UxLTg3MDAtNDYyNy05NTQ3LTQ2YWQzNDFhYjQ2YiJ9","payload":"","signature":"fTKf_nMPkLb2A6QciHO6q92hir_QZeLZRSlNdWXusFgIgEgd6MLIQfihXpkqo3kRazYTzd6PlbE9eF8sZ3YIkQ"}
2024-05-20 15:03:28.900 -04:00 [VRB] [HTTP] Request completed with status "OK"
2024-05-20 15:03:28.900 -04:00 [VRB] [HTTP] Empty response
2024-05-20 15:03:28.905 -04:00 [VRB] Parsing PEM data at range 0..1902
2024-05-20 15:03:28.918 -04:00 [VRB] Certificate CN=dev-sql02.iwunet.indwes.edu parsed
2024-05-20 15:03:28.927 -04:00 [VRB] Associating private key
2024-05-20 15:03:28.929 -04:00 [VRB] Parsing PEM data at range 1905..4403
2024-05-20 15:03:28.930 -04:00 [VRB] Certificate C=US,O=Indiana Wesleyan University,OU=IT,CN=Indiana Wesleyan University EZCA parsed
2024-05-20 15:03:28.937 -04:00 [VRB] Parsing PEM data at range 4406..6596
2024-05-20 15:03:28.937 -04:00 [VRB] Certificate C=US,O=Indiana Wesleyan University,OU=IT,CN=Indiana Wesleyan University Root CA parsed
2024-05-20 15:03:29.192 -04:00 [ERR] Error requesting certificate dev-sql02
System.Security.Cryptography.CryptographicException: Keyset does not exist
   at System.Security.Cryptography.X509Certificates.StorePal.Export(X509ContentType contentType, SafePasswordHandle password)
   at System.Security.Cryptography.X509Certificates.X509Certificate2Collection.Export(X509ContentType contentType)
   at PKISharp.WACS.DomainObjects.CertificateInfo..ctor(X509Certificate2Collection rawCollection)
   at PKISharp.WACS.DomainObjects.CertificateInfoBc.GenerateInner(Pkcs12Store store, X509KeyStorageFlags flags)
   at PKISharp.WACS.DomainObjects.CertificateInfoBc..ctor(Pkcs12Store store)
   at PKISharp.WACS.Services.CertificateService.CreateAlternative(Byte[] bytes, String friendlyName, AsymmetricKeyParameter pk)
   at PKISharp.WACS.Services.CertificateService.DownloadCertificate(AcmeOrderDetails order, String friendlyName, AsymmetricKeyParameter pk)
   at PKISharp.WACS.Services.CertificateService.RequestCertificate(ICsrPlugin csrPlugin, Order order)
   at PKISharp.WACS.OrderProcessor.GetFromServer(OrderContext context)
2024-05-20 15:03:29.194 -04:00 [VRB] Processing order 1/1: Main
2024-05-20 15:03:29.198 -04:00 [ERR] Create certificate failed
2024-05-20 15:03:29.199 -04:00 [VRB] Exiting with status code -1

raw Fiddler capture:

HTTP/1.1 200 OK
Transfer-Encoding: chunked
Content-Type: text/plain; charset=utf-8
Server: Microsoft-IIS/10.0
Request-Context: appId=cid-v1:8ee9a90b-1ca0-4224-aec2-61acb043f652
Replay-Nonce: 9fO0iM_DVr1WPegHlx5FAJSHL6U
Date: Mon, 20 May 2024 19:03:28 GMT

1000
-----BEGIN CERTIFICATE-----
MIIFQDCCAyigAwIBAgISSDYuE5PR5b3MzzlsZ1bBVGviMA0GCSqGSIb3DQEBCwUAMGsxCzAJBgNV
BAYTAlVTMSQwIgYDVQQKDBtJbmRpYW5hIFdlc2xleWFuIFVuaXZlcnNpdHkxCzAJBgNVBAsMAklU
MSkwJwYDVQQDDCBJbmRpYW5hIFdlc2xleWFuIFVuaXZlcnNpdHkgRVpDQTAeFw0yNDA1MjAxNzAz
MjhaFw0yNDA4MTcxOTAzMjhaMCYxJDAiBgNVBAMMG2Rldi1zcWwwMi5pd3VuZXQuaW5kd2VzLmVk
dTB2MBAGByqGSM49AgEGBSuBBAAiA2IABEnAcBZ4cTEkoB8BqStxg2pWQh1WRQpvaxFlVkbgnCNQ
zqpi+ZkwwYnJyU8riC3J5XZh2C3VEy1Fh5uwn8ThoUK7ROiMZ4AMKuqstWRicwxyVNFCMYgi5q41
TNU9oe320qOCAc8wggHLMB0GA1UdDgQW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Y+BR0zZxa8dfsYARklUeiYFq7qZMz5N9HVBnDDzaFa84GlPxe
rkx9kA1Fh9l4De5ua2OPZ8snot0EK8/9HfFJIFuQNxmPnZAqK/V0xRLQ4D+3BSQ51phvf96KSQhI
XJfRvQFk/9M7yQYUJH2mAHImA6BTrKw9gKxqSZunYxiJSOS/5AsDA3kMrFaN7m9UIzeawOvlq6dQ
6IIAVyZCs6k4KWiV+V+oOTfTni2fwsZBWF4va6LP5S5iCcVxuxzp3Zi0VD8AKfEih23Xp5dlb5u3
eTHts6F6qhg5MJg34zwYX6zStUnv990G+VAnB0EhAlAc4s5Sl1klQAC9sGYOpY3MzFd10XTJ66Qd
h0aSK/i8Mw9VQsODSTcDRwUCC2z+zmjAbhRHZLD36XplqLbGkvW0EEIFPBIBgAcg3jtBxYCthQY0
RthYkjfbSwaA+xy6LVDtTGTA9VGN6vPk77q7AF4liRaTeqz+H0FjtHPWnVw+0ncVKE8DjHLX2a/B
iKNBrvYihOMlV+v7DcEgaqVA7bjdRbM4TSelgRndwQoJ0EJwjcy+HMiThKaqkFrdGBXnxkr9E3at
btUK9CQkVXXUE5FDNjWBh/WxofE=
-----END CERTIFICATE-----

0

@WouterTinus
Copy link
Member Author

WouterTinus commented May 21, 2024

So I managed to get my hands on a Windows 2016 machine and was able to reproduce and fix the issue. Build 1700 is now available from https://ci.appveyor.com/project/WouterTinus/win-acme-s8t9q/builds/49859984/artifacts and should work for everyone. It will be released as version 2.9.1 in a couple of days if I don't hear reports to the contrary.

EDIT: see below for 1701.

@jshall
Copy link

jshall commented May 21, 2024

Thanks! I can confirm that build 1700 worked for me as well.

@jshall
Copy link

jshall commented May 21, 2024

I missed it at first, but another bug popped up. The log does not directly indicate an error, but the CertificateStore plugin did not actually add the new certificate to the Windows certificate store.

2.2.8.1635:

2024-05-21 18:42:50.679 -04:00 [VRB] Autofac: creating PluginBackend<IStorePlugin> scope with parent PluginBackend<ICsrPlugin>
2024-05-21 18:42:50.685 -04:00 [VRB] No W3SVC detected
2024-05-21 18:42:50.685 -04:00 [VRB] No FTPSVC detected
2024-05-21 18:42:50.686 -04:00 [DBG] Certificate store name: My
2024-05-21 18:42:50.687 -04:00 [INF] Store with CertificateStore...
2024-05-21 18:42:50.690 -04:00 [INF] Installing certificate in the certificate store
2024-05-21 18:42:50.691 -04:00 [DBG] Opened certificate store My
2024-05-21 18:42:50.691 -04:00 [INF] Adding certificate dev-sql02 @ 2024-05-21 to store My
2024-05-21 18:42:50.691 -04:00 [VRB] CN=dev-sql02.iwunet.indwes.edu - CN=Indiana Wesleyan University EZCA, OU=IT, O=Indiana Wesleyan University, C=US (D04A1AA51E861B56C0F1CF70D215EE539BAFB540)
2024-05-21 18:42:50.692 -04:00 [DBG] Storing certificate with flags "MachineKeySet, PersistKeySet"
2024-05-21 18:42:50.775 -04:00 [DBG] Closing certificate store
2024-05-21 18:42:50.786 -04:00 [VRB] CN=Indiana Wesleyan University EZCA, OU=IT, O=Indiana Wesleyan University, C=US - CN=Indiana Wesleyan University Root CA, OU=IT, O=Indiana Wesleyan University, C=US (405E0CEDB847985FE5C29F33CE600DF2468FEBBE) already exists in CA
2024-05-21 18:42:50.786 -04:00 [VRB] CN=Indiana Wesleyan University Root CA, OU=IT, O=Indiana Wesleyan University, C=US - CN=Indiana Wesleyan University Root CA, OU=IT, O=Indiana Wesleyan University, C=US (D5809A52EBE161D463673A2F2D585B2D68E5405E) already exists in CA
2024-05-21 18:42:50.786 -04:00 [DBG] Closing store CA

2.2.9.1700:

2024-05-21 18:38:11.679 -04:00 [VRB] Autofac: creating PluginBackend<IStorePlugin> scope with parent PluginBackend<ICsrPlugin>
2024-05-21 18:38:11.684 -04:00 [VRB] No W3SVC detected
2024-05-21 18:38:11.684 -04:00 [VRB] No FTPSVC detected
2024-05-21 18:38:11.686 -04:00 [INF] Store with CertificateStore...
2024-05-21 18:38:11.687 -04:00 [INF] Installing certificate in the certificate store
2024-05-21 18:38:11.880 -04:00 [INF] Adding certificate  in store CA
2024-05-21 18:38:11.880 -04:00 [VRB] CN=Indiana Wesleyan University EZCA, OU=IT, O=Indiana Wesleyan University, C=US/CN=Indiana Wesleyan University Root CA, OU=IT, O=Indiana Wesleyan University, C=US (405E0CEDB847985FE5C29F33CE600DF2468FEBBE)
2024-05-21 18:38:11.881 -04:00 [INF] Adding certificate  in store CA
2024-05-21 18:38:11.881 -04:00 [VRB] CN=Indiana Wesleyan University Root CA, OU=IT, O=Indiana Wesleyan University, C=US/CN=Indiana Wesleyan University Root CA, OU=IT, O=Indiana Wesleyan University, C=US (D5809A52EBE161D463673A2F2D585B2D68E5405E)

@WouterTinus
Copy link
Member Author

Looks like certificates with EC keys were slipping through the cracks in the new control flow, there's a bugfix here:
https://ci.appveyor.com/project/WouterTinus/win-acme-s8t9q/builds/49861780/artifacts

@bieba
Copy link

bieba commented May 22, 2024

.1701 tested. Works like a charm.

@WouterTinus
Copy link
Member Author

Build 1701 has been release as version 2.2.9.1. Hopefully working for everyone now 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants