diff options
author | Peter Dettman <peter.dettman@bouncycastle.org> | 2022-06-28 20:49:58 +0700 |
---|---|---|
committer | Peter Dettman <peter.dettman@bouncycastle.org> | 2022-06-28 20:49:58 +0700 |
commit | dc5029c8650432ae04df78d2ead06a8349176b74 (patch) | |
tree | 306f232f9cf53762ccb427225dee958313b884fd /crypto/src/tls/AbstractTlsServer.cs | |
parent | Generics migration in Ocsp, OpenPgp (diff) | |
download | BouncyCastle.NET-ed25519-dc5029c8650432ae04df78d2ead06a8349176b74.tar.xz |
Generics migration in Tls
Diffstat (limited to 'crypto/src/tls/AbstractTlsServer.cs')
-rw-r--r-- | crypto/src/tls/AbstractTlsServer.cs | 35 |
1 files changed, 18 insertions, 17 deletions
diff --git a/crypto/src/tls/AbstractTlsServer.cs b/crypto/src/tls/AbstractTlsServer.cs index f12233326..a41bc4710 100644 --- a/crypto/src/tls/AbstractTlsServer.cs +++ b/crypto/src/tls/AbstractTlsServer.cs @@ -1,5 +1,5 @@ using System; -using System.Collections; +using System.Collections.Generic; using System.IO; using Org.BouncyCastle.Tls.Crypto; @@ -16,21 +16,21 @@ namespace Org.BouncyCastle.Tls protected int[] m_cipherSuites; protected int[] m_offeredCipherSuites; - protected IDictionary m_clientExtensions; + protected IDictionary<int, byte[]> m_clientExtensions; protected bool m_encryptThenMACOffered; protected short m_maxFragmentLengthOffered; protected bool m_truncatedHMacOffered; protected bool m_clientSentECPointFormats; protected CertificateStatusRequest m_certificateStatusRequest; - protected IList m_statusRequestV2; - protected IList m_trustedCAKeys; + protected IList<CertificateStatusRequestItemV2> m_statusRequestV2; + protected IList<TrustedAuthority> m_trustedCAKeys; protected int m_selectedCipherSuite; - protected IList m_clientProtocolNames; + protected IList<ProtocolName> m_clientProtocolNames; protected ProtocolName m_selectedProtocolName; - protected readonly IDictionary m_serverExtensions = Platform.CreateHashtable(); + protected readonly IDictionary<int, byte[]> m_serverExtensions = new Dictionary<int, byte[]>(); public AbstractTlsServer(TlsCrypto crypto) : base(crypto) @@ -99,13 +99,13 @@ namespace Org.BouncyCastle.Tls return maxBits; } - protected virtual IList GetProtocolNames() + protected virtual IList<ProtocolName> GetProtocolNames() { return null; } protected virtual bool IsSelectableCipherSuite(int cipherSuite, int availCurveBits, int availFiniteFieldBits, - IList sigAlgs) + IList<short> sigAlgs) { // TODO[tls13] The version check should be separated out (eventually select ciphersuite before version) return TlsUtilities.IsValidVersionForCipherSuite(cipherSuite, m_context.ServerVersion) @@ -180,7 +180,7 @@ namespace Org.BouncyCastle.Tls protected virtual ProtocolName SelectProtocolName() { - IList serverProtocolNames = GetProtocolNames(); + IList<ProtocolName> serverProtocolNames = GetProtocolNames(); if (null == serverProtocolNames || serverProtocolNames.Count < 1) return null; @@ -191,7 +191,8 @@ namespace Org.BouncyCastle.Tls return result; } - protected virtual ProtocolName SelectProtocolName(IList clientProtocolNames, IList serverProtocolNames) + protected virtual ProtocolName SelectProtocolName(IList<ProtocolName> clientProtocolNames, + IList<ProtocolName> serverProtocolNames) { foreach (ProtocolName serverProtocolName in serverProtocolNames) { @@ -250,7 +251,7 @@ namespace Org.BouncyCastle.Tls return null; } - public virtual TlsPskExternal GetExternalPsk(IList identities) + public virtual TlsPskExternal GetExternalPsk(IList<PskIdentity> identities) { return null; } @@ -302,7 +303,7 @@ namespace Org.BouncyCastle.Tls this.m_offeredCipherSuites = offeredCipherSuites; } - public virtual void ProcessClientExtensions(IDictionary clientExtensions) + public virtual void ProcessClientExtensions(IDictionary<int, byte[]> clientExtensions) { this.m_clientExtensions = clientExtensions; @@ -382,7 +383,7 @@ namespace Org.BouncyCastle.Tls * somewhat inelegant but is a compromise designed to minimize changes to the original * cipher suite design. */ - IList sigAlgs = TlsUtilities.GetUsableSignatureAlgorithms(securityParameters.ClientSigAlgs); + var sigAlgs = TlsUtilities.GetUsableSignatureAlgorithms(securityParameters.ClientSigAlgs); /* * RFC 4429 5.1. A server that receives a ClientHello containing one or both of these @@ -412,7 +413,7 @@ namespace Org.BouncyCastle.Tls } // IDictionary is (Int32 -> byte[]) - public virtual IDictionary GetServerExtensions() + public virtual IDictionary<int, byte[]> GetServerExtensions() { bool isTlsV13 = TlsUtilities.IsTlsV13(m_context); @@ -493,7 +494,7 @@ namespace Org.BouncyCastle.Tls return m_serverExtensions; } - public virtual void GetServerExtensionsForConnection(IDictionary serverExtensions) + public virtual void GetServerExtensionsForConnection(IDictionary<int, byte[]> serverExtensions) { if (!ShouldSelectProtocolNameEarly()) { @@ -518,7 +519,7 @@ namespace Org.BouncyCastle.Tls } } - public virtual IList GetServerSupplementalData() + public virtual IList<SupplementalDataEntry> GetServerSupplementalData() { return null; } @@ -559,7 +560,7 @@ namespace Org.BouncyCastle.Tls return TlsEccUtilities.CreateNamedECConfig(m_context, namedGroup); } - public virtual void ProcessClientSupplementalData(IList clientSupplementalData) + public virtual void ProcessClientSupplementalData(IList<SupplementalDataEntry> clientSupplementalData) { if (clientSupplementalData != null) throw new TlsFatalAlert(AlertDescription.unexpected_message); |