A DESCRIPTION OF THE PROBLEM :
The file reading code in the exmple, here:
FileInputStream fis = new FileInputStream(args[0]);
BufferedInputStream bufin = new BufferedInputStream(fis);
byte[] buffer = new byte[1024];
int len;
while (bufin.available() != 0) {
len = bufin.read(buffer);
dsa.update(buffer, 0, len);
};
bufin.close();
is invalid -- .available() is used incorrectly and as such the entire file may not be read. A reader may in fact encounter a problem with this code.
URL OF FAULTY DOCUMENTATION :
http://java.sun.com/docs/books/tutorial/security1.2/apisign/step3.html
###@###.### 2005-1-04 18:46:50 GMT
The file reading code in the exmple, here:
FileInputStream fis = new FileInputStream(args[0]);
BufferedInputStream bufin = new BufferedInputStream(fis);
byte[] buffer = new byte[1024];
int len;
while (bufin.available() != 0) {
len = bufin.read(buffer);
dsa.update(buffer, 0, len);
};
bufin.close();
is invalid -- .available() is used incorrectly and as such the entire file may not be read. A reader may in fact encounter a problem with this code.
URL OF FAULTY DOCUMENTATION :
http://java.sun.com/docs/books/tutorial/security1.2/apisign/step3.html
###@###.### 2005-1-04 18:46:50 GMT