org.gudy.azureus2.core3.security.impl
Class SESecurityManagerImpl

java.lang.Object
  extended by org.gudy.azureus2.core3.security.impl.SESecurityManagerImpl

public class SESecurityManagerImpl
extends Object


Field Summary
protected  Map certificate_handlers
           
protected  List<SECertificateListener> certificate_listeners
           
protected  boolean exit_vm_permitted
           
protected  String keystore_name
           
protected static String KEYSTORE_TYPE
           
protected  Map password_handlers
           
protected  CopyOnWriteList password_listeners
           
protected static SESecurityManagerImpl singleton
           
protected  AEMonitor this_mon
           
protected  String truststore_name
           
 
Constructor Summary
SESecurityManagerImpl()
           
 
Method Summary
 void addCertificateListener(SECertificateListener l)
           
protected  void addCertToKeyStore(String alias, Key public_key, Certificate[] certChain)
           
protected  SSLSocketFactory addCertToTrustStore(String alias, Certificate cert, boolean update_https_factory)
           
 void addPasswordListener(SEPasswordListener l)
           
protected  boolean checkKeyStoreHasEntry()
           
 void clearPasswords()
           
 Certificate createSelfSignedCertificate(String alias, String cert_dn, int strength)
           
protected  boolean ensureStoreExists(String name)
           
 void exitVM(int status)
           
 TrustManager[] getAllTrustingTrustManager()
           
 TrustManager[] getAllTrustingTrustManager(X509TrustManager delegate)
           
 PasswordAuthentication getAuthentication(String realm, String protocol, String host, int port)
           
 Class[] getClassContext()
           
 SEKeyDetails getKeyDetails(String alias)
           
 KeyStore getKeyStore()
           
 String getKeystoreName()
           
 String getKeystorePassword()
           
 PasswordAuthentication getPasswordAuthentication(String realm, URL tracker)
           
static SESecurityManagerImpl getSingleton()
           
 SSLServerSocketFactory getSSLServerSocketFactory()
           
 SSLSocketFactory getSSLSocketFactory()
           
 TrustManagerFactory getTrustManagerFactory()
           
 KeyStore getTrustStore()
           
 KeyStore getTrustStore(boolean attempt_recovery)
           
 void initialise()
           
 void installAuthenticator()
           
protected  void installSecurityManager()
           
 SSLSocketFactory installServerCertificates(String alias, String host, int port)
           
 SSLSocketFactory installServerCertificates(String alias, String host, int port, boolean sni_hack)
           
 SSLSocketFactory installServerCertificates(URL https_url)
           
protected  KeyStore loadKeyStore()
           
protected  KeyStore loadKeyStore(KeyManagerFactory keyManagerFactory)
           
static void main(String[] args)
           
 void removeCertificateListener(SECertificateListener l)
           
 void removePasswordListener(SEPasswordListener l)
           
 boolean resetTrustStore(boolean test_only)
           
 void setCertificateHandler(URL url, SECertificateListener l)
           
 void setPasswordAuthenticationOutcome(String realm, URL tracker, boolean success)
           
 void setPasswordHandler(URL url, SEPasswordListener l)
           
 void setThreadPasswordHandler(SEPasswordListener l)
           
 void stopThread(Thread t)
           
 void unsetThreadPasswordHandler()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

singleton

protected static SESecurityManagerImpl singleton

KEYSTORE_TYPE

protected static String KEYSTORE_TYPE

keystore_name

protected String keystore_name

truststore_name

protected String truststore_name

certificate_listeners

protected List<SECertificateListener> certificate_listeners

password_listeners

protected CopyOnWriteList password_listeners

password_handlers

protected Map password_handlers

certificate_handlers

protected Map certificate_handlers

exit_vm_permitted

protected boolean exit_vm_permitted

this_mon

protected AEMonitor this_mon
Constructor Detail

SESecurityManagerImpl

public SESecurityManagerImpl()
Method Detail

getSingleton

public static SESecurityManagerImpl getSingleton()

initialise

public void initialise()

resetTrustStore

public boolean resetTrustStore(boolean test_only)

getKeystoreName

public String getKeystoreName()

getKeystorePassword

public String getKeystorePassword()

installSecurityManager

protected void installSecurityManager()

stopThread

public void stopThread(Thread t)

exitVM

public void exitVM(int status)

installAuthenticator

public void installAuthenticator()

getAuthentication

public PasswordAuthentication getAuthentication(String realm,
                                                String protocol,
                                                String host,
                                                int port)

checkKeyStoreHasEntry

protected boolean checkKeyStoreHasEntry()

ensureStoreExists

protected boolean ensureStoreExists(String name)

getKeyStore

public KeyStore getKeyStore()
                     throws Exception
Throws:
Exception

getTrustStore

public KeyStore getTrustStore()
                       throws Exception
Throws:
Exception

getTrustStore

public KeyStore getTrustStore(boolean attempt_recovery)
                       throws Exception
Throws:
Exception

loadKeyStore

protected KeyStore loadKeyStore()
                         throws Exception
Throws:
Exception

loadKeyStore

protected KeyStore loadKeyStore(KeyManagerFactory keyManagerFactory)
                         throws Exception
Throws:
Exception

getSSLServerSocketFactory

public SSLServerSocketFactory getSSLServerSocketFactory()
                                                 throws Exception
Throws:
Exception

getKeyDetails

public SEKeyDetails getKeyDetails(String alias)
                           throws Exception
Throws:
Exception

createSelfSignedCertificate

public Certificate createSelfSignedCertificate(String alias,
                                               String cert_dn,
                                               int strength)
                                        throws Exception
Throws:
Exception

getTrustManagerFactory

public TrustManagerFactory getTrustManagerFactory()

getSSLSocketFactory

public SSLSocketFactory getSSLSocketFactory()

installServerCertificates

public SSLSocketFactory installServerCertificates(URL https_url)

getAllTrustingTrustManager

public TrustManager[] getAllTrustingTrustManager()

getAllTrustingTrustManager

public TrustManager[] getAllTrustingTrustManager(X509TrustManager delegate)

installServerCertificates

public SSLSocketFactory installServerCertificates(String alias,
                                                  String host,
                                                  int port)

installServerCertificates

public SSLSocketFactory installServerCertificates(String alias,
                                                  String host,
                                                  int port,
                                                  boolean sni_hack)

addCertToKeyStore

protected void addCertToKeyStore(String alias,
                                 Key public_key,
                                 Certificate[] certChain)
                          throws Exception
Throws:
Exception

addCertToTrustStore

protected SSLSocketFactory addCertToTrustStore(String alias,
                                               Certificate cert,
                                               boolean update_https_factory)
                                        throws Exception
Throws:
Exception

getPasswordAuthentication

public PasswordAuthentication getPasswordAuthentication(String realm,
                                                        URL tracker)

setPasswordAuthenticationOutcome

public void setPasswordAuthenticationOutcome(String realm,
                                             URL tracker,
                                             boolean success)

addPasswordListener

public void addPasswordListener(SEPasswordListener l)

removePasswordListener

public void removePasswordListener(SEPasswordListener l)

clearPasswords

public void clearPasswords()

setThreadPasswordHandler

public void setThreadPasswordHandler(SEPasswordListener l)

unsetThreadPasswordHandler

public void unsetThreadPasswordHandler()

setPasswordHandler

public void setPasswordHandler(URL url,
                               SEPasswordListener l)

addCertificateListener

public void addCertificateListener(SECertificateListener l)

setCertificateHandler

public void setCertificateHandler(URL url,
                                  SECertificateListener l)

removeCertificateListener

public void removeCertificateListener(SECertificateListener l)

getClassContext

public Class[] getClassContext()

main

public static void main(String[] args)