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

How can I authenticate with a client certificate in a TLS session? #479

Open
haga-rak opened this issue Aug 1, 2023 · 0 comments
Open

Comments

@haga-rak
Copy link

haga-rak commented Aug 1, 2023

I have a .NET x509 cert (System.Security.Cryptography.X509Certificates.X509Certificate2) with its private key which I'd like to use to make a client authentication in a regular tls session (The BC part is the client side).

For this, I'm inheriting TlsCredentials that I expect to return when TlsAuthentication.GetCredentials is called.

In short, this part looks like,

internal class CredentialsWithDotnetCert : TlsCredentials
{
    public CredentialsWithDotnetCert(X509Certificate2 certificate, BcTlsCrypto crypto)
    {
        // .... how to get Certificate from System.Security.Cryptography.X509Certificates.X509Certificate2 ?
        Certificate = new Certificate(new TlsCertificate[] { ..... });
    }


    public Certificate Certificate { get; }
}

But, I'm struggling to create a Org.BouncyCastle.Tls.Certificate from the System.Security.Cryptography.X509Certificates.X509Certificate2 object. Any idea?

I'm not bound to this particular implementation and I'm open to any other way to make this client auth work.

Thank you,

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

No branches or pull requests

1 participant