summary refs log tree commit diff
path: root/crypto/src/tls/TlsExtensionsUtilities.cs
diff options
context:
space:
mode:
authorPeter Dettman <peter.dettman@bouncycastle.org>2023-07-13 16:02:08 +0700
committerPeter Dettman <peter.dettman@bouncycastle.org>2023-07-13 16:02:08 +0700
commit5c755417ddb98738a8550707d2c436f707cf9f45 (patch)
treec56e51b88b241fee6e1a1c89da430ef005ab44cc /crypto/src/tls/TlsExtensionsUtilities.cs
parent(D)TLS: Clean up redundant resumption checks (diff)
downloadBouncyCastle.NET-ed25519-5c755417ddb98738a8550707d2c436f707cf9f45.tar.xz
(D)TLS: Refactoring around CertificateType support
Diffstat (limited to 'crypto/src/tls/TlsExtensionsUtilities.cs')
-rw-r--r--crypto/src/tls/TlsExtensionsUtilities.cs16
1 files changed, 16 insertions, 0 deletions
diff --git a/crypto/src/tls/TlsExtensionsUtilities.cs b/crypto/src/tls/TlsExtensionsUtilities.cs
index bc4ca2714..ffc1c23c1 100644
--- a/crypto/src/tls/TlsExtensionsUtilities.cs
+++ b/crypto/src/tls/TlsExtensionsUtilities.cs
@@ -308,6 +308,14 @@ namespace Org.BouncyCastle.Tls
         }
 
         /// <exception cref="IOException"/>
+        public static short GetClientCertificateTypeExtensionServer(IDictionary<int, byte[]> extensions)
+        {
+            byte[] extensionData = TlsUtilities.GetExtensionData(extensions, ExtensionType.client_certificate_type);
+            return extensionData == null ? (short)-1 : ReadCertificateTypeExtensionServer(extensionData);
+        }
+
+        /// <exception cref="IOException"/>
+        [Obsolete("Use version without 'defaultValue' instead")]
         public static short GetClientCertificateTypeExtensionServer(IDictionary<int, byte[]> extensions,
             short defaultValue)
         {
@@ -429,6 +437,14 @@ namespace Org.BouncyCastle.Tls
         }
 
         /// <exception cref="IOException"/>
+        public static short GetServerCertificateTypeExtensionServer(IDictionary<int, byte[]> extensions)
+        {
+            byte[] extensionData = TlsUtilities.GetExtensionData(extensions, ExtensionType.server_certificate_type);
+            return extensionData == null ? (short)-1 : ReadCertificateTypeExtensionServer(extensionData);
+        }
+
+        /// <exception cref="IOException"/>
+        [Obsolete("Use version without 'defaultValue' instead")]
         public static short GetServerCertificateTypeExtensionServer(IDictionary<int, byte[]> extensions,
             short defaultValue)
         {