|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object tribble.security.StreamDigest
Simple cryptographic file digest generator. Reads an input stream and produces a cryptographic message digest from its byte contents.
Field Summary | |
static int |
BLKSIZE
Input block size (in bytes). |
static java.lang.String |
CLASS_NAME
This class name. |
static java.lang.String |
DFL_ALG
Default message digest algorithm ("MD5"). |
protected java.lang.String |
m_alg
Message digest algorithm. |
protected java.security.MessageDigest |
m_dig
Cryptographic message digest engine. |
protected java.io.InputStream |
m_in
Byte input stream. |
Constructor Summary | |
StreamDigest()
Default constructor. |
|
StreamDigest(java.io.InputStream in)
Constructor. |
|
StreamDigest(java.io.InputStream in,
java.lang.String alg)
Constructor. |
Method Summary | |
void |
close()
Closes the input stream. |
java.lang.String |
digest()
Reads the contents of the input stream, producing a cryptographic message digest, and returning it as a printable text string. |
java.lang.String |
getAlgorithm()
Retrieves the cryptographic message digest algorithm to use. |
java.io.InputStream |
getInput()
Retrieves the input stream from which to read bytes. |
static void |
main(java.lang.String[] args)
Runs this class as a program. |
protected static void |
run(java.lang.String[] args)
Runs this class as a program. |
void |
setAlgorithm(java.lang.String alg)
Establishes the cryptographic message digest algorithm to use. |
void |
setInput(java.io.InputStream in)
Establishes the input stream from which to read bytes. |
protected static void |
usage()
Displays a program usage message, then punts. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final java.lang.String CLASS_NAME
public static final java.lang.String DFL_ALG
public static final int BLKSIZE
protected java.io.InputStream m_in
protected java.lang.String m_alg
protected java.security.MessageDigest m_dig
Constructor Detail |
public StreamDigest()
public StreamDigest(java.io.InputStream in)
in
- The input stream from which to read bytes.public StreamDigest(java.io.InputStream in, java.lang.String alg) throws java.security.NoSuchAlgorithmException
in
- The input stream from which to read bytes.alg
- The cryptographic message digest algorithm to use.
java.security.NoSuchAlgorithmException
- Thrown if alg does not specify a supported digest algorithm.Method Detail |
public static void main(java.lang.String[] args) throws java.lang.Exception
args
- The command line arguments.
java.lang.Exception
public void setAlgorithm(java.lang.String alg) throws java.security.NoSuchAlgorithmException
alg
- The cryptographic message digest algorithm to use.
java.security.NoSuchAlgorithmException
- Thrown if alg does not specify a supported digest algorithm.public java.lang.String getAlgorithm()
public void setInput(java.io.InputStream in)
in
- The input stream from which to read bytes.public java.io.InputStream getInput()
public void close()
public java.lang.String digest() throws java.io.IOException, java.security.NoSuchAlgorithmException
java.io.IOException
- Thrown if an I/O error occurs.
java.security.NoSuchAlgorithmException
- Thrown if an unsupported digest algorithm is used.protected static void usage()
Reads the contents of one of more files, computing a cryptographic message digest, and writes the resulting digest for each one to the standard output.
Usage
java tribble.security.StreamDigest file...If file is "-", input is read from the standard input.
protected static void run(java.lang.String[] args) throws java.io.IOException, java.security.NoSuchAlgorithmException
Reads the contents of one of more files, computing a cryptographic message digest, and writes the resulting digest for each one to the standard output.
Usage
See usage()
.
args
- The command line arguments.
java.io.IOException
java.security.NoSuchAlgorithmException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |