to.etc.util
Class SecurityUtils

java.lang.Object
  extended by to.etc.util.SecurityUtils

public class SecurityUtils
extends java.lang.Object

Author:
Frits Jalvingh Created on Apr 6, 2004

Constructor Summary
SecurityUtils()
           
 
Method Summary
static java.security.PrivateKey decodePrivateKeyFromBase64(java.lang.String enc)
          Decodes a private key from an encoded value.
static java.security.PrivateKey decodePrivateKeyFromBase64(java.lang.String enc, java.lang.String algo)
          Decodes a private key from an encoded value.
static java.security.PrivateKey decodePrivateKeyFromHex(java.lang.String enc)
          Decodes a private key from an encoded value.
static java.security.PrivateKey decodePrivateKeyFromHex(java.lang.String enc, java.lang.String algo)
          Decodes a private key from an encoded value.
static java.security.PublicKey decodePublicKeyFromBase64(java.lang.String enc)
          Decodes a public key from an encoded value.
static java.security.PublicKey decodePublicKeyFromBase64(java.lang.String enc, java.lang.String algo)
          Decodes a public key from an encoded value.
static java.security.PublicKey decodePublicKeyFromHex(java.lang.String enc)
          Decodes a public key from an encoded value.
static java.security.PublicKey decodePublicKeyFromHex(java.lang.String enc, java.lang.String algo)
          Decodes a public key from an encoded value.
static java.lang.String encodeToBase64(java.security.PrivateKey privk)
           
static java.lang.String encodeToBase64(java.security.PublicKey pubk)
           
static java.lang.String encodeToHex(java.security.PrivateKey privk)
           
static java.lang.String encodeToHex(java.security.PublicKey pubk)
           
static byte[] md5Hash(byte[] data)
          Returns the MD5 hash for the data passed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SecurityUtils

public SecurityUtils()
Method Detail

encodeToHex

public static java.lang.String encodeToHex(java.security.PrivateKey privk)

encodeToHex

public static java.lang.String encodeToHex(java.security.PublicKey pubk)

encodeToBase64

public static java.lang.String encodeToBase64(java.security.PrivateKey privk)

encodeToBase64

public static java.lang.String encodeToBase64(java.security.PublicKey pubk)

decodePublicKeyFromHex

public static java.security.PublicKey decodePublicKeyFromHex(java.lang.String enc,
                                                             java.lang.String algo)
                                                      throws java.lang.Exception
Decodes a public key from an encoded value.

Parameters:
enc - the hex string.
Returns:
a public key.
Throws:
java.lang.Exception

decodePrivateKeyFromHex

public static java.security.PrivateKey decodePrivateKeyFromHex(java.lang.String enc,
                                                               java.lang.String algo)
                                                        throws java.lang.Exception
Decodes a private key from an encoded value.

Parameters:
enc - the hex string.
Returns:
a public key.
Throws:
java.lang.Exception

decodePublicKeyFromHex

public static java.security.PublicKey decodePublicKeyFromHex(java.lang.String enc)
                                                      throws java.lang.Exception
Decodes a public key from an encoded value.

Parameters:
enc - the hex string.
Returns:
a public key.
Throws:
java.lang.Exception

decodePrivateKeyFromHex

public static java.security.PrivateKey decodePrivateKeyFromHex(java.lang.String enc)
                                                        throws java.lang.Exception
Decodes a private key from an encoded value.

Parameters:
enc - the hex string.
Returns:
a public key.
Throws:
java.lang.Exception

decodePublicKeyFromBase64

public static java.security.PublicKey decodePublicKeyFromBase64(java.lang.String enc)
                                                         throws java.lang.Exception
Decodes a public key from an encoded value.

Parameters:
enc - the hex string.
Returns:
a public key.
Throws:
java.lang.Exception

decodePrivateKeyFromBase64

public static java.security.PrivateKey decodePrivateKeyFromBase64(java.lang.String enc)
                                                           throws java.lang.Exception
Decodes a private key from an encoded value.

Parameters:
enc - the hex string.
Returns:
a public key.
Throws:
java.lang.Exception

decodePublicKeyFromBase64

public static java.security.PublicKey decodePublicKeyFromBase64(java.lang.String enc,
                                                                java.lang.String algo)
                                                         throws java.lang.Exception
Decodes a public key from an encoded value.

Parameters:
enc - the hex string.
Returns:
a public key.
Throws:
java.lang.Exception

decodePrivateKeyFromBase64

public static java.security.PrivateKey decodePrivateKeyFromBase64(java.lang.String enc,
                                                                  java.lang.String algo)
                                                           throws java.lang.Exception
Decodes a private key from an encoded value.

Parameters:
enc - the hex string.
Returns:
a public key.
Throws:
java.lang.Exception

md5Hash

public static byte[] md5Hash(byte[] data)
Returns the MD5 hash for the data passed.