Skip to content

Commit

Permalink
providers are now used to create ciphers (https://issues.jboss.org/br…
Browse files Browse the repository at this point in the history
  • Loading branch information
belaban committed Jan 26, 2011
1 parent 8cafecb commit f8ade06
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions src/org/jgroups/protocols/ENCRYPT.java
Expand Up @@ -343,8 +343,15 @@ 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);

Expand Down Expand Up @@ -390,7 +397,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())
Expand Down

0 comments on commit f8ade06

Please sign in to comment.