org.norther.tammi.core.security
Interface MessageDigestFactory

All Superinterfaces:
ObjectFactory
All Known Implementing Classes:
DefaultMessageDigestFactory

public interface MessageDigestFactory
extends ObjectFactory

An interface to java.security.MessageDigest factories.

Author:
Ilkka Priha

Method Summary
 String decodeBase64(String string)
          Decodes a BASE64 string applying the UTF-8 encoding.
 String decodeBase64(String string, String encoding)
          Decodes a BASE64 string applying the specified encoding.
 String digest(String algorithm, String string)
          Computes a hash for the given string by applying platform's default encoding.
 String digest(String algorithm, String string, String encoding)
          Computes a hash for the given string applying the specified encoding.
 String digest(String algorithm, String salt, String string, String encoding)
          Computes a hash for the given string using the given salt and applying the specified encoding.
 String encodeBase64(String string)
          Encodes a BASE64 string applying the UTF-8 encoding.
 String encodeBase64(String string, String encoding)
          Encodes a BASE64 string applying the specified encoding.
 
Methods inherited from interface org.norther.tammi.core.base.ObjectFactory
getInstance, getInstance, getInstance, getInstance, isLoaderSupported
 

Method Detail

digest

String digest(String algorithm,
              String string)
              throws NoSuchAlgorithmException
Computes a hash for the given string by applying platform's default encoding.

Parameters:
algorithm - the digest algorithm.
string - the string to use.
Returns:
the BASE64 or MD5 encoded hash.
Throws:
NoSuchAlgorithmException - if the algorithm is unknown.

digest

String digest(String algorithm,
              String string,
              String encoding)
              throws NoSuchAlgorithmException
Computes a hash for the given string applying the specified encoding.

Parameters:
algorithm - the digest algorithm.
string - the string to use.
encoding - the character encoding.
Returns:
the BASE64 or MD5 encoded hash.
Throws:
NoSuchAlgorithmException - if the algorithm is unknown.

digest

String digest(String algorithm,
              String salt,
              String string,
              String encoding)
              throws NoSuchAlgorithmException
Computes a hash for the given string using the given salt and applying the specified encoding.

Parameters:
algorithm - the digest algorithm.
salt - the salt to use.
string - the string to use.
encoding - the character encoding.
Returns:
the BASE64 or MD5 encoded hash.
Throws:
NoSuchAlgorithmException - if the algorithm is unknown.

encodeBase64

String encodeBase64(String string)
Encodes a BASE64 string applying the UTF-8 encoding.

Parameters:
string - the string to encode.
Returns:
the encoded string.

encodeBase64

String encodeBase64(String string,
                    String encoding)
Encodes a BASE64 string applying the specified encoding.

Parameters:
string - the string to encode.
encoding - the character encoding.
Returns:
the encoded string.

decodeBase64

String decodeBase64(String string)
Decodes a BASE64 string applying the UTF-8 encoding.

Parameters:
string - the string to decode.
Returns:
the decoded string.

decodeBase64

String decodeBase64(String string,
                    String encoding)
Decodes a BASE64 string applying the specified encoding.

Parameters:
string - the string to decode.
encoding - the character encoding.
Returns:
the decoded string.


Copyright © 2004 The Norther Organization. All rights reserved.