-
Notifications
You must be signed in to change notification settings - Fork 39
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
Read certificates as PEM strings or from files #283
Read certificates as PEM strings or from files #283
Conversation
What do you think about offering a couple of callbacks instead? Then some static methods to help configure the callbacks for common cases? I can see many more requests in this area on the horizon - PFX certificates, private keys with passwords, etc public sealed record NatsTlsOpts {
public Func<ValueTask<X509Certificate2>>? LoadClientCert { get; init; }
public Func<ValueTask<X509Certificate2Collection>>? LoadCaCerts { get; init; }
public static Func<ValueTask<X509Certificate2>> LoadClientCertFromPemString(string certPem, string keyPem)
{
var clientCert = X509Certificate2.CreateFromPem(certPem, keyPem);
return () => ValueTask.FromResult(clientCert);
}
public static Func<ValueTask<X509Certificate2Collection>> LoadCaCertsFromPemString(string caPem)
{
var caCerts = new X509Certificate2Collection();
caCerts.ImportFromPem(caPem);
return () => ValueTask.FromResult(caCerts);
}
} Note that this is not a full replacement for |
@caleblloyd why don't you just hack it into the branch? Not sure exactly what you mean. |
Sure, will open a PR to this one |
Signed-off-by: Caleb Lloyd <caleb@synadia.com>
Signed-off-by: Caleb Lloyd <caleb@synadia.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
No description provided.