Java Doc for ENCRYPT.java in  » Net » JGroups-2.4.1-sp3 » org » jgroups » protocols » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Net » JGroups 2.4.1 sp3 » org.jgroups.protocols 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   java.lang.Thread
      org.jgroups.stack.UpHandler
         org.jgroups.protocols.ENCRYPT

ENCRYPT
public class ENCRYPT extends Protocol (Code)
ENCRYPT layer. Encrypt and decrypt the group communication in JGroups The file can be used in two ways:
  • Option 1. Configured with a secretKey in a keystore so it can be used at any layer in JGroups without the need for a coordinator, or if you want protection against passive monitoring but do not want the key exchange overhead and complexity. In this mode all nodes must be distributed with the same keystore file.
  • Option 2. Configured with algorithms and key sizes. The Encrypt Layer in this mode sould be used between the FRAG and PBCast layers in the stack. The coordinator then chooses the secretkey which it distributes amongst all the peers. In this form no keystore exists as the keys are distributed using a public/private key exchange. View changes that identify a new controller will result in a new session key being generated and then distributed to all peers. This overhead can be substantial in a an application with a reasonable peer churn.

Each message is identified as encrypted with a specific encryption header which identifies the type of encrypt header and an MD5 digest that identifies the version of the key being used to encrypt/decrypt the messages.

Option 1


This is the simplest option and can be used by simply inserting the Encryption layer at any point in the JGroup stack - it will encrypt all Events of a type MSG that have a non-null message buffer. The format of the entry in this form is:
<ENCRYPT key_store_name="defaultStore.keystore" store_password="changeit" alias="myKey"/>
An example bare-bones.xml file showing the keystore version can be found in the conf ina file called EncryptKeyStore.xml - along with a defaultStore.keystore file.
In order to use the Encrypt layer in this manner it is necessary to have the secretKey already generated in a keystore file. The directory containing the keystore file must be on the application's classpath. You cannot create a SecretKey keystore file using the keytool application shipped with the JDK. A java file called KeyStoreGenerator is included in the demo package that can be used from the command line (or IDE) to generate a suitable keystore.

Option 2


This option is suited to an application that does not ship with a known key but instead it is generated and distributed by the controller. The secret key is first generated by the Controller (in JGroup terms). When a view change occurs a peer will request the secret key by sending a key request with its own public key. The controller encrypts the secret key with this key and sends it back to the peer who then decrypts it and installs the key as its own secret key.
All encryption and decryption of Messages is done using this key. When a peer receives a view change that shows a different keyserver it will repeat this process - the view change event also trigger the encrypt layer to queue up and down messages until the new key is installed. The previous keys are retained so that messages sent before the view change that are queued can be decrypted if the key is different.
An example EncryptNoKeyStore.xml is included in the conf file as a guide.


Note: the current version does not support the concept of perfect forward encryption (PFE) which means that if a peer leaves the group the keys are re-generated preventing the departed peer from decrypting future messages if it chooses to listen in on the group. This is not included as it really requires a suitable authentication scheme as well to make this feature useful as there is nothing to stop the peer rejoining and receiving the new key. A future release will address this issue.
author:
   Steve Woodcock
author:
   Bela Ban


Inner Class :public static class EncryptHeader extends org.jgroups.Header implements Streamable

Field Summary
final static  StringDEFAULT_SYM_ALGO
    
 KeyPairKpair
    
 StringasymAlgorithm
    
 intasymInit
    
 StringasymProvider
    
final  MapkeyMap
    
 booleankeyServer
    
 AddresskeyServerAddr
    
 Addresslocal_addr
    
 SecretKeysecretKey
    
 PublicKeyserverPubKey
    
 StringsymAlgorithm
    
 CiphersymDecodingCipher
    
 CiphersymEncodingCipher
    
 intsymInit
    
final  StringsymProvider
    

Constructor Summary
public  ENCRYPT()
    

Method Summary
public  voiddown(Event evt)
    
protected  StringgetAsymAlgorithm()
    
protected  CiphergetAsymCipher()
    
protected  intgetAsymInit()
    
protected  StringgetAsymProvider()
    
protected  SecretKeygetDesKey()
    
protected  AddressgetKeyServerAddr()
    
protected  StringgetKeyStoreName()
    
protected  KeyPairgetKpair()
    
protected  AddressgetLocal_addr()
    
public  StringgetName()
    
protected  PublicKeygetServerPubKey()
    
protected  StringgetSymAlgorithm()
    
protected  CiphergetSymDecodingCipher()
    
protected  CiphergetSymEncodingCipher()
    
protected  intgetSymInit()
    
protected  StringgetSymProvider()
    
public  voidinit()
    
public  voidinitKeyPair()
    
public  voidinitSymKey()
     Used to initialise the symmetric key if none is supplied in a keystore.
public  voidreset()
    
protected  voidsetKeyServerAddr(Address keyServerAddr)
    
protected  voidsetLocal_addr(Address local_addr)
    
public  booleansetProperties(Properties props)
    
public  voidup(Event evt)
    

Field Detail
DEFAULT_SYM_ALGO
final static String DEFAULT_SYM_ALGO(Code)



Kpair
KeyPair Kpair(Code)



asymAlgorithm
String asymAlgorithm(Code)



asymInit
int asymInit(Code)



asymProvider
String asymProvider(Code)



keyMap
final Map keyMap(Code)



keyServer
boolean keyServer(Code)



keyServerAddr
Address keyServerAddr(Code)



local_addr
Address local_addr(Code)



secretKey
SecretKey secretKey(Code)



serverPubKey
PublicKey serverPubKey(Code)



symAlgorithm
String symAlgorithm(Code)



symDecodingCipher
Cipher symDecodingCipher(Code)



symEncodingCipher
Cipher symEncodingCipher(Code)



symInit
int symInit(Code)



symProvider
final String symProvider(Code)




Constructor Detail
ENCRYPT
public ENCRYPT()(Code)




Method Detail
down
public void down(Event evt)(Code)



getAsymAlgorithm
protected String getAsymAlgorithm()(Code)
Returns the asymAlgorithm.



getAsymCipher
protected Cipher getAsymCipher()(Code)
Returns the asymCipher.



getAsymInit
protected int getAsymInit()(Code)
Returns the asymInit.



getAsymProvider
protected String getAsymProvider()(Code)
Returns the asymProvider.



getDesKey
protected SecretKey getDesKey()(Code)
Returns the desKey.



getKeyServerAddr
protected Address getKeyServerAddr()(Code)
Returns the keyServerAddr.



getKeyStoreName
protected String getKeyStoreName()(Code)
Returns the keyStoreName.



getKpair
protected KeyPair getKpair()(Code)
Returns the kpair.



getLocal_addr
protected Address getLocal_addr()(Code)
Returns the local_addr.



getName
public String getName()(Code)



getServerPubKey
protected PublicKey getServerPubKey()(Code)
Returns the serverPubKey.



getSymAlgorithm
protected String getSymAlgorithm()(Code)
Returns the symAlgorithm.



getSymDecodingCipher
protected Cipher getSymDecodingCipher()(Code)
Returns the symDecodingCipher.



getSymEncodingCipher
protected Cipher getSymEncodingCipher()(Code)
Returns the symEncodingCipher.



getSymInit
protected int getSymInit()(Code)
Returns the symInit.



getSymProvider
protected String getSymProvider()(Code)
Returns the symProvider.



init
public void init() throws Exception(Code)



initKeyPair
public void initKeyPair() throws Exception(Code)
Generates the public/private key pair from the init params
throws:
  Exception -



initSymKey
public void initSymKey() throws Exception(Code)
Used to initialise the symmetric key if none is supplied in a keystore.
throws:
  Exception -



reset
public void reset()(Code)
Just remove if you don't need to reset any state



setKeyServerAddr
protected void setKeyServerAddr(Address keyServerAddr)(Code)

Parameters:
  keyServerAddr - The keyServerAddr to set.



setLocal_addr
protected void setLocal_addr(Address local_addr)(Code)

Parameters:
  local_addr - The local_addr to set.



setProperties
public boolean setProperties(Properties props)(Code)



up
public void up(Event evt)(Code)



Fields inherited from org.jgroups.stack.UpHandler
final protected Log log(Code)(Java Doc)

Methods inherited from org.jgroups.stack.UpHandler
public void run()(Code)(Java Doc)
public void setObserver(ProtocolObserver observer)(Code)(Java Doc)

Fields inherited from java.lang.Thread
final public static int MAX_PRIORITY(Code)(Java Doc)
final public static int MIN_PRIORITY(Code)(Java Doc)
final public static int NORM_PRIORITY(Code)(Java Doc)

Methods inherited from java.lang.Thread
public static int activeCount()(Code)(Java Doc)
final public void checkAccess()(Code)(Java Doc)
native public int countStackFrames()(Code)(Java Doc)
native public static Thread currentThread()(Code)(Java Doc)
public void destroy()(Code)(Java Doc)
public static void dumpStack()(Code)(Java Doc)
public static int enumerate(Thread tarray)(Code)(Java Doc)
public static Map<Thread, StackTraceElement[]> getAllStackTraces()(Code)(Java Doc)
public ClassLoader getContextClassLoader()(Code)(Java Doc)
public static UncaughtExceptionHandler getDefaultUncaughtExceptionHandler()(Code)(Java Doc)
public long getId()(Code)(Java Doc)
final public String getName()(Code)(Java Doc)
final public int getPriority()(Code)(Java Doc)
public StackTraceElement[] getStackTrace()(Code)(Java Doc)
public State getState()(Code)(Java Doc)
final public ThreadGroup getThreadGroup()(Code)(Java Doc)
public UncaughtExceptionHandler getUncaughtExceptionHandler()(Code)(Java Doc)
native public static boolean holdsLock(Object obj)(Code)(Java Doc)
public void interrupt()(Code)(Java Doc)
public static boolean interrupted()(Code)(Java Doc)
final native public boolean isAlive()(Code)(Java Doc)
final public boolean isDaemon()(Code)(Java Doc)
public boolean isInterrupted()(Code)(Java Doc)
final public synchronized void join(long millis) throws InterruptedException(Code)(Java Doc)
final public synchronized void join(long millis, int nanos) throws InterruptedException(Code)(Java Doc)
final public void join() throws InterruptedException(Code)(Java Doc)
final public void resume()(Code)(Java Doc)
public void run()(Code)(Java Doc)
public void setContextClassLoader(ClassLoader cl)(Code)(Java Doc)
final public void setDaemon(boolean on)(Code)(Java Doc)
public static void setDefaultUncaughtExceptionHandler(UncaughtExceptionHandler eh)(Code)(Java Doc)
final public void setName(String name)(Code)(Java Doc)
final public void setPriority(int newPriority)(Code)(Java Doc)
public void setUncaughtExceptionHandler(UncaughtExceptionHandler eh)(Code)(Java Doc)
native public static void sleep(long millis) throws InterruptedException(Code)(Java Doc)
public static void sleep(long millis, int nanos) throws InterruptedException(Code)(Java Doc)
public synchronized void start()(Code)(Java Doc)
final public void stop()(Code)(Java Doc)
final public synchronized void stop(Throwable obj)(Code)(Java Doc)
final public void suspend()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
native public static void yield()(Code)(Java Doc)

Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.