2006-06-28 Casey Marshall <[EMAIL PROTECTED]>
* java/security/Signature.java (update): new method.
* java/security/SignatureSpi.java (engineUpdate): new method.
Committed.
### Eclipse Workspace Patch 1.0
#P classpath-ssl-nio
Index: java/security/Signature.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/security/Signature.java,v
retrieving revision 1.15.2.4
diff -u -r1.15.2.4 Signature.java
--- java/security/Signature.java 2 Mar 2006 09:33:59 -0000 1.15.2.4
+++ java/security/Signature.java 28 Jun 2006 22:54:16 -0000
@@ -40,6 +40,7 @@
import gnu.java.security.Engine;
+import java.nio.ByteBuffer;
import java.security.cert.Certificate;
import java.security.cert.X509Certificate;
import java.security.spec.AlgorithmParameterSpec;
@@ -467,6 +468,22 @@
else
throw new SignatureException();
}
+
+ /**
+ * Update this signature with the [EMAIL PROTECTED]
java.nio.Buffer#remaining()}
+ * bytes of the input buffer.
+ *
+ * @param input The input buffer.
+ * @throws SignatureException If this instance was not properly
+ * initialized.
+ */
+ public final void update(ByteBuffer input) throws SignatureException
+ {
+ if (state != UNINITIALIZED)
+ engineUpdate(input);
+ else
+ throw new SignatureException("not initialized");
+ }
/**
* Returns the name of the algorithm currently used. The names of algorithms
Index: java/security/SignatureSpi.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/security/SignatureSpi.java,v
retrieving revision 1.7.2.5
diff -u -r1.7.2.5 SignatureSpi.java
--- java/security/SignatureSpi.java 2 Mar 2006 09:33:59 -0000 1.7.2.5
+++ java/security/SignatureSpi.java 28 Jun 2006 22:54:16 -0000
@@ -37,6 +37,7 @@
package java.security;
+import java.nio.ByteBuffer;
import java.security.spec.AlgorithmParameterSpec;
/**
@@ -131,6 +132,24 @@
throws SignatureException;
/**
+ * Update this signature with the [EMAIL PROTECTED]
java.nio.Buffer#remaining()}
+ * bytes of the given buffer.
+ *
+ * @param input The input buffer.
+ * @throws SignatureException
+ */
+ protected void engineUpdate(ByteBuffer input) throws SignatureException
+ {
+ byte[] buf = new byte[4096];
+ while (input.hasRemaining())
+ {
+ int l = Math.min(input.remaining(), buf.length);
+ input.get(buf, 0, l);
+ engineUpdate(buf, 0, l);
+ }
+ }
+
+ /**
* Returns the signature bytes of all the data fed to this instance. The
* format of the output depends on the underlying signature algorithm.
*
PGP.sig
Description: This is a digitally signed message part
