org.objectweb.proactive.ext.security
Class EncryptedBody

java.lang.Object
  extended by org.objectweb.proactive.ext.security.EncryptedBody
All Implemented Interfaces:
java.io.Serializable, Body, LocalBodyStrategy, MessageEventProducer, UniversalBody, NFEProducer, SecurityEntity, Job

public class EncryptedBody
extends java.lang.Object
implements Body, java.io.Serializable

Author:
Arnaud Contes Wrap an cyphered body as a normal body used for transparency call.
See Also:
Serialized Form

Field Summary
protected  byte[] encryptedBody
           
protected  boolean isEncrypted
           
protected  long sessionID
           
 
Fields inherited from interface org.objectweb.proactive.core.body.UniversalBody
bodyLogger
 
Constructor Summary
EncryptedBody()
           
EncryptedBody(byte[] encryptedBody, long sessionID)
           
 
Method Summary
 void acceptCommunication()
          Signals the body to accept all incoming communications.
 void addMessageEventListener(MessageEventListener listener)
          Adds a listener of MessageEvent to this body.
 void addNFEListener(NFEListener listener)
           
 void blockCommunication()
          blocks all incoming communications.
 UniversalBody checkNewLocation(UniqueID uniqueID)
          Tries to find a local version of the body of id uniqueID.
 void createShortcut(Shortcut shortcut)
          similar to the UniversalBody.updateLocation(org.objectweb.proactive.core.UniqueID, UniversalBody) method, it allows direct communication to the target of a functional call, accross membranes of composite components.
 void disableAC()
          Disables automatic continuation mechanism for this body
 void enableAC()
          Enables automatic continuation mechanism for this body
 void enterInThreadStore()
          Allows the calling thread to enter in the ThreadStore of this body.
 void exitFromThreadStore()
          Allows the calling thread to exit from the ThreadStore of this body.
 int fireNFE(NonFunctionalException e)
           
 java.security.cert.X509Certificate getCertificate()
          entity certificate
 byte[] getCertificateEncoded()
          Entity's X509Certificate as byte array
 java.util.ArrayList<Entity> getEntities()
          Retrieves all the entity's ID which contain this entity plus this entity ID.
 FuturePool getFuturePool()
          Returns the future pool of this body
 UniqueID getID()
          Returns the UniqueID of this body This identifier is unique accross all JVMs
 java.lang.String getJobID()
           
 java.lang.String getName()
          Returns the name of this body that can be used for displaying information
 long getNextSequenceID()
          Returns a unique identifier that can be used to tag a future, a request
 java.lang.String getNodeURL()
          Returns the url of the node this body is associated to The url of the node can change if the active object migrates
 SecurityContext getPolicy(SecurityContext securityContext)
          Ask the entity to fill the securityContext parameters with its own policy according to the communication details contained in the given securityContext
 Communication getPolicyTo(java.lang.String type, java.lang.String from, java.lang.String to)
           
 ProActiveSecurityManager getProActiveSecurityManager()
           
 java.security.PublicKey getPublicKey()
          entity public key
 java.lang.Object getReifiedObject()
          Returns the reified object that body is for The reified object is the object that has been turned active.
 BodyAdapter getRemoteAdapter()
          Returns the remote friendly version of this body
 BlockingRequestQueue getRequestQueue()
          Returns the request queue associated to this body
 UniversalBody getShortcutTargetBody(ItfID functionalItfID)
          Returns the body that is the target of this shortcut for this component interface
 java.lang.String getVNName()
           
 boolean isActive()
          Returns whether the body is active or not.
 boolean isAlive()
          Returns whether the body is alive or not.
 ConfidentialityTicket negociateKeyReceiverSide(ConfidentialityTicket confidentialityTicket, long sessionID)
           
 byte[][] publicKeyExchange(long sessionID, byte[] myPublicKey, byte[] myCertificate, byte[] signature)
          exchange entity certificate and/or public key if certificate are not available
 byte[] randomValue(long sessionID, byte[] clientRandomValue)
          Exchange random value between client and server entity
 java.lang.Object receiveFTMessage(FTMessage ev)
          For sending a non fonctional message to the FTManager linked to this object.
 int receiveReply(Reply r)
          Receives a reply in response to a former request.
 int receiveRequest(Request request)
          Receives a request for later processing.
 void removeImmediateService(java.lang.String methodName, java.lang.Class[] parametersTypes)
          Removes an immediate service for this body An immediate service is a method that will bw excecuted by the calling thread.
 void removeMessageEventListener(MessageEventListener listener)
          Removes the MessageEventListener from this body.
 void removeNFEListener(NFEListener listener)
           
 byte[][] secretKeyExchange(long sessionID, byte[] encodedAESKey, byte[] encodedIVParameters, byte[] encodedClientMacKey, byte[] encodedLockData, byte[] parametersSignature)
          this method sends encoded secret parameters to the target entity
 void sendRequest(MethodCall methodCall, Future future, UniversalBody destinationBody)
          Sends the request request with the future future to the local body body.
 void serve(Request request)
          Serves the request request by the invoking the targeted method on the reified object.
 void setImmediateService(java.lang.String methodName)
          For setting an immediate service for this body.
 void setImmediateService(java.lang.String methodName, java.lang.Class[] parametersTypes)
          Adds an immediate service for this body An immediate service is a method that will bw excecuted by the calling thread.
 void setPolicyServer(PolicyServer server)
          set the policy server of the active object
 long startNewSession(Communication policy)
          start an unvalidated empty session
 void terminate()
          Terminate the body.
 void terminateSession(long sessionID)
          terminate a given session
 void updateLocation(UniqueID id, UniversalBody body)
          Signals to this body that the body identified by id is now to a new remote location.
 void updateNodeURL(java.lang.String newNodeURL)
          Set the nodeURL of this body
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

isEncrypted

protected boolean isEncrypted

sessionID

protected long sessionID

encryptedBody

protected byte[] encryptedBody
Constructor Detail

EncryptedBody

public EncryptedBody()

EncryptedBody

public EncryptedBody(byte[] encryptedBody,
                     long sessionID)
Method Detail

terminate

public void terminate()
Description copied from interface: UniversalBody
Terminate the body. After this call the body is no more alive and no more active although the active thread is not interrupted. The body is unuseable after this call.

Specified by:
terminate in interface UniversalBody

isAlive

public boolean isAlive()
Description copied from interface: Body
Returns whether the body is alive or not. The body is alive as long as it is processing request and reply

Specified by:
isAlive in interface Body
Returns:
whether the body is alive or not.

isActive

public boolean isActive()
Description copied from interface: Body
Returns whether the body is active or not. The body is active as long as it has an associated thread running to serve the requests by calling methods on the active object.

Specified by:
isActive in interface Body
Returns:
whether the body is active or not.

blockCommunication

public void blockCommunication()
Description copied from interface: Body
blocks all incoming communications. After this call, the body cannot receive any request or reply.

Specified by:
blockCommunication in interface Body

acceptCommunication

public void acceptCommunication()
Description copied from interface: Body
Signals the body to accept all incoming communications. This call undo a previous call to blockCommunication.

Specified by:
acceptCommunication in interface Body

enterInThreadStore

public void enterInThreadStore()
Description copied from interface: Body
Allows the calling thread to enter in the ThreadStore of this body.

Specified by:
enterInThreadStore in interface Body

exitFromThreadStore

public void exitFromThreadStore()
Description copied from interface: Body
Allows the calling thread to exit from the ThreadStore of this body.

Specified by:
exitFromThreadStore in interface Body

checkNewLocation

public UniversalBody checkNewLocation(UniqueID uniqueID)
Description copied from interface: Body
Tries to find a local version of the body of id uniqueID. If a local version is found it is returned. If not, tries to find the body of id uniqueID in the known body of this body. If a body is found it is returned, else null is returned.

Specified by:
checkNewLocation in interface Body
Parameters:
uniqueID - the id of the body to lookup
Returns:
the last known version of the body of id uniqueID or null if not known

setPolicyServer

public void setPolicyServer(PolicyServer server)
Description copied from interface: Body
set the policy server of the active object

Specified by:
setPolicyServer in interface Body
Parameters:
server - the policy server

getFuturePool

public FuturePool getFuturePool()
Description copied from interface: LocalBodyStrategy
Returns the future pool of this body

Specified by:
getFuturePool in interface LocalBodyStrategy
Returns:
the future pool of this body

getRequestQueue

public BlockingRequestQueue getRequestQueue()
Description copied from interface: LocalBodyStrategy
Returns the request queue associated to this body

Specified by:
getRequestQueue in interface LocalBodyStrategy
Returns:
the request queue associated to this body

getReifiedObject

public java.lang.Object getReifiedObject()
Description copied from interface: LocalBodyStrategy
Returns the reified object that body is for The reified object is the object that has been turned active.

Specified by:
getReifiedObject in interface LocalBodyStrategy
Returns:
the reified object that body is for

getName

public java.lang.String getName()
Description copied from interface: LocalBodyStrategy
Returns the name of this body that can be used for displaying information

Specified by:
getName in interface LocalBodyStrategy
Returns:
the name of this body

sendRequest

public void sendRequest(MethodCall methodCall,
                        Future future,
                        UniversalBody destinationBody)
                 throws java.io.IOException,
                        RenegotiateSessionException
Description copied from interface: LocalBodyStrategy
Sends the request request with the future future to the local body body.

Specified by:
sendRequest in interface LocalBodyStrategy
Parameters:
methodCall - the methodCall to send
future - the future associated to the request
destinationBody - the body the request is sent to
Throws:
java.io.IOException - if the request cannot be sent to the destination body
RenegotiateSessionException

serve

public void serve(Request request)
Description copied from interface: LocalBodyStrategy
Serves the request request by the invoking the targeted method on the reified object. Some specific type of request may involve special processing that does not trigger a method on the reified object.

Specified by:
serve in interface LocalBodyStrategy
Parameters:
request - the request to serve

receiveRequest

public int receiveRequest(Request request)
                   throws java.io.IOException,
                          RenegotiateSessionException
Description copied from interface: UniversalBody
Receives a request for later processing. The call to this method is non blocking unless the body cannot temporary receive the request.

Specified by:
receiveRequest in interface UniversalBody
Parameters:
request - the request to process
Returns:
value for fault-tolerance protocol
Throws:
java.io.IOException - if the request cannot be accepted
RenegotiateSessionException

receiveReply

public int receiveReply(Reply r)
                 throws java.io.IOException
Description copied from interface: UniversalBody
Receives a reply in response to a former request.

Specified by:
receiveReply in interface UniversalBody
Parameters:
r - the reply received
Returns:
value for fault-tolerance procotol
Throws:
java.io.IOException - if the reply cannot be accepted

getNodeURL

public java.lang.String getNodeURL()
Description copied from interface: UniversalBody
Returns the url of the node this body is associated to The url of the node can change if the active object migrates

Specified by:
getNodeURL in interface UniversalBody
Returns:
the url of the node this body is associated to

getID

public UniqueID getID()
Description copied from interface: UniversalBody
Returns the UniqueID of this body This identifier is unique accross all JVMs

Specified by:
getID in interface UniversalBody
Returns:
the UniqueID of this body

updateLocation

public void updateLocation(UniqueID id,
                           UniversalBody body)
                    throws java.io.IOException
Description copied from interface: UniversalBody
Signals to this body that the body identified by id is now to a new remote location. The body given in parameter is a new stub pointing to this new location. This call is a way for a body to signal to his peer that it has migrated to a new location

Specified by:
updateLocation in interface UniversalBody
Parameters:
id - the id of the body
body - the stub to the new location
Throws:
java.io.IOException - if a pb occurs during this method call

enableAC

public void enableAC()
              throws java.io.IOException
Description copied from interface: UniversalBody
Enables automatic continuation mechanism for this body

Specified by:
enableAC in interface UniversalBody
Throws:
java.io.IOException - if a pb occurs during this method call

disableAC

public void disableAC()
               throws java.io.IOException
Description copied from interface: UniversalBody
Disables automatic continuation mechanism for this body

Specified by:
disableAC in interface UniversalBody
Throws:
java.io.IOException - if a pb occurs during this method call

setImmediateService

public void setImmediateService(java.lang.String methodName)
                         throws java.io.IOException
Description copied from interface: UniversalBody
For setting an immediate service for this body. An immediate service is a method that will bw excecuted by the calling thread.

Specified by:
setImmediateService in interface UniversalBody
Throws:
java.io.IOException - if a pb occurs during this method call

terminateSession

public void terminateSession(long sessionID)
                      throws java.io.IOException,
                             SecurityNotAvailableException
Description copied from interface: SecurityEntity
terminate a given session

Specified by:
terminateSession in interface SecurityEntity
Throws:
SecurityNotAvailableException - id security is not available
java.io.IOException

getCertificate

public java.security.cert.X509Certificate getCertificate()
                                                  throws SecurityNotAvailableException,
                                                         java.io.IOException
Description copied from interface: SecurityEntity
entity certificate

Specified by:
getCertificate in interface SecurityEntity
Returns:
returns entity certificate
Throws:
SecurityNotAvailableException - if security is not available
java.io.IOException - if communication fails

getProActiveSecurityManager

public ProActiveSecurityManager getProActiveSecurityManager()
                                                     throws SecurityNotAvailableException,
                                                            java.io.IOException
Throws:
SecurityNotAvailableException
java.io.IOException

startNewSession

public long startNewSession(Communication policy)
                     throws SecurityNotAvailableException,
                            java.io.IOException,
                            RenegotiateSessionException
Description copied from interface: SecurityEntity
start an unvalidated empty session

Specified by:
startNewSession in interface SecurityEntity
Parameters:
policy - policy associated to the session
Returns:
session ID
Throws:
SecurityNotAvailableException - if security is not available
RenegotiateSessionException - if the session immediatly expires
java.io.IOException

negociateKeyReceiverSide

public ConfidentialityTicket negociateKeyReceiverSide(ConfidentialityTicket confidentialityTicket,
                                                      long sessionID)
                                               throws SecurityNotAvailableException,
                                                      KeyExchangeException,
                                                      java.io.IOException
Throws:
SecurityNotAvailableException
KeyExchangeException
java.io.IOException

getPublicKey

public java.security.PublicKey getPublicKey()
                                     throws SecurityNotAvailableException,
                                            java.io.IOException
Description copied from interface: SecurityEntity
entity public key

Specified by:
getPublicKey in interface SecurityEntity
Returns:
returns entity public key
Throws:
SecurityNotAvailableException
java.io.IOException

randomValue

public byte[] randomValue(long sessionID,
                          byte[] clientRandomValue)
Description copied from interface: SecurityEntity
Exchange random value between client and server entity

Specified by:
randomValue in interface SecurityEntity
Parameters:
sessionID - the session ID
clientRandomValue - client random value
Returns:
server random value

publicKeyExchange

public byte[][] publicKeyExchange(long sessionID,
                                  byte[] myPublicKey,
                                  byte[] myCertificate,
                                  byte[] signature)
                           throws SecurityNotAvailableException,
                                  java.io.IOException,
                                  RenegotiateSessionException
Description copied from interface: SecurityEntity
exchange entity certificate and/or public key if certificate are not available

Specified by:
publicKeyExchange in interface SecurityEntity
Parameters:
sessionID - the session ID
myPublicKey - encoded public key
myCertificate - encoded certificate
signature - encoded signature of previous paramaters
Returns:
an array containing : - server certificate and/or server public key - encoded signature of these parameters
Throws:
SecurityNotAvailableException - if the security is not available
RenegotiateSessionException - if the session has expired
java.io.IOException

secretKeyExchange

public byte[][] secretKeyExchange(long sessionID,
                                  byte[] encodedAESKey,
                                  byte[] encodedIVParameters,
                                  byte[] encodedClientMacKey,
                                  byte[] encodedLockData,
                                  byte[] parametersSignature)
                           throws SecurityNotAvailableException,
                                  RenegotiateSessionException
Description copied from interface: SecurityEntity
this method sends encoded secret parameters to the target entity

Specified by:
secretKeyExchange in interface SecurityEntity
Parameters:
sessionID - session ID
encodedAESKey - the AES key use to exchange secret message
encodedIVParameters - Initilization parameters for the AES key
encodedClientMacKey - MAC key for checking signature of future messages
encodedLockData - random value to prevent message replays by an external attacker
parametersSignature - encoded signature of the previous parameters
Returns:
an array containing : - encoded server AES key - encoded IV parameters - encoded server MAC key - encoded lock data to prevent message replays - encoded signature of previous parameters
Throws:
SecurityNotAvailableException - if this entity does not support security
RenegotiateSessionException - if the session has expired or has been cancelled during this exchange

getPolicyTo

public Communication getPolicyTo(java.lang.String type,
                                 java.lang.String from,
                                 java.lang.String to)
                          throws SecurityNotAvailableException,
                                 java.io.IOException
Throws:
SecurityNotAvailableException
java.io.IOException

getPolicy

public SecurityContext getPolicy(SecurityContext securityContext)
                          throws SecurityNotAvailableException,
                                 java.io.IOException
Description copied from interface: SecurityEntity
Ask the entity to fill the securityContext parameters with its own policy according to the communication details contained in the given securityContext

Specified by:
getPolicy in interface SecurityEntity
Parameters:
securityContext - communication details allowing the entity to look for a matching policy
Returns:
securityContext filled with this entity's policy
Throws:
SecurityNotAvailableException - thrown the entity doest not support the security
java.io.IOException

getVNName

public java.lang.String getVNName()
                           throws SecurityNotAvailableException,
                                  java.io.IOException
Throws:
SecurityNotAvailableException
java.io.IOException

getCertificateEncoded

public byte[] getCertificateEncoded()
                             throws SecurityNotAvailableException,
                                    java.io.IOException
Description copied from interface: SecurityEntity
Entity's X509Certificate as byte array

Specified by:
getCertificateEncoded in interface SecurityEntity
Returns:
entity's X509Certificate as byte array
Throws:
SecurityNotAvailableException
java.io.IOException

getEntities

public java.util.ArrayList<Entity> getEntities()
                                        throws SecurityNotAvailableException,
                                               java.io.IOException
Description copied from interface: SecurityEntity
Retrieves all the entity's ID which contain this entity plus this entity ID.

Specified by:
getEntities in interface SecurityEntity
Returns:
returns all the entity's ID which contain this entity plus this entity ID.
Throws:
SecurityNotAvailableException - if the target entity does not support security
java.io.IOException

addMessageEventListener

public void addMessageEventListener(MessageEventListener listener)
Description copied from interface: MessageEventProducer
Adds a listener of MessageEvent to this body. The listener will receive event for all messages sent or received

Specified by:
addMessageEventListener in interface MessageEventProducer
Parameters:
listener - the listener to add

removeMessageEventListener

public void removeMessageEventListener(MessageEventListener listener)
Description copied from interface: MessageEventProducer
Removes the MessageEventListener from this body.

Specified by:
removeMessageEventListener in interface MessageEventProducer
Parameters:
listener - the listener to remove

getJobID

public java.lang.String getJobID()
Specified by:
getJobID in interface Job
Returns:
the jobID associated with this object

updateNodeURL

public void updateNodeURL(java.lang.String newNodeURL)
Description copied from interface: Body
Set the nodeURL of this body

Specified by:
updateNodeURL in interface Body
Parameters:
newNodeURL - the new URL of the node

receiveFTMessage

public java.lang.Object receiveFTMessage(FTMessage ev)
                                  throws java.io.IOException
Description copied from interface: UniversalBody
For sending a non fonctional message to the FTManager linked to this object.

Specified by:
receiveFTMessage in interface UniversalBody
Parameters:
ev - the message to send
Returns:
depends on the message meaning
Throws:
java.io.IOException - if a pb occurs during this method call

getShortcutTargetBody

public UniversalBody getShortcutTargetBody(ItfID functionalItfID)
Description copied from interface: Body
Returns the body that is the target of this shortcut for this component interface

Specified by:
getShortcutTargetBody in interface Body
Parameters:
functionalItfID - the id of the interface on which the shortcut is available
Returns:
the body that is the target of this shortcut for this interface

createShortcut

public void createShortcut(Shortcut shortcut)
                    throws java.io.IOException
Description copied from interface: UniversalBody
similar to the UniversalBody.updateLocation(org.objectweb.proactive.core.UniqueID, UniversalBody) method, it allows direct communication to the target of a functional call, accross membranes of composite components.

Specified by:
createShortcut in interface UniversalBody
Parameters:
shortcut - the shortcut to create
Throws:
java.io.IOException - if a pb occurs during this method call

setImmediateService

public void setImmediateService(java.lang.String methodName,
                                java.lang.Class[] parametersTypes)
                         throws java.io.IOException
Description copied from interface: UniversalBody
Adds an immediate service for this body An immediate service is a method that will bw excecuted by the calling thread.

Specified by:
setImmediateService in interface UniversalBody
Parameters:
methodName - the name of the method
parametersTypes - the types of the parameters of the method
Throws:
java.io.IOException - if a pb occurs during this method call

removeImmediateService

public void removeImmediateService(java.lang.String methodName,
                                   java.lang.Class[] parametersTypes)
                            throws java.io.IOException
Description copied from interface: UniversalBody
Removes an immediate service for this body An immediate service is a method that will bw excecuted by the calling thread.

Specified by:
removeImmediateService in interface UniversalBody
Parameters:
methodName - the name of the method
parametersTypes - the types of the parameters of the method
Throws:
java.io.IOException - if a pb occurs during this method call

getRemoteAdapter

public BodyAdapter getRemoteAdapter()
Description copied from interface: UniversalBody
Returns the remote friendly version of this body

Specified by:
getRemoteAdapter in interface UniversalBody
Returns:
the remote friendly version of this body

addNFEListener

public void addNFEListener(NFEListener listener)
Specified by:
addNFEListener in interface NFEProducer

removeNFEListener

public void removeNFEListener(NFEListener listener)
Specified by:
removeNFEListener in interface NFEProducer

fireNFE

public int fireNFE(NonFunctionalException e)
Specified by:
fireNFE in interface NFEProducer

getNextSequenceID

public long getNextSequenceID()
Description copied from interface: LocalBodyStrategy
Returns a unique identifier that can be used to tag a future, a request

Specified by:
getNextSequenceID in interface LocalBodyStrategy
Returns:
a unique identifier that can be used to tag a future, a request.


Copyright 2001-2007 INRIA All Rights Reserved.