Reputation: 406
I would like to create a TlsClient with Bouncy Castle with following code
public SecureTcpClient(string host, int port)
: this(host, port, new LegacyTlsClient(new AlwaysValidVerifyer()))
{
}
This class LegacyTlsClient is however obsolete but I don't know Bouncy Castle much enough to fix this thing. Which class should be used to replace LegacyTlsClient.
Upvotes: 1
Views: 230
Reputation: 101573
You should use DefaultTlsClient class directly, like this:
class TlsClient : DefaultTlsClient {
public override TlsAuthentication GetAuthentication() {
return new CustomTlsAuthentication();
}
}
class CustomTlsAuthentication : TlsAuthentication {
public TlsCredentials GetClientCredentials(CertificateRequest certificateRequest) {
// return client certificate here if necessary
return null;
}
public void NotifyServerCertificate(Certificate serverCertificate) {
// validate server certificate here
}
}
Upvotes: 3