org/objectweb/proactive/ext/security/InternalBodySecurity.java

00001 /* 
00002  * ################################################################
00003  * 
00004  * ProActive: The Java(TM) library for Parallel, Distributed, 
00005  *            Concurrent computing with Security and Mobility
00006  * 
00007  * Copyright (C) 1997-2007 INRIA/University of Nice-Sophia Antipolis
00008  * Contact: proactive@objectweb.org
00009  * 
00010  * This library is free software; you can redistribute it and/or
00011  * modify it under the terms of the GNU Lesser General Public
00012  * License as published by the Free Software Foundation; either
00013  * version 2.1 of the License, or any later version.
00014  *  
00015  * This library is distributed in the hope that it will be useful,
00016  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00017  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00018  * Lesser General Public License for more details.
00019  * 
00020  * You should have received a copy of the GNU Lesser General Public
00021  * License along with this library; if not, write to the Free Software
00022  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
00023  * USA
00024  *  
00025  *  Initial developer(s):               The ProActive Team
00026  *                        http://www.inria.fr/oasis/ProActive/contacts.html
00027  *  Contributor(s): 
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 }

Generated on Mon Jan 22 15:16:11 2007 for ProActive by  doxygen 1.5.1