diff options
author | Peter Dettman <peter.dettman@bouncycastle.org> | 2015-11-13 22:11:34 +0700 |
---|---|---|
committer | Peter Dettman <peter.dettman@bouncycastle.org> | 2015-11-13 22:11:34 +0700 |
commit | b90c58ee419838514e615180216408ced07a2121 (patch) | |
tree | a51ff5daa5eee27dbe42d30255658d8fb6244797 | |
parent | Include basic encode/parse test (diff) | |
download | BouncyCastle.NET-ed25519-b90c58ee419838514e615180216408ced07a2121.tar.xz |
Use portable methods for ASCII conversion
-rw-r--r-- | crypto/src/crypto/tls/ServerName.cs | 5 |
1 files changed, 2 insertions, 3 deletions
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: |