org.apache.james.security
Class DigestUtil

java.lang.Object
  extended by org.apache.james.security.DigestUtil

public class DigestUtil
extends java.lang.Object

Computes and verifies digests of files and strings

Version:
$Revision: 494012 $

Method Summary
static void digestFile(java.lang.String filename, java.lang.String algorithm)
          Calculate digest of given file with given algorithm.
static java.lang.String digestString(java.lang.String pass, java.lang.String algorithm)
          Calculate digest of given String using given algorithm.
static void main(java.lang.String[] args)
          Command line interface.
static void printUsage()
          Print the command line usage string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

main

public static void main(java.lang.String[] args)
Command line interface. Use -help for arguments.

Parameters:
args - the arguments passed in on the command line

printUsage

public static void printUsage()
Print the command line usage string.


digestFile

public static void digestFile(java.lang.String filename,
                              java.lang.String algorithm)
Calculate digest of given file with given algorithm. Writes digest to file named filename.algorithm .

Parameters:
filename - the String name of the file to be hashed
algorithm - the algorithm to be used to compute the digest

digestString

public static java.lang.String digestString(java.lang.String pass,
                                            java.lang.String algorithm)
                                     throws java.security.NoSuchAlgorithmException
Calculate digest of given String using given algorithm. Encode digest in MIME-like base64.

Parameters:
pass - the String to be hashed
algorithm - the algorithm to be used
Returns:
String Base-64 encoding of digest
Throws:
java.security.NoSuchAlgorithmException - if the algorithm passed in cannot be found


Copyright © 2002-2007 The Apache Software Foundation. All Rights Reserved.