p2ps.imp.peer
Class SecurityManagerImp

java.lang.Object
  extended byp2ps.imp.peer.SecurityManagerImp
All Implemented Interfaces:
SecurityManager

public class SecurityManagerImp
extends java.lang.Object
implements SecurityManager

Information on the current security context for this peer.

Version:
$Revision: 295 $
Author:
Ian Wang

Field Summary
static java.lang.String DEFAULT_P2PS_CERTIFICATE_ALIAS
           
static java.lang.String P2PS_CERTIFICATE_ALIAS_PROPERTY
           
 
Fields inherited from interface p2ps.peer.SecurityManager
AUTHORIZATION_SECURITY, IDENTITY_AND_AUTHORIZATION_SECURITY, PEER_SECURITY_CONTEXT_PROPERTY, REMOTE_SECURITY_CONTEXT_PROPERTY, SECURITY_MANAGER_PROPERTY, TRUST_SECURITY
 
Constructor Summary
SecurityManagerImp()
           
 
Method Summary
 java.security.KeyStore getKeyStore()
          the key store
 java.io.File getKeyStoreFile()
           
 char[] getKeyStorePassword()
           
 java.lang.String getPeerCertificateAlias()
           
 char[] getPeerCertificatePassword()
           
 java.lang.String getPeerDistinguishedName()
           
 SecurityContext getSecurityContext(Peer peer, java.lang.String clientsecurity, java.lang.String serversecurity)
           
 SecurityContext getSecurityContext(java.lang.String peercert, java.lang.String[] groupcerts)
           
 SecurityContext getSecurityContext(java.net.URI uri, Peer peer)
           
 TrustManager getTrustManager(java.lang.String securitylevel)
           
 void init(Config config, char[] password)
           
 void reloadKeyStore()
          Reloads the keystore
 void setTrustManager(java.lang.String securitylevel, TrustManager trustmanager)
          Sets the trust manager responsible for accepting certificates for the specified context
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

P2PS_CERTIFICATE_ALIAS_PROPERTY

public static final java.lang.String P2PS_CERTIFICATE_ALIAS_PROPERTY
See Also:
Constant Field Values

DEFAULT_P2PS_CERTIFICATE_ALIAS

public static final java.lang.String DEFAULT_P2PS_CERTIFICATE_ALIAS
See Also:
Constant Field Values
Constructor Detail

SecurityManagerImp

public SecurityManagerImp()
Method Detail

init

public void init(Config config,
                 char[] password)

getKeyStore

public java.security.KeyStore getKeyStore()
the key store

Specified by:
getKeyStore in interface SecurityManager
Returns:
the key store for this context

getKeyStoreFile

public java.io.File getKeyStoreFile()
Specified by:
getKeyStoreFile in interface SecurityManager
Returns:
the key store file

getKeyStorePassword

public char[] getKeyStorePassword()
Specified by:
getKeyStorePassword in interface SecurityManager
Returns:
the key store password

reloadKeyStore

public void reloadKeyStore()
                    throws java.security.KeyStoreException
Reloads the keystore

Specified by:
reloadKeyStore in interface SecurityManager
Throws:
java.security.KeyStoreException

getPeerCertificateAlias

public java.lang.String getPeerCertificateAlias()
Specified by:
getPeerCertificateAlias in interface SecurityManager
Returns:
the certificate alias for the main peer

getPeerCertificatePassword

public char[] getPeerCertificatePassword()
Specified by:
getPeerCertificatePassword in interface SecurityManager
Returns:
the password for the peer certificate

getPeerDistinguishedName

public java.lang.String getPeerDistinguishedName()
                                          throws java.security.KeyStoreException
Specified by:
getPeerDistinguishedName in interface SecurityManager
Returns:
the distingushed name for the peer (or null if unknown)
Throws:
java.security.KeyStoreException

getSecurityContext

public SecurityContext getSecurityContext(java.lang.String peercert,
                                          java.lang.String[] groupcerts)
Specified by:
getSecurityContext in interface SecurityManager
Returns:
the security context for the specified peer and group certificate thumbprints

getSecurityContext

public SecurityContext getSecurityContext(Peer peer,
                                          java.lang.String clientsecurity,
                                          java.lang.String serversecurity)
Specified by:
getSecurityContext in interface SecurityManager
Parameters:
clientsecurity - the client security level
serversecurity - the server security level
Returns:
the security context for the specified peer

getSecurityContext

public SecurityContext getSecurityContext(java.net.URI uri,
                                          Peer peer)
Specified by:
getSecurityContext in interface SecurityManager
Returns:
the security context for the specified uri, or null if unknown/ not applicable

getTrustManager

public TrustManager getTrustManager(java.lang.String securitylevel)
Specified by:
getTrustManager in interface SecurityManager
Parameters:
securitylevel - the security level (e.g. IDENTITY_SECURITY or TRUST_SECURITY)
Returns:
the trust manager responsible for accepting certificates for the specified security level.

setTrustManager

public void setTrustManager(java.lang.String securitylevel,
                            TrustManager trustmanager)
Sets the trust manager responsible for accepting certificates for the specified context

Specified by:
setTrustManager in interface SecurityManager