Permalink
Browse files

ciphers are now created using providers (https://issues.jboss.org/bro…

  • Loading branch information...
Bela Ban
Bela Ban committed Jan 26, 2011
1 parent cbef126 commit 6ecec086b8da9e2c467ad56037045d0edddcd5a5
Showing with 16 additions and 3 deletions.
  1. +16 −3 src/org/jgroups/protocols/ENCRYPT.java
@@ -460,8 +460,17 @@ private void initSymCiphers(String algorithm, SecretKey secret) throws Exception
if (log.isInfoEnabled())
log.info(" Initializing symmetric ciphers");
- symEncodingCipher = Cipher.getInstance(algorithm);
- symDecodingCipher = Cipher.getInstance(algorithm);
+ if (symProvider != null && symProvider.trim().length() > 0) {
+ symEncodingCipher = Cipher.getInstance(algorithm, symProvider);
+ symDecodingCipher = Cipher.getInstance(algorithm, symProvider);
+ }
+ else {
+ symEncodingCipher = Cipher.getInstance(algorithm);
+ symDecodingCipher = Cipher.getInstance(algorithm);
+ }
+
+
+
symEncodingCipher.init(Cipher.ENCRYPT_MODE, secret);
symDecodingCipher.init(Cipher.DECRYPT_MODE, secret);
@@ -508,7 +517,11 @@ public void initKeyPair() throws Exception
// set up the Cipher to decrypt secret key responses encrypted with our key
- asymCipher = Cipher.getInstance(asymAlgorithm);
+ if (asymProvider != null && asymProvider.trim().length() > 0)
+ asymCipher = Cipher.getInstance(asymAlgorithm, asymProvider);
+ else
+ asymCipher = Cipher.getInstance(asymAlgorithm);
+
asymCipher.init(Cipher.DECRYPT_MODE,Kpair.getPrivate());
if (log.isInfoEnabled())

0 comments on commit 6ecec08

Please sign in to comment.