Class SESecurityManagerImpl
- java.lang.Object
-
- com.biglybt.pifimpl.local.utils.security.SESecurityManagerImpl
-
- All Implemented Interfaces:
SESecurityManager
public class SESecurityManagerImpl extends java.lang.Object implements SESecurityManager
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.Map
certificate_listeners
private Core
core
private java.util.Map
password_listeners
-
Fields inherited from interface com.biglybt.pif.utils.security.SESecurityManager
BLOCK_ENCRYPTION_AES, BLOCK_ENCRYPTION_NONE
-
-
Constructor Summary
Constructors Constructor Description SESecurityManagerImpl(Core _core)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addCertificateListener(CertificateListener listener)
void
addPasswordListener(PasswordListener listener)
byte[]
calculateSHA1(byte[] data_in)
returns the SHA1 hash of the input datajava.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 MD5withRSAbyte[]
getIdentity()
Gets this the client instance's unique random identityjava.security.KeyStore
getKeyStore()
SEPublicKey
getPublicKey(int key_type, int instance, java.lang.String reason_resource)
SEPublicKey
getPublicKey(int key_type, java.lang.String reason_resource)
Gets the public key for this az instance of the supplied key typeGenericMessageConnection
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 requestsjava.security.KeyStore
getTrustStore()
javax.net.ssl.SSLSocketFactory
installServerCertificate(java.net.URL url)
Installs the SSL certificate necessary to support the connectionvoid
removeCertificateListener(CertificateListener listener)
void
removePasswordListener(PasswordListener listener)
void
runWithAuthenticator(java.net.Authenticator authenticator, java.lang.Runnable target)
-
-
-
Field Detail
-
core
private Core core
-
password_listeners
private java.util.Map password_listeners
-
certificate_listeners
private java.util.Map certificate_listeners
-
-
Constructor Detail
-
SESecurityManagerImpl
public SESecurityManagerImpl(Core _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 interfaceSESecurityManager
- Returns:
-
runWithAuthenticator
public void runWithAuthenticator(java.net.Authenticator authenticator, java.lang.Runnable target)
- Specified by:
runWithAuthenticator
in interfaceSESecurityManager
-
addPasswordListener
public void addPasswordListener(PasswordListener listener)
- Specified by:
addPasswordListener
in interfaceSESecurityManager
-
removePasswordListener
public void removePasswordListener(PasswordListener listener)
- Specified by:
removePasswordListener
in interfaceSESecurityManager
-
addCertificateListener
public void addCertificateListener(CertificateListener listener)
- Specified by:
addCertificateListener
in interfaceSESecurityManager
-
removeCertificateListener
public void removeCertificateListener(CertificateListener listener)
- Specified by:
removeCertificateListener
in interfaceSESecurityManager
-
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 interfaceSESecurityManager
-
getKeyStore
public java.security.KeyStore getKeyStore() throws java.lang.Exception
- Specified by:
getKeyStore
in interfaceSESecurityManager
- Throws:
java.lang.Exception
-
getTrustStore
public java.security.KeyStore getTrustStore() throws java.lang.Exception
- Specified by:
getTrustStore
in interfaceSESecurityManager
- 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 interfaceSESecurityManager
- 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 the client instance's unique random identity- Specified by:
getIdentity
in interfaceSESecurityManager
- 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 interfaceSESecurityManager
- Parameters:
key_type
- see KEY_TYPE_x constants in SEPublicKeyreason_resource
- a message text resource giving the reason for the key being required- Returns:
- Throws:
java.lang.Exception
-
getPublicKey
public SEPublicKey getPublicKey(int key_type, int instance, java.lang.String reason_resource) throws java.lang.Exception
- Specified by:
getPublicKey
in interfaceSESecurityManager
- Throws:
java.lang.Exception
-
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 interfaceSESecurityManager
- Returns:
- Throws:
java.lang.Exception
-
-