org.rhq.enterprise.communications.util
Class SecurityUtil

java.lang.Object
  extended by org.rhq.enterprise.communications.util.SecurityUtil

public class SecurityUtil
extends Object

Utilities to help perform security tasks.

Author:
John Mazzitelli

Method Summary
static void createKeyStore(String file_path, String key_alias, String domain_name, String keystore_password, String key_password, String key_algorithm, int validity)
          Creates a keystore and places a new key in it that has the given key information.
static boolean isTransportSecure(String transport)
          Given a JBoss/Remoting transport name (such as "sslsocket" or "http") this will return true if that transport is considered secure via SSL.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

isTransportSecure

public static boolean isTransportSecure(String transport)
Given a JBoss/Remoting transport name (such as "sslsocket" or "http") this will return true if that transport is considered secure via SSL.

Parameters:
transport - the name of the transport protocol (can be the transport only or the entire locator URI)
Returns:
true if the transport protocol uses SSL to secure the data, false if not

createKeyStore

public static void createKeyStore(String file_path,
                                  String key_alias,
                                  String domain_name,
                                  String keystore_password,
                                  String key_password,
                                  String key_algorithm,
                                  int validity)
                           throws RuntimeException
Creates a keystore and places a new key in it that has the given key information. If the keystore file already exists, this method does nothing. This will only create the key and keystore if the file does not yet exist.

If the key password is null or an empty string, it will be set to the same as the keystore password. If the keystore password is null, an exception is thrown.

If either the keystore password or key password is not at least 6 characters long, an exception is thrown.

If validity is less than or equal to 0, it will default to 100 years.

Parameters:
file_path - the path of the keystore file on the file system (if this exists already, this method does nothing)
key_alias - the alias name of the key that will be generated and placed in the key store
domain_name - the domain name of the new key
keystore_password - the password of the keystore file (must not be null)
key_password - the password of the key within the keystore
key_algorithm - the algorithm used to generate the new key
validity - the number of days the key is valid for
Throws:
RuntimeException - if failed to create the keystore file


Copyright © 2008-2012 Red Hat, Inc.. All Rights Reserved.