it.eng.rdlab.soa3.connector.utils
Class SecurityManager

java.lang.Object
  extended by it.eng.rdlab.soa3.connector.utils.SecurityManager

public class SecurityManager
extends Object

Manages the security features of the connection with the Policy Manager: the class accepts the paths to certificate, private key and truststore directory it also accepts the extension of the trust files. Default values are: certificate /etc/grid-security/hostcert.pem private key /etc/grid-security/hostkey.pem trust store directory /etc/grid-security/certificates trust files extension .0

Author:
Ciro Formisano (ENG)

Field Summary
static String DEFAULT_CERT_FILE
           
static String DEFAULT_KEY_FILE
           
static String DEFAULT_TRUST_DIR
           
static String DEFAULT_TRUST_FILE_EXTENSION
           
static String KEYSTORE_PWD
           
 
Method Summary
 void addTrustedCert(String file)
          Adds a single trusted certificate
 String getCertFile()
           
static SecurityManager getInstance()
           
 String getKeyFile()
           
 KeyStore getKeyStore()
           
 String getTrustDir()
           
 void invalidateTrustedDir(boolean invalidate)
          If true is passed, the trust dir won't be taken into account
 void loadCertificate()
          Loads the configured certificates
 void loadCertificate(boolean threadLocal)
           
static void main(String[] args)
           
 void removeCertificate()
          Removes the current credentials from the SSL Socket factory restoring what were set in the ancestor threads
 void setCertFile(String certFile)
          Sets the certificate
 void setKeyFile(String keyFile)
          Sets the key file
 void setPrivateKeyPassword(char[] password)
           
 void setTrustDir(String trustDir)
          Sets the trust directory
 void setTrustExt(String trustExt)
          The trust extension
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

KEYSTORE_PWD

public static final String KEYSTORE_PWD
See Also:
Constant Field Values

DEFAULT_CERT_FILE

public static final String DEFAULT_CERT_FILE
See Also:
Constant Field Values

DEFAULT_KEY_FILE

public static final String DEFAULT_KEY_FILE
See Also:
Constant Field Values

DEFAULT_TRUST_DIR

public static final String DEFAULT_TRUST_DIR
See Also:
Constant Field Values

DEFAULT_TRUST_FILE_EXTENSION

public static final String DEFAULT_TRUST_FILE_EXTENSION
See Also:
Constant Field Values
Method Detail

getInstance

public static SecurityManager getInstance()
Returns:
a singleton instance

setCertFile

public void setCertFile(String certFile)
Sets the certificate

Parameters:
certFile - the complete path to the certificate PEM file

setPrivateKeyPassword

public void setPrivateKeyPassword(char[] password)

setKeyFile

public void setKeyFile(String keyFile)
Sets the key file

Parameters:
keyFile - the complete path to the key PEM file

setTrustDir

public void setTrustDir(String trustDir)
Sets the trust directory

Parameters:
trustDir - the path to the trust dir

setTrustExt

public void setTrustExt(String trustExt)
The trust extension

Parameters:
trustExt - the trust files extension

getCertFile

public String getCertFile()
Returns:

getKeyFile

public String getKeyFile()
Returns:

getTrustDir

public String getTrustDir()
Returns:

invalidateTrustedDir

public void invalidateTrustedDir(boolean invalidate)
If true is passed, the trust dir won't be taken into account

Parameters:
invalidate -

addTrustedCert

public void addTrustedCert(String file)
Adds a single trusted certificate

Parameters:
file - the complete path to the trusted certificate PEM file

loadCertificate

public void loadCertificate()
                     throws Exception
Loads the configured certificates

Throws:
Exception

loadCertificate

public void loadCertificate(boolean threadLocal)
                     throws Exception
Parameters:
threadLocal -
Throws:
Exception

removeCertificate

public void removeCertificate()
Removes the current credentials from the SSL Socket factory restoring what were set in the ancestor threads


getKeyStore

public KeyStore getKeyStore()
Returns:

main

public static void main(String[] args)
                 throws Exception
Throws:
Exception


Copyright © 2013. All Rights Reserved.