diff options
author | David Hook <dgh@cryptoworkshop.com> | 2013-09-11 08:39:42 +0400 |
---|---|---|
committer | David Hook <dgh@cryptoworkshop.com> | 2013-09-11 08:39:42 +0400 |
commit | 86b1b4c2587b0e7b0162cb60a5038103ca2494ff (patch) | |
tree | 6e7a57bb3a48ec436c386ca42beb9f7ac74275a7 /core/src/main/java/org/bouncycastle/util/Arrays.java | |
parent | ac21f62e490d66c4314ea36c3e63993d8b9dbfb5 (diff) |
added checks for some common encoding errors to prevent failure.
Diffstat (limited to 'core/src/main/java/org/bouncycastle/util/Arrays.java')
-rw-r--r-- | core/src/main/java/org/bouncycastle/util/Arrays.java | 11 |
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); |