org.gudy.azureus2.plugins.utils.security
Interface SESecurityManager

All Known Implementing Classes:
SESecurityManagerImpl

public interface SESecurityManager


Field Summary
static int BLOCK_ENCRYPTION_AES
           
static int BLOCK_ENCRYPTION_NONE
           
 
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_encryption)
          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 task)
           
 

Field Detail

BLOCK_ENCRYPTION_NONE

static final int BLOCK_ENCRYPTION_NONE
See Also:
Constant Field Values

BLOCK_ENCRYPTION_AES

static final int BLOCK_ENCRYPTION_AES
See Also:
Constant Field Values
Method Detail

runWithAuthenticator

void runWithAuthenticator(java.net.Authenticator authenticator,
                          java.lang.Runnable task)

addPasswordListener

void addPasswordListener(PasswordListener listener)

removePasswordListener

void removePasswordListener(PasswordListener listener)

addCertificateListener

void addCertificateListener(CertificateListener listener)

removeCertificateListener

void removeCertificateListener(CertificateListener listener)

calculateSHA1

byte[] calculateSHA1(byte[] data_in)
returns the SHA1 hash of the input data

Parameters:
data_in -
Returns:

installServerCertificate

javax.net.ssl.SSLSocketFactory installServerCertificate(java.net.URL url)
Installs the SSL certificate necessary to support the connection

Parameters:
url -

getKeyStore

java.security.KeyStore getKeyStore()
                                   throws java.lang.Exception
Throws:
java.lang.Exception

getTrustStore

java.security.KeyStore getTrustStore()
                                     throws java.lang.Exception
Throws:
java.lang.Exception

createSelfSignedCertificate

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

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

byte[] getIdentity()
Gets this azureus instance's unique random identity

Returns:

getPublicKey

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

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

SEPublicKey decodePublicKey(byte[] encoded)
                            throws java.lang.Exception
Throws:
java.lang.Exception

getSTSConnection

GenericMessageConnection getSTSConnection(GenericMessageConnection connection,
                                          SEPublicKey my_public_key,
                                          SEPublicKeyLocator key_locator,
                                          java.lang.String reason_resource,
                                          int block_encryption)
                                          throws java.lang.Exception
Returns a proxy generic STS connection for incoming connection requests

Parameters:
connection -
my_public_key -
key_locator -
Returns:
Throws:
java.lang.Exception