[jboss-cvs] JBossRemoting/src/main/org/jboss/remoting/marshal/encryption ...
Anil Saldhana
anil.saldhana at jboss.com
Wed Aug 16 17:44:06 EDT 2006
User: asaldhana
Date: 06/08/16 17:44:06
Modified: src/main/org/jboss/remoting/marshal/encryption
EncryptionManager.java
Log:
JBREM-419: refactor the test
Revision Changes Path
1.3 +21 -5 JBossRemoting/src/main/org/jboss/remoting/marshal/encryption/EncryptionManager.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: EncryptionManager.java
===================================================================
RCS file: /cvsroot/jboss/JBossRemoting/src/main/org/jboss/remoting/marshal/encryption/EncryptionManager.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- EncryptionManager.java 16 Aug 2006 20:54:25 -0000 1.2
+++ EncryptionManager.java 16 Aug 2006 21:44:06 -0000 1.3
@@ -34,13 +34,23 @@
import EDU.oswego.cs.dl.util.concurrent.ConcurrentHashMap;
-//$Id: EncryptionManager.java,v 1.2 2006/08/16 20:54:25 asaldhana Exp $
+//$Id: EncryptionManager.java,v 1.3 2006/08/16 21:44:06 asaldhana Exp $
/**
* Manager that deals with the generation of the Cipher
+ * Mode:
+ * ECB: Electronic Codebook Mode (NIST FIPS PUB 81)
+ * CBC: Cipher Block Chaining Mode(NIST FIPS PUB 81)
+ * PCBC: Plaintext Cipher Block Chaining (Kerberos)
+ * CFB: Cipher Feedback Mode (NIST FIPS PUB 81)
+ * OFB: Output Feedback Mode (NIST FIPS PUB 81)
+ * Padding:
+ * NoPadding: No padding.
+ PKCS5Padding: RSA, "PKCS #5: Password-Based Encryption Standard,"
+ version 1.5, Nov 1993.
* @author <a href="mailto:Anil.Saldhana at jboss.org">Anil Saldhana</a>
* @since Aug 11, 2006
- * @version $Revision: 1.2 $
+ * @version $Revision: 1.3 $
*/
public class EncryptionManager
{
@@ -186,10 +196,16 @@
private static void initializeCipher(Cipher cipher, Key key, String algo, int mode)
throws Exception
{
- if(algo.indexOf("AES/CBC/") == 0)
+ //No Padding required
+ if(algo.equals("AES") || algo.equals("DES") || algo.equals("DESede") ||
+ algo.equals("RC4") || algo.equals("Blowfish"))
+ cipher.init(mode, key);
+ else
+ if(algo.indexOf("AES") == 0 && algo.indexOf("AES/ECB") < 0 )
cipher.init(mode, key,iv16);
else
- if(algo.indexOf("/CBC/") > 0)
+ if(algo.indexOf("/CBC/") > 0 || algo.indexOf("/OFB/") > 0 ||
+ algo.indexOf("/PCBC/") > 0 || algo.indexOf("/CFB/") > 0)
cipher.init(mode, key,iv8);
else
cipher.init(mode, key);
More information about the jboss-cvs-commits
mailing list