org.ocap.hn.security
Class NetSecurityManager

java.lang.Object
  extended by org.ocap.hn.security.NetSecurityManager

public abstract class NetSecurityManager
extends Object

This class provides access to home network security capabilities including password handling. The passwords that can be handled are specific to each home network interface at the link layer. Upper layer (e.g. TLS) and Administrator passwords cannot be accessed using this class. When the network interface type returned by NetworkInterface.getType() is MOCA the implementation SHALL associate the getNetworkPassword and setNetworkPassword methods in this interface to the MoCA link layer password used for the network interface. When the network interface type returned by NetworkInterface.getType() is WIRELESS_ETHERNET the implementation SHALL associate the getNetworkPassword and setNetworkPassword in this interface to the link layer password, e.g. WEP, used for the network interface.


Constructor Summary
protected NetSecurityManager()
          Protected constructor.
 
Method Summary
 void disableMocaPrivacy(NetworkInterface networkInterface)
          Disables MoCA privacy.
 void enableMocaPrivacy(NetworkInterface networkInterface)
          Enables MoCa privacy.
static NetSecurityManager getInstance()
          Get the network security manager.
 String getNetworkPassword(NetworkInterface networkInterface)
          Gets a network interface password.
 boolean queryTransaction(String actionName, InetAddress inetAddress, String macAddress, URL url, int activityId)
          Queries the implementation to determine if it has sent a transaction matching the parameters.
 void revokeAuthorization(int activityID)
          Revokes a session authorization granted by the authorization handler.
 void setAuthorizationHandler(NetAuthorizationHandler nah)
          Sets the authorization handler application.
 void setAuthorizationHandler(NetAuthorizationHandler nah, String[] actionNames, boolean notifyTransportRequests)
          Sets the authorization handler application.
 void setNetworkPassword(NetworkInterface networkInterface, String password)
          Sets a network interface password.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NetSecurityManager

protected NetSecurityManager()
Protected constructor.

Method Detail

getInstance

public static NetSecurityManager getInstance()
Get the network security manager.


getNetworkPassword

public String getNetworkPassword(NetworkInterface networkInterface)
Gets a network interface password.

Parameters:
networkInterface - The interface to get the password for.
Returns:
The value of the password requested, or 0 length String if no password is set for the interface. If the interface type is MoCA this method returns a string value equal to the corresponding mocaIfPassword MIB. In this case the password MAY have been set using means other than the setNetworkPassword method.
Throws:
UnsupportedOperationException - if a password cannot be retrieved for the network interface.
SecurityException - if the calling application has not been granted MonitorAppPermission("handler.homenetwork").

setNetworkPassword

public void setNetworkPassword(NetworkInterface networkInterface,
                               String password)
Sets a network interface password. If the network interface type is MoCA then privacy must also be enabled for the password to have affect. See the enableMocaPrivacy method. If the interface type is MoCA and the parameter is acceptable this method writes the corresponding mocaIfPassword MIB.

Parameters:
networkInterface - The home network interface the password is to be set for.
password - The value of the password to set.
Throws:
IllegalArgumentException - if the password format is invalid for the interface type. A password for a MoCA interface that is less than 12 characters or greater than 17 characters or has any non-numerical characters is invalid.
UnsupportedOperationException - if a password cannot be set for the network interface.
SecurityException - if the calling application has not been granted MonitorAppPermission("handler.homenetwork").

setAuthorizationHandler

public void setAuthorizationHandler(NetAuthorizationHandler nah)
Sets the authorization handler application. If a handler application is already registered this method SHALL replace it. If the parameter is null any set handler is removed.

Parameters:
nah - Network authorization handler interface to the authoriztaion application.
Throws:
SecurityException - if the calling application is not granted MonitorAppPermission("handler.network").

setAuthorizationHandler

public void setAuthorizationHandler(NetAuthorizationHandler nah,
                                    String[] actionNames,
                                    boolean notifyTransportRequests)
Sets the authorization handler application. If a handler application is already registered this method SHALL replace it. If the nah parameter is null any set handler is removed.

Parameters:
nah - Network authorization handler interface to the authoriztaion application.
actionNames - A list of action names the hander is interested in authorizing. The format of the names is out-of-scope for this definition.
notifyTransportRequests - A true value indicates the NetAuthorizationHandler application is always notified. A false value indicates that once a message in a session has been authorized subsequent messages in the same session are not authorized. That is, the NetAuthorizationHandler application is not notified when the subsequent messages are received.
Throws:
SecurityException - if the calling application is not granted MonitorAppPermission("handler.network").
IllegalArgumentException - if the actionNames parameter contains a name that cannot be matched to a known action.

revokeAuthorization

public void revokeAuthorization(int activityID)
Revokes a session authorization granted by the authorization handler.

Parameters:
activityID - The activity specific identifier that was passed to the NetAuthorizationHandler.notifyAuthorization method.
Throws:
SecurityException - if the calling application does not have MonitorAppPermission("handler.network").

queryTransaction

public boolean queryTransaction(String actionName,
                                InetAddress inetAddress,
                                String macAddress,
                                URL url,
                                int activityId)
Queries the implementation to determine if it has sent a transaction matching the parameters.

Parameters:
actionName - Name of the request type if known. If not known an empty string MAY be used. The format of the name is out-of-scope of this definition.
inetAddress - IP address the transaction was sent to.
macAddress - MAC address the transaction was sent from if known. Can be empty String if not known. The format is EUI-48 with 6 colon separated 2 digit bytes in hexadecimal notation with no leading "0x", e.g. "00:11:22:AA:BB:CC".
url - The URL requested by the transaction if known. If not known an empty string may be used.
activityId - The activity identifier this device set for the connection. A value of -1 indicates the parameter will not be used for transaction matching purposes.
Returns:
True if activityId and other known parameters can be matched to a transaction sent by the implementation. If activityId match cannot be found, or if activityId match is found but any of the other known parameters do not match the transaction then this method returns false.
Throws:
IllegalArgumentException - if the MAC address is malformed.
SecurityException - if the calling application is not signed.

enableMocaPrivacy

public void enableMocaPrivacy(NetworkInterface networkInterface)
Enables MoCa privacy. For MoCA interface types this method enables privacy and writes the corresponding mocaIfPrivacyEnable MIB with a value of 'true'.

Parameters:
networkInterface - Interface to enable privacy on.
Throws:
UnsupportedOperationException - if the parameter interface is not a MoCA interface type.
SecurityException - if the calling application has not been granted MonitorAppPermission("handler.homenetwork").

disableMocaPrivacy

public void disableMocaPrivacy(NetworkInterface networkInterface)
Disables MoCA privacy. For MoCA interface types this method disables privacy and writes the corresponding mocaIfPrivacyEnable MIB with a value of'false'.

Parameters:
networkInterface - Interface to disable privacy on.
Throws:
UnsupportedOperationException - if the parameter interface is not a MoCA interface type.
SecurityException - if the calling application has not been granted MonitorAppPermission("handler.homenetwork").


Copyright © 2011. All Rights Reserved.