diff options
-rw-r--r-- | crypto/src/crypto/tls/ServerName.cs | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/crypto/src/crypto/tls/ServerName.cs b/crypto/src/crypto/tls/ServerName.cs index 3d1e8f844..d42055b78 100644 --- a/crypto/src/crypto/tls/ServerName.cs +++ b/crypto/src/crypto/tls/ServerName.cs @@ -1,5 +1,6 @@ using System; using System.IO; +using System.Text; using Org.BouncyCastle.Utilities; @@ -51,10 +52,10 @@ namespace Org.BouncyCastle.Crypto.Tls switch (mNameType) { case Tls.NameType.host_name: - byte[] utf8Encoding = Strings.ToUtf8ByteArray((string)mName); - if (utf8Encoding.Length < 1) + byte[] asciiEncoding = Encoding.ASCII.GetBytes((string)mName); + if (asciiEncoding.Length < 1) throw new TlsFatalAlert(AlertDescription.internal_error); - TlsUtilities.WriteOpaque16(utf8Encoding, output); + TlsUtilities.WriteOpaque16(asciiEncoding, output); break; default: throw new TlsFatalAlert(AlertDescription.internal_error); @@ -78,10 +79,10 @@ namespace Org.BouncyCastle.Crypto.Tls { case Tls.NameType.host_name: { - byte[] utf8Encoding = TlsUtilities.ReadOpaque16(input); - if (utf8Encoding.Length < 1) + byte[] asciiEncoding = TlsUtilities.ReadOpaque16(input); + if (asciiEncoding.Length < 1) throw new TlsFatalAlert(AlertDescription.decode_error); - name = Strings.FromUtf8ByteArray(utf8Encoding); + name = Encoding.ASCII.GetString(asciiEncoding); break; } default: |