merge copyright headers with brians code
[org.ibex.crypto.git] / src / org / ibex / crypto / RSA.java
index 546d323..e3c179c 100644 (file)
@@ -2,6 +2,11 @@
 // Licensed under the Apache Public Source License 2.0 ("the License").
 // You may not use this file except in compliance with the License.
 
+/*
+ * org.ibex.RSA - By Brian Alliet
+ * Copyright (C) 2004 Brian Alliet
+ */
 package org.ibex.crypto;
 import java.math.BigInteger;
 import java.util.*;
@@ -31,7 +36,7 @@ public class RSA {
         if(reverse ? cbytes[0] == 0 : cbytes.length > outSize) {
             if(cbytes[0] != 0) throw new RuntimeException("should never happen");
             byte[] buf = new byte[cbytes.length-1];
-            System.arraycopy(cbytes,1,buf,0,outSize);
+            System.arraycopy(cbytes,1,buf,0,buf.length);
             return buf;
         } else if(!reverse && cbytes.length < outSize) {
             // output needs to be exactly outSize in length