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 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
 Certificate createSelfSignedCertificate(String alias, 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
 KeyStore getKeyStore()
           
 SEPublicKey getPublicKey(int key_type, 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, String reason_resource, int block_crypto)
          Returns a proxy generic STS connection for incoming connection requests
 KeyStore getTrustStore()
           
 SSLSocketFactory installServerCertificate(URL url)
          Installs the SSL certificate necessary to support the connection
 void removeCertificateListener(CertificateListener listener)
           
 void removePasswordListener(PasswordListener listener)
           
 void runWithAuthenticator(Authenticator authenticator, 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(Authenticator authenticator,
                                 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 SSLSocketFactory installServerCertificate(URL url)
Description copied from interface: SESecurityManager
Installs the SSL certificate necessary to support the connection

Specified by:
installServerCertificate in interface SESecurityManager

getKeyStore

public KeyStore getKeyStore()
                     throws Exception
Specified by:
getKeyStore in interface SESecurityManager
Throws:
Exception

getTrustStore

public KeyStore getTrustStore()
                       throws Exception
Specified by:
getTrustStore in interface SESecurityManager
Throws:
Exception

createSelfSignedCertificate

public Certificate createSelfSignedCertificate(String alias,
                                               String cert_dn,
                                               int strength)
                                        throws 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:
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,
                                String reason_resource)
                         throws 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:
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,
                                                 String reason_resource,
                                                 int block_crypto)
                                          throws Exception
Description copied from interface: SESecurityManager
Returns a proxy generic STS connection for incoming connection requests

Specified by:
getSTSConnection in interface SESecurityManager
Returns:
Throws:
Exception