00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031 package org.objectweb.proactive.ext.security;
00032
00033 import java.io.IOException;
00034 import java.security.PublicKey;
00035 import java.security.cert.X509Certificate;
00036 import java.util.ArrayList;
00037
00038 import org.objectweb.proactive.core.body.UniversalBody;
00039 import org.objectweb.proactive.ext.security.crypto.KeyExchangeException;
00040 import org.objectweb.proactive.ext.security.exceptions.RenegotiateSessionException;
00041 import org.objectweb.proactive.ext.security.exceptions.SecurityNotAvailableException;
00042 import org.objectweb.proactive.ext.security.securityentity.Entity;
00043
00044
00050 public class InternalBodySecurity implements SecurityEntity {
00051 protected SecurityEntity distantBody;
00052
00053 public InternalBodySecurity(UniversalBody distantBody) {
00054 this.distantBody = (SecurityEntity) distantBody;
00055 }
00056
00057 public void terminateSession(long sessionID)
00058 throws SecurityNotAvailableException, IOException {
00059 distantBody.terminateSession(sessionID);
00060 }
00061
00062 public X509Certificate getCertificate()
00063 throws SecurityNotAvailableException, IOException {
00064 return distantBody.getCertificate();
00065 }
00066
00067 public long startNewSession(Communication policy)
00068 throws SecurityNotAvailableException, RenegotiateSessionException,
00069 IOException {
00070 return distantBody.startNewSession(policy);
00071 }
00072
00073 public PublicKey getPublicKey()
00074 throws SecurityNotAvailableException, IOException {
00075 return distantBody.getPublicKey();
00076 }
00077
00078 public byte[] randomValue(long sessionID, byte[] clientRandomValue)
00079 throws SecurityNotAvailableException, RenegotiateSessionException,
00080 IOException {
00081 return distantBody.randomValue(sessionID, clientRandomValue);
00082 }
00083
00084 public byte[][] publicKeyExchange(long sessionID, byte[] myPublicKey,
00085 byte[] myCertificate, byte[] signature)
00086 throws SecurityNotAvailableException, RenegotiateSessionException,
00087 KeyExchangeException, IOException {
00088 return distantBody.publicKeyExchange(sessionID, myPublicKey,
00089 myCertificate, signature);
00090 }
00091
00092 public byte[][] secretKeyExchange(long sessionID, byte[] encodedAESKey,
00093 byte[] encodedIVParameters, byte[] encodedClientMacKey,
00094 byte[] encodedLockData, byte[] parametersSignature)
00095 throws SecurityNotAvailableException, RenegotiateSessionException,
00096 IOException {
00097 return distantBody.secretKeyExchange(sessionID, encodedAESKey,
00098 encodedIVParameters, encodedClientMacKey, encodedLockData,
00099 parametersSignature);
00100 }
00101
00102 public void setDistantBody(UniversalBody distantBody) {
00103 this.distantBody = distantBody;
00104 }
00105
00106 public boolean isLocalBody() {
00107 return distantBody == null;
00108 }
00109
00113 public UniversalBody getDistantBody() {
00114 return ((UniversalBody) distantBody).getRemoteAdapter();
00115 }
00116
00120 public byte[] getCertificatEncoded()
00121 throws SecurityNotAvailableException, IOException {
00122 return distantBody.getCertificateEncoded();
00123 }
00124
00129 public SecurityContext getPolicy(SecurityContext securityContext)
00130 throws SecurityNotAvailableException, IOException {
00131 return distantBody.getPolicy(securityContext);
00132 }
00133
00134 public ArrayList<Entity> getEntities()
00135 throws SecurityNotAvailableException, IOException {
00136 return distantBody.getEntities();
00137 }
00138
00139 public byte[] getCertificateEncoded()
00140 throws SecurityNotAvailableException, IOException {
00141 return distantBody.getCertificateEncoded();
00142 }
00143 }