de.hs_rm.cs.lecturenotes.server.core.persistence
Class DatabaseSecureUtil

java.lang.Object
  extended by de.hs_rm.cs.lecturenotes.server.core.persistence.DatabaseSecureUtil

public final class DatabaseSecureUtil
extends java.lang.Object

An utility class to wrap security methods in relation to database storage.

Version:
$LastChangedRevision: 231 $
Author:
Enrico Homann

Method Summary
static java.lang.String bytesValueToHex(byte[] data)
          Will return a String with hex values for byte[] data.
static java.lang.String getHashSha256(java.lang.String input)
          Will return the SHA-256 hash value of String input.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

bytesValueToHex

public static java.lang.String bytesValueToHex(byte[] data)
Will return a String with hex values for byte[] data.

Parameters:
data - byte[]
Returns:
String

getHashSha256

public static java.lang.String getHashSha256(java.lang.String input)
                                      throws java.security.NoSuchAlgorithmException,
                                             java.io.UnsupportedEncodingException
Will return the SHA-256 hash value of String input. The input must be of an utf8 encoded charset.

Parameters:
input - String.
Returns:
String
Throws:
java.security.NoSuchAlgorithmException - thrown if method SHA-256 wasn't found in the security library
java.io.UnsupportedEncodingException - Thrown if the utf8 charset encoding wasn't found in the system