summary refs log tree commit diff
path: root/crypto/src/util/Strings.cs
diff options
context:
space:
mode:
authorPeter Dettman <peter.dettman@bouncycastle.org>2022-06-28 12:55:26 +0700
committerPeter Dettman <peter.dettman@bouncycastle.org>2022-06-28 12:55:26 +0700
commit0f951361cae9243b8d1a77d8f4333a602197d50d (patch)
treec5f2adc22a0b8ef42d5964df49268b73b3371a30 /crypto/src/util/Strings.cs
parentGenerics migration in Cms (diff)
downloadBouncyCastle.NET-ed25519-0f951361cae9243b8d1a77d8f4333a602197d50d.tar.xz
Generics migration in Crmf, Crypto, Math
Diffstat (limited to 'crypto/src/util/Strings.cs')
-rw-r--r--crypto/src/util/Strings.cs67
1 files changed, 9 insertions, 58 deletions
diff --git a/crypto/src/util/Strings.cs b/crypto/src/util/Strings.cs
index 1a94d2bff..1d0c94611 100644
--- a/crypto/src/util/Strings.cs
+++ b/crypto/src/util/Strings.cs
@@ -6,31 +6,6 @@ namespace Org.BouncyCastle.Utilities
     /// <summary> General string utilities.</summary>
     public abstract class Strings
     {
-
-        public static string ToUpperCase(string original)
-        {
-            bool changed = false;
-            char[] chars = original.ToCharArray();
-
-            for (int i = 0; i != chars.Length; i++)
-            {
-                char ch = chars[i];
-                if ('a' <= ch && 'z' >= ch)
-                {
-                    changed = true;
-                    chars[i] = (char)(ch - 'a' + 'A');
-                }
-            }
-
-            if (changed)
-            {
-                return new string(chars);
-            }
-
-            return original;
-        }
-
-
         internal static bool IsOneOf(string s, params string[] candidates)
         {
             foreach (string candidate in candidates)
@@ -41,8 +16,7 @@ namespace Org.BouncyCastle.Utilities
             return false;
         }
 
-        public static string FromByteArray(
-            byte[] bs)
+        public static string FromByteArray(byte[] bs)
         {
             char[] cs = new char[bs.Length];
             for (int i = 0; i < cs.Length; ++i)
@@ -52,8 +26,7 @@ namespace Org.BouncyCastle.Utilities
             return new string(cs);
         }
 
-        public static byte[] ToByteArray(
-            char[] cs)
+        public static byte[] ToByteArray(char[] cs)
         {
             byte[] bs = new byte[cs.Length];
             for (int i = 0; i < bs.Length; ++i)
@@ -63,8 +36,7 @@ namespace Org.BouncyCastle.Utilities
             return bs;
         }
 
-        public static byte[] ToByteArray(
-            string s)
+        public static byte[] ToByteArray(string s)
         {
             byte[] bs = new byte[s.Length];
             for (int i = 0; i < bs.Length; ++i)
@@ -74,53 +46,32 @@ namespace Org.BouncyCastle.Utilities
             return bs;
         }
 
-        public static string FromAsciiByteArray(
-            byte[] bytes)
+        public static string FromAsciiByteArray(byte[] bytes)
         {
-#if PORTABLE
-            // TODO Check for non-ASCII bytes in input?
-            return Encoding.UTF8.GetString(bytes, 0, bytes.Length);
-#else
             return Encoding.ASCII.GetString(bytes, 0, bytes.Length);
-#endif
         }
 
-        public static byte[] ToAsciiByteArray(
-            char[] cs)
+        public static byte[] ToAsciiByteArray(char[] cs)
         {
-#if PORTABLE
-            // TODO Check for non-ASCII characters in input?
-            return Encoding.UTF8.GetBytes(cs);
-#else
             return Encoding.ASCII.GetBytes(cs);
-#endif
         }
 
-        public static byte[] ToAsciiByteArray(
-            string s)
+        public static byte[] ToAsciiByteArray(string s)
         {
-#if PORTABLE
-            // TODO Check for non-ASCII characters in input?
-            return Encoding.UTF8.GetBytes(s);
-#else
             return Encoding.ASCII.GetBytes(s);
-#endif
         }
 
-        public static string FromUtf8ByteArray(
-            byte[] bytes)
+        public static string FromUtf8ByteArray(byte[] bytes)
         {
             return Encoding.UTF8.GetString(bytes, 0, bytes.Length);
         }
 
-        public static byte[] ToUtf8ByteArray(
-            char[] cs)
+        public static byte[] ToUtf8ByteArray(char[] cs)
         {
             return Encoding.UTF8.GetBytes(cs);
         }
 
-        public static byte[] ToUtf8ByteArray(
-            string s)
+        public static byte[] ToUtf8ByteArray(string s)
         {
             return Encoding.UTF8.GetBytes(s);
         }