Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/quite/humla-spongycastle.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Hook <dgh@cryptoworkshop.com>2013-09-11 08:39:42 +0400
committerDavid Hook <dgh@cryptoworkshop.com>2013-09-11 08:39:42 +0400
commit86b1b4c2587b0e7b0162cb60a5038103ca2494ff (patch)
tree6e7a57bb3a48ec436c386ca42beb9f7ac74275a7 /core/src/main/java/org/bouncycastle/util
parentac21f62e490d66c4314ea36c3e63993d8b9dbfb5 (diff)
added checks for some common encoding errors to prevent failure.
Diffstat (limited to 'core/src/main/java/org/bouncycastle/util')
-rw-r--r--core/src/main/java/org/bouncycastle/util/Arrays.java11
1 files changed, 11 insertions, 0 deletions
diff --git a/core/src/main/java/org/bouncycastle/util/Arrays.java b/core/src/main/java/org/bouncycastle/util/Arrays.java
index 4c11cad6..d99fab7a 100644
--- a/core/src/main/java/org/bouncycastle/util/Arrays.java
+++ b/core/src/main/java/org/bouncycastle/util/Arrays.java
@@ -617,6 +617,17 @@ public final class Arrays
return tmp;
}
+ /**
+ * Make a copy of a range of bytes from the passed in data array. The range can
+ * extend beyond the end of the input array, in which case the return array will
+ * be padded with zeroes.
+ *
+ * @param data the array from which the data is to be copied.
+ * @param from the start index at which the copying should take place.
+ * @param to the final index of the range (exclusive).
+ *
+ * @return a new byte array containing the range given.
+ */
public static byte[] copyOfRange(byte[] data, int from, int to)
{
int newLength = getLength(from, to);