From b90c58ee419838514e615180216408ced07a2121 Mon Sep 17 00:00:00 2001 From: Peter Dettman Date: Fri, 13 Nov 2015 22:11:34 +0700 Subject: Use portable methods for ASCII conversion --- crypto/src/crypto/tls/ServerName.cs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'crypto/src') diff --git a/crypto/src/crypto/tls/ServerName.cs b/crypto/src/crypto/tls/ServerName.cs index d42055b78..508c2ddbc 100644 --- a/crypto/src/crypto/tls/ServerName.cs +++ b/crypto/src/crypto/tls/ServerName.cs @@ -1,6 +1,5 @@ using System; using System.IO; -using System.Text; using Org.BouncyCastle.Utilities; @@ -52,7 +51,7 @@ namespace Org.BouncyCastle.Crypto.Tls switch (mNameType) { case Tls.NameType.host_name: - byte[] asciiEncoding = Encoding.ASCII.GetBytes((string)mName); + byte[] asciiEncoding = Strings.ToAsciiByteArray((string)mName); if (asciiEncoding.Length < 1) throw new TlsFatalAlert(AlertDescription.internal_error); TlsUtilities.WriteOpaque16(asciiEncoding, output); @@ -82,7 +81,7 @@ namespace Org.BouncyCastle.Crypto.Tls byte[] asciiEncoding = TlsUtilities.ReadOpaque16(input); if (asciiEncoding.Length < 1) throw new TlsFatalAlert(AlertDescription.decode_error); - name = Encoding.ASCII.GetString(asciiEncoding); + name = Strings.FromAsciiByteArray(asciiEncoding); break; } default: -- cgit 1.5.1