Class CipherServer

java.lang.Object
   |
   +----CipherServer

public class CipherServer
extends Object
Architecture client maintains a private key clientsk and we have the the public key of the client at our end, we decrypt the Message with the private key of Server, and crypt the outgoing message with the public key of the client, the public key is chosen according to the clientID of application


Variable Index

 o cipherName
 o clientID
 o clientPk
 o conn
 o keyPairName
 o rsa
 o serverID
 o serverSk
 o strength

Constructor Index

 o CipherServer(String)
Loads the server secret key.

Method Index

 o getCryptedStream(Object)
Takes an object, serializes it and returns a byte array crypted by the client's public key.
 o getDecryptedObject(HttpServletRequest)
This Method decrypts the request stream using the server's secret key, deserializes it and returns an object associated with it
 o getLogin()
 o getObjectInputStream(byte[])
 o loadClientDBPk()
This method loads Client Public Key from Database
 o loadClientPk()
This method loads Client PublicKey from the file system
 o main(String[])
On command line invocation creates server public key and server private key.Server Public key should be accessible to application developers from the servers site.And private key should be stored securely.
 o putClientPublicKey(PrintWriter, String, byte[])
This method when given a public key for a client as a byte array puts it into the Server Database as a Binary Large Object( blob)

Variables

 o serverID
 protected static final String serverID
 o keyPairName
 protected static final String keyPairName
 o cipherName
 protected static final String cipherName
 o strength
 protected static final int strength
 o conn
 protected static Connection conn
 o clientID
 public String clientID
 o rsa
 protected Cipher rsa
 o clientPk
 protected PublicKey clientPk
 o serverSk
 protected PrivateKey serverSk

Constructors

 o CipherServer
 public CipherServer(String serverSkFile)
Loads the server secret key.

Methods

 o getObjectInputStream
 protected static ObjectInputStream getObjectInputStream(byte inbuf[]) throws IOException
 o loadClientDBPk
 public boolean loadClientDBPk()
This method loads Client Public Key from Database

 o loadClientPk
 public boolean loadClientPk()
This method loads Client PublicKey from the file system

 o putClientPublicKey
 public static boolean putClientPublicKey(PrintWriter out,
                                          String clientID,
                                          byte tmp[])
This method when given a public key for a client as a byte array puts it into the Server Database as a Binary Large Object( blob)

 o getLogin
 public String getLogin()
 o getDecryptedObject
 public Object getDecryptedObject(HttpServletRequest req) throws Exception
This Method decrypts the request stream using the server's secret key, deserializes it and returns an object associated with it

 o getCryptedStream
 public byte[] getCryptedStream(Object ob) throws Exception
Takes an object, serializes it and returns a byte array crypted by the client's public key.

 o main
 public static void main(String args[])
On command line invocation creates server public key and server private key.Server Public key should be accessible to application developers from the servers site.And private key should be stored securely.