info.magnolia.cms.security
Class Digester

java.lang.Object
  extended by info.magnolia.cms.security.Digester

public final class Digester
extends java.lang.Object

Encryption helper. Supported algorithm:

Future:

Version:
2.0
Author:
Sameer Charles

Field Summary
static java.lang.String MD5
           
static java.lang.String SHA1
           
static java.lang.String SHA256
          There are five (5) FIPS-approved* algorithms for generating a condensed representation of a message (message digest): SHA-1, SHA-224, SHA-256,SHA-384, and SHA-512.
static java.lang.String SHA384
           
static java.lang.String SHA512
           
 
Method Summary
static byte[] getDigest(byte[] data, java.lang.String algorithm)
           
static java.lang.String getDigest(java.lang.String data, java.lang.String algorithm)
           
static java.lang.String getMD5Hex(java.lang.String data)
          Gets MD5 encoded -> hex string.
static java.lang.String getSHA1Hex(java.lang.String data)
          Gets SHA-1 encoded -> hex string.
static java.lang.String toHEX(byte[] data)
          Converts a byte array to a string Hex.
static java.lang.String toHEX(java.lang.String data)
          Converts a byte array to a string Hex.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SHA1

public static final java.lang.String SHA1
See Also:
Constant Field Values

MD5

public static final java.lang.String MD5
See Also:
Constant Field Values

SHA256

public static final java.lang.String SHA256
There are five (5) FIPS-approved* algorithms for generating a condensed representation of a message (message digest): SHA-1, SHA-224, SHA-256,SHA-384, and SHA-512. Not supported yet

See Also:
Constant Field Values

SHA384

public static final java.lang.String SHA384
See Also:
Constant Field Values

SHA512

public static final java.lang.String SHA512
See Also:
Constant Field Values
Method Detail

getDigest

public static java.lang.String getDigest(java.lang.String data,
                                         java.lang.String algorithm)
                                  throws java.security.NoSuchAlgorithmException
Throws:
java.security.NoSuchAlgorithmException

getDigest

public static byte[] getDigest(byte[] data,
                               java.lang.String algorithm)
                        throws java.security.NoSuchAlgorithmException
Throws:
java.security.NoSuchAlgorithmException

getSHA1Hex

public static java.lang.String getSHA1Hex(java.lang.String data)
Gets SHA-1 encoded -> hex string.


getMD5Hex

public static java.lang.String getMD5Hex(java.lang.String data)
Gets MD5 encoded -> hex string.


toHEX

public static java.lang.String toHEX(java.lang.String data)
Converts a byte array to a string Hex.

Parameters:
data - to be converted
Returns:
string representing hex values of the byte array

toHEX

public static java.lang.String toHEX(byte[] data)
Converts a byte array to a string Hex.

Parameters:
data - to be converted
Returns:
string representing hex values of the byte array


Copyright © 2003-2011 Magnolia International Ltd.. All Rights Reserved.