From dc5029c8650432ae04df78d2ead06a8349176b74 Mon Sep 17 00:00:00 2001 From: Peter Dettman Date: Tue, 28 Jun 2022 20:49:58 +0700 Subject: Generics migration in Tls --- crypto/src/tls/Certificate.cs | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) (limited to 'crypto/src/tls/Certificate.cs') diff --git a/crypto/src/tls/Certificate.cs b/crypto/src/tls/Certificate.cs index fef35fc1e..c7f08b2aa 100644 --- a/crypto/src/tls/Certificate.cs +++ b/crypto/src/tls/Certificate.cs @@ -1,9 +1,8 @@ using System; -using System.Collections; +using System.Collections.Generic; using System.IO; using Org.BouncyCastle.Tls.Crypto; -using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Tls { @@ -137,8 +136,8 @@ namespace Org.BouncyCastle.Tls } int count = m_certificateEntryList.Length; - IList certEncodings = Platform.CreateArrayList(count); - IList extEncodings = isTlsV13 ? Platform.CreateArrayList(count) : null; + var certEncodings = new List(count); + var extEncodings = isTlsV13 ? new List(count) : null; long totalLength = 0; for (int i = 0; i < count; ++i) @@ -158,7 +157,7 @@ namespace Org.BouncyCastle.Tls if (isTlsV13) { - IDictionary extensions = entry.Extensions; + var extensions = entry.Extensions; byte[] extEncoding = (null == extensions) ? TlsUtilities.EmptyBytes : TlsProtocol.WriteExtensionsData(extensions); @@ -174,13 +173,11 @@ namespace Org.BouncyCastle.Tls for (int i = 0; i < count; ++i) { - byte[] certEncoding = (byte[])certEncodings[i]; - TlsUtilities.WriteOpaque24(certEncoding, messageOutput); + TlsUtilities.WriteOpaque24(certEncodings[i], messageOutput); if (isTlsV13) { - byte[] extEncoding = (byte[])extEncodings[i]; - TlsUtilities.WriteOpaque16(extEncoding, messageOutput); + TlsUtilities.WriteOpaque16(extEncodings[i], messageOutput); } } } @@ -219,7 +216,7 @@ namespace Org.BouncyCastle.Tls TlsCrypto crypto = context.Crypto; int maxChainLength = System.Math.Max(1, options.MaxChainLength); - IList certificate_list = Platform.CreateArrayList(); + var certificate_list = new List(); while (buf.Position < buf.Length) { if (certificate_list.Count >= maxChainLength) @@ -236,7 +233,7 @@ namespace Org.BouncyCastle.Tls CalculateEndPointHash(context, cert, derEncoding, endPointHashOutput); } - IDictionary extensions = null; + IDictionary extensions = null; if (isTlsV13) { byte[] extEncoding = TlsUtilities.ReadOpaque16(buf); -- cgit 1.4.1