summary refs log tree commit diff
path: root/crypto/src/util
diff options
context:
space:
mode:
authorPeter Dettman <peter.dettman@bouncycastle.org>2014-07-21 20:05:27 +0700
committerPeter Dettman <peter.dettman@bouncycastle.org>2014-07-21 20:05:27 +0700
commit0c51033abe10b6a2b0035ea6bab8c471be6f45dc (patch)
tree8e48802b9c29d98996cf49b92726ec81ab0edcb2 /crypto/src/util
parentPort of PrivateKeyInfo changes from Java (diff)
downloadBouncyCastle.NET-ed25519-0c51033abe10b6a2b0035ea6bab8c471be6f45dc.tar.xz
BMA-105
Support for parsing Gost3410x2001 private keys encoded as DER Integer
Miscellaneous support methods ported from Java
Diffstat (limited to 'crypto/src/util')
-rw-r--r--crypto/src/util/Arrays.cs16
1 files changed, 16 insertions, 0 deletions
diff --git a/crypto/src/util/Arrays.cs b/crypto/src/util/Arrays.cs
index a21dd00b1..37da3940f 100644
--- a/crypto/src/util/Arrays.cs
+++ b/crypto/src/util/Arrays.cs
@@ -396,5 +396,21 @@ namespace Org.BouncyCastle.Utilities
             Array.Copy(b, 0, rv, a.Length, b.Length);
             return rv;
         }
+
+        public static byte[] Reverse(byte[] a)
+        {
+            if (a == null)
+                return null;
+
+            int p1 = 0, p2 = a.Length;
+            byte[] result = new byte[p2];
+
+            while (--p2 >= 0)
+            {
+                result[p2] = a[p1++];
+            }
+
+            return result;
+        }
     }
 }