Encryption Interceptor Example
This directory contains the encryption interceptor example. The encryption
interceptor implements simple encryption using interceptors to modify the
data buffer just before it sent and after it is received.
This example illustrates how to:
-
Implement a simple ClientInterceptor and ServerInterceptor
-
Implement factories for the ClientInterceptor and ServerInterceptor
-
Add interceptor factories (or interceptors themselves) to the ORB's chaining
interceptor
-
Encrypt and decrypt data by intercepting communication between the client
and server
-
Chain interceptors to do multiple encryption
Directory Contents
-
Init.java
Sample code for standard initialization for a this package. It shows
how to install interceptors and interceptor factories. In particular, shows
how to install a chain of interceptors to do multiple encryptions on a
single buffer.
-
Crypto.java
Super class for all the interceptors in this example. It has some common
code shared by the encryption interceptors.
-
CryptoClientInter.java
An encryption client interceptor, which intercepts communication at
client side and encrypts data.
-
CryptoClientInterFactory.java
A sample client interceptor factory, which creates client interceptors.
-
CryptoServerInter.java
A sample server intereptor, which intercepts communication at server
side and encrypts data.
-
CryptoServerInterFactory.java
A sample server interceptor factory, which creates server interceptors.
-
Bank.idl
IDL interface for the 'Bank' object.
-
Server.java
Server. Creates an instance of the Bank and calls org.omg.CORBA.BOA.impl_is_ready()
to make this object available to client programs. The Bank Server
implementation implements two methods: open(), which opens a bank account,
and balance(), which returns the balance in a person's account whose name
is provided as input. A random number is generated and returned as the
balance.
-
Client.java
This is the bank client. It binds to an AccountManager object and invokes
open() to open a bank account. It then invokes the balance() on the account
object reference obtained to query the balance.
Building this example
Type make all (vbmake on Windows) in the encryption
directory.
Compilation Errors and Warnings
You may see the following kind of compilation errors when you compile this
example from the interceptor directory using either JDK1.0.2 or JDK1.1.1:
prompt>javac Encryption/Init.java
./Encryption/CryptoClientInter.java:5: Package
com.visigenic.vbroker.interceptor not found in import.
import com.visigenic.vbroker.interceptor.*;
^
The above error occurs because the javac compiler in JDK1.0.2 and JDK1.1.1
cannot locate packages imported from JAR files. The solution to this problem
is to either:
-
Unjar the vbjorb.jar file found in the VisiBroker for Java 3.2 installation/lib
directory using the following command:
prompt>jar xvf vbjorb.jar
Modify the example: delete the import statment and explicitly prefix each
oc currence of classes from the imported package with the complete package
name.
Upgrade to JDK1.1.2 or higher
Running the encryption interceptor example
To run the examples, first make sure that the VisiBroker Smart Agent (osagent
executable) is running on your network. Then start the bank server using
the command:
prompt> vbj -DORBservices=Encryption Server &
(start vbj -DORBservices=Encryption Server on Windows)
// make the server run in the background
Next, start the bank client using the command
prompt> vbj -DORBservices=Encryption Client
Return to the Top-level Examples Page.