| 1 |
<!doctype html public "-//w3c//dtd html 4.0 transitional//en"> |
| 2 |
<html> |
| 3 |
<head> |
| 4 |
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> |
| 5 |
<meta name="GENERATOR" content="Mozilla/4.79 [en] (X11; U; SunOS 5.8 sun4u) [Netscape]"> |
| 6 |
</head> |
| 7 |
<body> |
| 8 |
|
| 9 |
<blockquote> |
| 10 |
<blockquote> |
| 11 |
<blockquote> |
| 12 |
<h1> |
| 13 |
<b>Encryption Protocol Document</b></h1> |
| 14 |
</blockquote> |
| 15 |
</blockquote> |
| 16 |
</blockquote> |
| 17 |
<b>(Author : Mandar Shinde)</b> |
| 18 |
<h1> |
| 19 |
<b>Introduction</b></h1> |
| 20 |
This document is required to be read by both the developers and the users. |
| 21 |
The |
| 22 |
<br>ENCRYPT protocol will not work by directly compiling the javagroups |
| 23 |
source |
| 24 |
<br>and then using the required "encrypt.xml" file. Since an external provider |
| 25 |
needs |
| 26 |
<br>to be used (JDK1.4 does not provider for RSA as of now), hence this |
| 27 |
provider |
| 28 |
<br>needs to be added to the users/developers security list. |
| 29 |
<br> |
| 30 |
<h1> |
| 31 |
<b>Installation</b></h1> |
| 32 |
The following steps need to be followed to make sure that ENCRYPT protocol |
| 33 |
<br>can ne used |
| 34 |
<br> |
| 35 |
<ul> |
| 36 |
<li> |
| 37 |
Make sure that JDK1.4 is installed, ENCRYPT will not work with any other<br> |
| 38 |
version under JDK1.4.</li> |
| 39 |
|
| 40 |
<li> |
| 41 |
After installation JDK1.4, set <b>$JAVA_HOME</b> to the installation root.</li> |
| 42 |
|
| 43 |
<li> |
| 44 |
<b>cd $JAVA_HOME/jre/lib/security</b>. Open <b>java.security</b> file.</li> |
| 45 |
|
| 46 |
<li> |
| 47 |
Search for <b>security.provider.{list}</b> in the opened file.</li> |
| 48 |
|
| 49 |
<li> |
| 50 |
At the end of the list <b>add</b> <b><i>Provider.{list+1}=org.bouncycastle.jce.provider.BouncyCastleProvider</i></b>.</li> |
| 51 |
|
| 52 |
<li> |
| 53 |
The above provider is the default provider that comes along with Javagroups; <br> |
| 54 |
users can use their own providers by adding the right provider jars in |
| 55 |
the classpath<br> |
| 56 |
and adding the provider to the required list.</li> |
| 57 |
|
| 58 |
<li> |
| 59 |
The <i>encrypt.xml </i>file is the default configuration on top of <i>default.xml. |
| 60 |
</i>Any stack can use the <br> |
| 61 |
<b>Encrypt protocol</b> by adding this stack below GMS.<br> |
| 62 |
<protocol></li> |
| 63 |
|
| 64 |
<br> |
| 65 |
<protocol-name> Encryption Protocol </protocol-name> |
| 66 |
<br> |
| 67 |
<description> Protocol provides encryption to all communication </description> |
| 68 |
<br> |
| 69 |
<class-name>org.jgroups.protocols.ENCRYPT1_4</class-name> |
| 70 |
<br> |
| 71 |
<protocol-params> |
| 72 |
<br> |
| 73 |
<protocol-param name="asymInit" value="512"/> |
| 74 |
<br> |
| 75 |
<protocol-param name="symInit" value="56"/> |
| 76 |
<br> |
| 77 |
<protocol-param name="asymAlgorithm" value="RSA"/> |
| 78 |
<br> |
| 79 |
<protocol-param name="symAlgorithm" value="DES/ECB/PKCS5Padding"/> |
| 80 |
<br> |
| 81 |
</protocol-params> |
| 82 |
<br></protocol></ul> |
| 83 |
|
| 84 |
<h1> |
| 85 |
<b>Demo</b></h1> |
| 86 |
To test the usage of the protocol use any demo; I have used the Draw demo |
| 87 |
for this purpose;. |
| 88 |
<ul> |
| 89 |
<li> |
| 90 |
First up uncomment the Print protocol and comment the Encrypt protocol |
| 91 |
from the <br> |
| 92 |
encrypt.xml file. When the Draw demo is used, the user will see the deserialized<br> |
| 93 |
messages being exchanged between the 2 members.</li> |
| 94 |
|
| 95 |
<li> |
| 96 |
Now, uncomment the Encrypt protocol (leave the Print Protocol intact) |
| 97 |
from the protocol <br> |
| 98 |
stack. Run the same demo as above; the user will see that an ioexception |
| 99 |
will thrown while <br> |
| 100 |
deserializing the message because it has been encrypted by the Encrypt |
| 101 |
protocol.</li> |
| 102 |
</ul> |
| 103 |
<b></b> |
| 104 |
<h1> |
| 105 |
<b>How does Encrypt protocol <i>work</i></b> ?</h1> |
| 106 |
The mechanism used by this protocol is the oldest know way for high performing |
| 107 |
peer communication |
| 108 |
<br>protocols. To understand the working a couple algos need to be |
| 109 |
detailed; these are very basic in |
| 110 |
<br>today's encryption world. |
| 111 |
<br><b>Asymmetric algo:</b> this algo uses a set of keys; a <i><b>public-key</b> |
| 112 |
</i>and a <i><b>private-key</b>. </i>The<b> public-key</b> is |
| 113 |
<br>public; it is published to the public. The <b>private-key</b> is known |
| 114 |
only to the entity which makes the |
| 115 |
<br>public-key available. Any other entity will <b><i>encrypt a message |
| 116 |
</i></b>using the former <b><i>public-key </i></b>and the |
| 117 |
<br>former will <b><i>decrypt the message </i></b>using the<b><i> |
| 118 |
private-key.</i></b> |
| 119 |
<br><b>Symmetric algo</b>: this algo is the simplest known where a set |
| 120 |
of communication peers know a single |
| 121 |
<br>shared <b><i>secret-key(private-key) </i></b>and <b><i>ecrypt/decrypt |
| 122 |
</i></b>messages to communicate with each other. |
| 123 |
<br><b>Final algo : </b>It is obvious that the asym algo seems more powerful |
| 124 |
than the symm algo. But, the asym |
| 125 |
<br>algorithm is very expensive and the symm algorithm has a basic fault |
| 126 |
on how to distribute the key. A |
| 127 |
<br>combination where the asym algo is used only for handshake and distribute |
| 128 |
the shared key is the best bet. |
| 129 |
<br>Only when a member leaves does it require to re-generate a shared key. |
| 130 |
<br> |
| 131 |
<h1> |
| 132 |
<b>Step-by-Step</b></h1> |
| 133 |
|
| 134 |
<ol> |
| 135 |
<li> |
| 136 |
The first-member in the group becomes the admin and <i>generates</i> the |
| 137 |
<i>shared-key</i>.</li> |
| 138 |
|
| 139 |
<li> |
| 140 |
When a new peer requests to join, the <i>new-member</i> publishes its public-key.</li> |
| 141 |
|
| 142 |
<li> |
| 143 |
Using the <i>public-key</i> the admin encodes its <i>shared-key</i>.</li> |
| 144 |
|
| 145 |
<li> |
| 146 |
Using its own <i>private-key</i>, client decodes the <i>shared-key</i>.</li> |
| 147 |
|
| 148 |
<li> |
| 149 |
New member lets the admin know, it is <i>ready</i>.</li> |
| 150 |
|
| 151 |
<li> |
| 152 |
Members use <i>shared-key to encrypt/decrypt messages</i>.</li> |
| 153 |
|
| 154 |
<li> |
| 155 |
When member leaves, admin <i>regenerates</i> <i>shared-key</i>. If admin |
| 156 |
leaves, another member becomes admin <br> |
| 157 |
and regenerates key.</li> |
| 158 |
</ol> |
| 159 |
|
| 160 |
<ul> |
| 161 |
<br> |
| 162 |
<br> |
| 163 |
<br> </ul> |
| 164 |
|
| 165 |
</body> |
| 166 |
</html> |