natemcmaster/LettuceEncrypt

No credentials are available in the security package while creating certificate

gambijul opened this issue · 5 comments

Hello,

I'm facing an issue while starting my application using Lettuce Encrypt (underlined in red bellow) :

Win32Exception (0x8009030E): No credentials are available in the security package

image

I configured Lettuce Encrypt this way in my Startup.cs file :

services.AddLettuceEncrypt().PersistDataToDirectory(new DirectoryInfo(certDirectory), "MyPfxPassword");

I'm trying to figure out where is my mistake. Could someone please help me about this topic ?

Same issue.

.NET Core 5.0
LettuceEncrypt 1.0.1

I got the same error

//server\appsettings.production.json
 {
    "LettuceEncrypt": {
        "AcceptTermsOfService": true,
        "DomainNames": [ "alc-schnelltest.de"],
        "EmailAddress": "******@gmail.com"
    }
}
let serviceConfig (services: IServiceCollection) =
    services
      .AddLettuceEncrypt()
      .PersistDataToDirectory( (System.IO.DirectoryInfo("C:\\lettuceencrypt")),"Password123")  |> ignore
dotnet --version # 5.0.101
# LettuceEncrypt              1.0.1       1.0.1

PS C:\Users\fb\hosting\app6> .\Server.exe
[00:46:29 INF] Using certificate authority https://acme-v02.api.letsencrypt.org/directory
[00:46:29 INF] Now listening on: http://192.168.178.43:80
[00:46:29 INF] Now listening on: https://192.168.178.43:443
[00:46:29 INF] Application started. Press Ctrl+C to shut down.
[00:46:29 INF] Hosting environment: Production
[00:46:29 INF] Content root path: C:\Users\fb\hosting\app6
[00:46:30 INF] Creating new account for *******@gmail.com
[00:46:30 INF] Using account *********
[00:46:30 INF] Creating certificate for alc-schnelltest.de
[00:46:32 ERR] Unhandled exception while processing 0HM5H1BRFI4RR.
System.ComponentModel.Win32Exception (0x8009030E): No credentials are available in the security package
   at System.Net.SSPIWrapper.AcquireCredentialsHandle(SSPIInterface secModule, String package, CredentialUse intent, SCHANNEL_CRED scc)
   at System.Net.Security.SslStreamPal.AcquireCredentialsHandle(CredentialUse credUsage, SCHANNEL_CRED secureCredential)
   at System.Net.Security.SslStreamPal.AcquireCredentialsHandle(X509Certificate certificate, SslProtocols protocols, EncryptionPolicy policy, Boolean isServer)
   at System.Net.Security.SecureChannel.AcquireServerCredentials(Byte[]& thumbPrint, Byte[] clientHello)
   at System.Net.Security.SecureChannel.GenerateToken(Byte[] input, Int32 offset, Int32 count, Byte[]& output)
   at System.Net.Security.SecureChannel.NextMessage(Byte[] incoming, Int32 offset, Int32 count)
   at System.Net.Security.SslStream.StartSendBlob(Byte[] incoming, Int32 count, AsyncProtocolRequest asyncRequest)
   at System.Net.Security.SslStream.ProcessReceivedBlob(Byte[] buffer, Int32 count, AsyncProtocolRequest asyncRequest)
   at System.Net.Security.SslStream.StartReadFrame(Byte[] buffer, Int32 readBytes, AsyncProtocolRequest asyncRequest)
   at System.Net.Security.SslStream.StartReceiveBlob(Byte[] buffer, AsyncProtocolRequest asyncRequest)
   at System.Net.Security.SslStream.ForceAuthentication(Boolean receiveFirst, Byte[] buffer, AsyncProtocolRequest asyncRequest)
   at System.Net.Security.SslStream.ProcessAuthentication(LazyAsyncResult lazyResult, CancellationToken cancellationToken)
   at System.Net.Security.SslStream.BeginAuthenticateAsServer(SslServerAuthenticationOptions sslServerAuthenticationOptions, CancellationToken cancellationToken, AsyncCallback asyncCallback, Object asyncState)
   at System.Net.Security.SslStream.<>c.<AuthenticateAsServerAsync>b__69_0(SslServerAuthenticationOptions arg1, CancellationToken arg2, AsyncCallback callback, Object state)
   at System.Threading.Tasks.TaskFactory`1.FromAsyncImpl[TArg1,TArg2](Func`5 beginMethod, Func`2 endFunction, Action`1 endAction, TArg1 arg1, TArg2 arg2, Object state, TaskCreationOptions creationOptions)
   at System.Threading.Tasks.TaskFactory.FromAsync[TArg1,TArg2](Func`5 beginMethod, Action`1 endMethod, TArg1 arg1, TArg2 arg2, Object state, TaskCreationOptions creationOptions)
   at System.Threading.Tasks.TaskFactory.FromAsync[TArg1,TArg2](Func`5 beginMethod, Action`1 endMethod, TArg1 arg1, TArg2 arg2, Object state)
   at System.Net.Security.SslStream.AuthenticateAsServerAsync(SslServerAuthenticationOptions sslServerAuthenticationOptions, CancellationToken cancellationToken)
   at Microsoft.AspNetCore.Server.Kestrel.Https.Internal.HttpsConnectionMiddleware.InnerOnConnectionAsync(ConnectionContext context)
   at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Infrastructure.KestrelConnection.ExecuteAsync()
[00:46:32 INF] Request starting HTTP/1.1 GET http://alc-schnelltest.de/.well-known/acme-challenge/I5pajgtVsmIX4Gj0RYNitaxZsPuZsmgY03ageAdvLys
[00:46:32 INF] Request finished in 10.1557ms 200 application/octet-stream

I'm also getting this error. Has anyone found a solution?

The current source seems good; I downloaded the project and replaced the package reference with a project reference to the LettuceEncrypt.csproj file. My app managed to create and use a certificate without issue.

There are several commits since the latest release; I guess the fix is in one of them.

Closing as a duplicate of #101.

This was fixed last year in #110 and released as v1.1.0-beta.60.

FYI I've released 1.1.0 today. Please try upgrading to this new version.