summary refs log tree commit diff
path: root/crypto/src/tls/TlsAuthentication.cs
diff options
context:
space:
mode:
authorPeter Dettman <peter.dettman@bouncycastle.org>2021-07-12 15:15:36 +0700
committerPeter Dettman <peter.dettman@bouncycastle.org>2021-07-12 15:15:36 +0700
commit68c795fe81277f73aeb90d8ad4c6f4305f32c906 (patch)
tree59643344aafef91bbd4c4a3a7973deba3d837a00 /crypto/src/tls/TlsAuthentication.cs
parentTLS test tweaks (diff)
downloadBouncyCastle.NET-ed25519-68c795fe81277f73aeb90d8ad4c6f4305f32c906.tar.xz
Port of new TLS API from bc-java
Diffstat (limited to 'crypto/src/tls/TlsAuthentication.cs')
-rw-r--r--crypto/src/tls/TlsAuthentication.cs29
1 files changed, 29 insertions, 0 deletions
diff --git a/crypto/src/tls/TlsAuthentication.cs b/crypto/src/tls/TlsAuthentication.cs
new file mode 100644
index 000000000..32228ed64
--- /dev/null
+++ b/crypto/src/tls/TlsAuthentication.cs
@@ -0,0 +1,29 @@
+using System;
+using System.IO;
+
+namespace Org.BouncyCastle.Tls
+{
+    /// <summary>Base interface to provide TLS authentication credentials.</summary>
+    public interface TlsAuthentication
+    {
+        /// <summary>Called by the protocol handler to report the server certificate.</summary>
+        /// <remarks>
+        /// Note: this method is responsible for certificate verification and validation.
+        /// </remarks>
+        /// <param name="serverCertificate">the server certificate received.</param>
+        /// <exception cref="IOException"/>
+        void NotifyServerCertificate(TlsServerCertificate serverCertificate);
+
+        /// <summary>Return client credentials in response to server's certificate request.</summary>
+        /// <remarks>
+        /// The returned value may be null, or else it MUST implement <em>exactly one</em> of
+        /// <see cref="TlsCredentialedAgreement"/>, <see cref="TlsCredentialedDecryptor"/>, or
+        /// <see cref="TlsCredentialedSigner"/>, depending on the key exchange that was negotiated and the details of
+        /// the <see cref="CertificateRequest"/>.
+        /// </remarks>
+        /// <param name="certificateRequest">details of the certificate request.</param>
+        /// <returns>a <see cref="TlsCredentials"/> object or null for no client authentication.</returns>
+        /// <exception cref="IOException"/>
+        TlsCredentials GetClientCredentials(CertificateRequest certificateRequest);
+    }
+}