org.gudy.azureus2.pluginsimpl.local.utils.security
Class SESecurityManagerImpl

java.lang.Object
  extended by org.gudy.azureus2.pluginsimpl.local.utils.security.SESecurityManagerImpl
All Implemented Interfaces:
SESecurityManager

public class SESecurityManagerImpl
extends java.lang.Object
implements SESecurityManager


Field Summary
 
Fields inherited from interface org.gudy.azureus2.plugins.utils.security.SESecurityManager
BLOCK_ENCRYPTION_AES, BLOCK_ENCRYPTION_NONE
 
Constructor Summary
SESecurityManagerImpl(AzureusCore _core)
           
 
Method Summary
 void addCertificateListener(CertificateListener listener)
           
 void addPasswordListener(PasswordListener listener)
           
 byte[] calculateSHA1(byte[] data_in)
          returns the SHA1 hash of the input data
 java.security.cert.Certificate createSelfSignedCertificate(java.lang.String alias, java.lang.String cert_dn, int strength)
          creates and installs a certificate capable of supporting SSL of type MD5withRSA
 SEPublicKey decodePublicKey(byte[] encoded)
           
 byte[] getIdentity()
          Gets this azureus instance's unique random identity
 java.security.KeyStore getKeyStore()
           
 SEPublicKey getPublicKey(int key_type, java.lang.String reason_resource)
          Gets the public key for this az instance of the supplied key type
 GenericMessageConnection getSTSConnection(GenericMessageConnection connection, SEPublicKey my_public_key, SEPublicKeyLocator key_locator, java.lang.String reason_resource, int block_crypto)
          Returns a proxy generic STS connection for incoming connection requests
 java.security.KeyStore getTrustStore()
           
 javax.net.ssl.SSLSocketFactory installServerCertificate(java.net.URL url)
          Installs the SSL certificate necessary to support the connection
 void removeCertificateListener(CertificateListener listener)
           
 void removePasswordListener(PasswordListener listener)
           
 void runWithAuthenticator(java.net.Authenticator authenticator, java.lang.Runnable target)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SESecurityManagerImpl

public SESecurityManagerImpl(AzureusCore _core)
Method Detail

calculateSHA1

public byte[] calculateSHA1(byte[] data_in)
Description copied from interface: SESecurityManager
returns the SHA1 hash of the input data

Specified by:
calculateSHA1 in interface SESecurityManager
Returns:

runWithAuthenticator

public void runWithAuthenticator(java.net.Authenticator authenticator,
                                 java.lang.Runnable target)
Specified by:
runWithAuthenticator in interface SESecurityManager

addPasswordListener

public void addPasswordListener(PasswordListener listener)
Specified by:
addPasswordListener in interface SESecurityManager

removePasswordListener

public void removePasswordListener(PasswordListener listener)
Specified by:
removePasswordListener in interface SESecurityManager

addCertificateListener

public void addCertificateListener(CertificateListener listener)
Specified by:
addCertificateListener in interface SESecurityManager

removeCertificateListener

public void removeCertificateListener(CertificateListener listener)
Specified by:
removeCertificateListener in interface SESecurityManager

installServerCertificate

public javax.net.ssl.SSLSocketFactory installServerCertificate(java.net.URL url)
Description copied from interface: SESecurityManager
Installs the SSL certificate necessary to support the connection

Specified by:
installServerCertificate in interface SESecurityManager

getKeyStore

public java.security.KeyStore getKeyStore()
                                   throws java.lang.Exception
Specified by:
getKeyStore in interface SESecurityManager
Throws:
java.lang.Exception

getTrustStore

public java.security.KeyStore getTrustStore()
                                     throws java.lang.Exception
Specified by:
getTrustStore in interface SESecurityManager
Throws:
java.lang.Exception

createSelfSignedCertificate

public java.security.cert.Certificate createSelfSignedCertificate(java.lang.String alias,
                                                                  java.lang.String cert_dn,
                                                                  int strength)
                                                           throws java.lang.Exception
Description copied from interface: SESecurityManager
creates and installs a certificate capable of supporting SSL of type MD5withRSA

Specified by:
createSelfSignedCertificate in interface SESecurityManager
Parameters:
alias - alias - e.g. "mycert"
cert_dn - dn for the cert e.g. "CN=fred,OU=wap,O=wip,L=here,ST=there,C=GB"
strength - keyt strength - e.g. 1024
Returns:
Throws:
java.lang.Exception

getIdentity

public byte[] getIdentity()
Description copied from interface: SESecurityManager
Gets this azureus instance's unique random identity

Specified by:
getIdentity in interface SESecurityManager
Returns:

getPublicKey

public SEPublicKey getPublicKey(int key_type,
                                java.lang.String reason_resource)
                         throws java.lang.Exception
Description copied from interface: SESecurityManager
Gets the public key for this az instance of the supplied key type

Specified by:
getPublicKey in interface SESecurityManager
Parameters:
key_type - see KEY_TYPE_x constants in SEPublicKey
reason_resource - a message text resource giving the reason for the key being required
Returns:
Throws:
java.lang.Exception

decodePublicKey

public SEPublicKey decodePublicKey(byte[] encoded)
Specified by:
decodePublicKey in interface SESecurityManager

getSTSConnection

public GenericMessageConnection getSTSConnection(GenericMessageConnection connection,
                                                 SEPublicKey my_public_key,
                                                 SEPublicKeyLocator key_locator,
                                                 java.lang.String reason_resource,
                                                 int block_crypto)
                                          throws java.lang.Exception
Description copied from interface: SESecurityManager
Returns a proxy generic STS connection for incoming connection requests

Specified by:
getSTSConnection in interface SESecurityManager
Returns:
Throws:
java.lang.Exception