KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > proactive > ext > security > InternalBodySecurity


1 /*
2  * ################################################################
3  *
4  * ProActive: The Java(TM) library for Parallel, Distributed,
5  * Concurrent computing with Security and Mobility
6  *
7  * Copyright (C) 1997-2002 INRIA/University of Nice-Sophia Antipolis
8  * Contact: proactive-support@inria.fr
9  *
10  * This library is free software; you can redistribute it and/or
11  * modify it under the terms of the GNU Lesser General Public
12  * License as published by the Free Software Foundation; either
13  * version 2.1 of the License, or any later version.
14  *
15  * This library is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18  * Lesser General Public License for more details.
19  *
20  * You should have received a copy of the GNU Lesser General Public
21  * License along with this library; if not, write to the Free Software
22  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
23  * USA
24  *
25  * Initial developer(s): The ProActive Team
26  * http://www.inria.fr/oasis/ProActive/contacts.html
27  * Contributor(s):
28  *
29  * ################################################################
30  */

31 package org.objectweb.proactive.ext.security;
32
33 import org.objectweb.proactive.core.body.UniversalBody;
34 import org.objectweb.proactive.ext.security.crypto.AuthenticationException;
35 import org.objectweb.proactive.ext.security.crypto.ConfidentialityTicket;
36 import org.objectweb.proactive.ext.security.crypto.KeyExchangeException;
37
38 import java.io.IOException JavaDoc;
39
40 import java.security.PublicKey JavaDoc;
41 import java.security.cert.X509Certificate JavaDoc;
42
43 import java.util.ArrayList JavaDoc;
44
45
46 public class InternalBodySecurity {
47     protected UniversalBody distantBody;
48
49     public InternalBodySecurity(UniversalBody distantBody) {
50         this.distantBody = distantBody;
51     }
52
53     public void initiateSession(int type, UniversalBody body)
54         throws IOException JavaDoc, CommunicationForbiddenException,
55             AuthenticationException, RenegotiateSessionException,
56             SecurityNotAvailableException {
57         distantBody.initiateSession(type, body);
58     }
59
60     public void terminateSession(long sessionID)
61         throws java.io.IOException JavaDoc, SecurityNotAvailableException {
62         distantBody.terminateSession(sessionID);
63     }
64
65     public X509Certificate JavaDoc getCertificate()
66         throws java.io.IOException JavaDoc, SecurityNotAvailableException {
67         return distantBody.getCertificate();
68     }
69
70     public ProActiveSecurityManager getProActiveSecurityManager()
71         throws SecurityNotAvailableException, IOException JavaDoc {
72         return distantBody.getProActiveSecurityManager();
73     }
74
75     public Policy getPolicyFrom(X509Certificate JavaDoc certificate)
76         throws SecurityNotAvailableException, IOException JavaDoc {
77         return distantBody.getPolicyFrom(certificate);
78     }
79
80     public Communication getPolicyTo(String JavaDoc type, String JavaDoc from, String JavaDoc to)
81         throws SecurityNotAvailableException, IOException JavaDoc {
82         return distantBody.getPolicyTo(type, from, to);
83     }
84
85     public long startNewSession(Communication policy)
86         throws SecurityNotAvailableException, IOException JavaDoc,
87             RenegotiateSessionException {
88         return distantBody.startNewSession(policy);
89     }
90
91     public ConfidentialityTicket negociateKeyReceiverSide(
92         ConfidentialityTicket confidentialityTicket, long sessionID)
93         throws SecurityNotAvailableException, KeyExchangeException, IOException JavaDoc {
94         return distantBody.negociateKeyReceiverSide(confidentialityTicket,
95             sessionID);
96     }
97
98     public PublicKey JavaDoc getPublicKey()
99         throws SecurityNotAvailableException, IOException JavaDoc {
100         return distantBody.getPublicKey();
101     }
102
103     public byte[] randomValue(long sessionID, byte[] cl_rand)
104         throws Exception JavaDoc {
105         return distantBody.randomValue(sessionID, cl_rand);
106     }
107
108     public byte[][] publicKeyExchange(long sessionID, UniversalBody dBody,
109         byte[] my_pub, byte[] my_cert, byte[] sig_code)
110         throws Exception JavaDoc {
111         return distantBody.publicKeyExchange(sessionID, dBody, my_pub, my_cert,
112             sig_code);
113     }
114
115     public byte[][] secretKeyExchange(long sessionID, byte[] tmp, byte[] tmp1,
116         byte[] tmp2, byte[] tmp3, byte[] tmp4) throws Exception JavaDoc {
117         return distantBody.secretKeyExchange(sessionID, tmp, tmp1, tmp2, tmp3,
118             tmp4);
119     }
120
121     public void setDistantBody(UniversalBody distantBody) {
122         this.distantBody = distantBody;
123     }
124
125     public boolean isLocalBody() {
126         return distantBody == null;
127     }
128
129     /**
130      * @return distant Body Adapter
131      */

132     public UniversalBody getDistantBody() {
133         return distantBody.getRemoteAdapter();
134     }
135
136     public String JavaDoc getVNName() throws IOException JavaDoc, SecurityNotAvailableException {
137         return distantBody.getVNName();
138     }
139
140     /**
141      * @return distant object's certificate as byte array
142      */

143     public byte[] getCertificatEncoded()
144         throws IOException JavaDoc, SecurityNotAvailableException {
145         return distantBody.getCertificateEncoded();
146     }
147
148     /**
149      * @param securityContext
150      * @return securityContext with distant object context
151      */

152     public SecurityContext getPolicy(SecurityContext securityContext)
153         throws IOException JavaDoc, SecurityNotAvailableException {
154         return distantBody.getPolicy(securityContext);
155     }
156
157     public ArrayList JavaDoc getEntities()
158         throws IOException JavaDoc, SecurityNotAvailableException {
159         return distantBody.getEntities();
160     }
161 }
162
Popular Tags