You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@synapse.apache.org by in...@apache.org on 2010/05/11 14:48:07 UTC
svn commit: r943107 - in /synapse/trunk/java:
modules/commons/src/main/java/org/apache/synapse/commons/security/secret/handler/
modules/commons/src/main/java/org/apache/synapse/commons/security/secret/repository/
repository/conf/
Author: indika
Date: Tue May 11 12:48:07 2010
New Revision: 943107
URL: http://svn.apache.org/viewvc?rev=943107&view=rev
Log:
fix keystore infor
imporve FileBased secret provider
Modified:
synapse/trunk/java/modules/commons/src/main/java/org/apache/synapse/commons/security/secret/handler/JBossEncryptionSecretCallbackHandler.java
synapse/trunk/java/modules/commons/src/main/java/org/apache/synapse/commons/security/secret/repository/FileBaseSecretRepository.java
synapse/trunk/java/repository/conf/synapse.properties
Modified: synapse/trunk/java/modules/commons/src/main/java/org/apache/synapse/commons/security/secret/handler/JBossEncryptionSecretCallbackHandler.java
URL: http://svn.apache.org/viewvc/synapse/trunk/java/modules/commons/src/main/java/org/apache/synapse/commons/security/secret/handler/JBossEncryptionSecretCallbackHandler.java?rev=943107&r1=943106&r2=943107&view=diff
==============================================================================
--- synapse/trunk/java/modules/commons/src/main/java/org/apache/synapse/commons/security/secret/handler/JBossEncryptionSecretCallbackHandler.java (original)
+++ synapse/trunk/java/modules/commons/src/main/java/org/apache/synapse/commons/security/secret/handler/JBossEncryptionSecretCallbackHandler.java Tue May 11 12:48:07 2010
@@ -59,7 +59,7 @@ public class JBossEncryptionSecretCallba
CipherInformation cipherInformation = new CipherInformation();
cipherInformation.setAlgorithm(ALGORITHM);
cipherInformation.setCipherOperationMode(CipherOperationMode.DECRYPT);
- cipherInformation.setInType(EncodingType.BIGINTEGER16);
+ cipherInformation.setInType(EncodingType.BIGINTEGER16); //TODO
DecryptionProvider decryptionProvider = CipherFactory.createCipher(cipherInformation, key);
return new String(decryptionProvider.decrypt(encryptedSecret.getBytes()));
}
Modified: synapse/trunk/java/modules/commons/src/main/java/org/apache/synapse/commons/security/secret/repository/FileBaseSecretRepository.java
URL: http://svn.apache.org/viewvc/synapse/trunk/java/modules/commons/src/main/java/org/apache/synapse/commons/security/secret/repository/FileBaseSecretRepository.java?rev=943107&r1=943106&r2=943107&view=diff
==============================================================================
--- synapse/trunk/java/modules/commons/src/main/java/org/apache/synapse/commons/security/secret/repository/FileBaseSecretRepository.java (original)
+++ synapse/trunk/java/modules/commons/src/main/java/org/apache/synapse/commons/security/secret/repository/FileBaseSecretRepository.java Tue May 11 12:48:07 2010
@@ -119,17 +119,25 @@ public class FileBaseSecretRepository im
CipherInformation cipherInformation = new CipherInformation();
cipherInformation.setAlgorithm(algorithm);
cipherInformation.setCipherOperationMode(CipherOperationMode.DECRYPT);
- cipherInformation.setInType(EncodingType.BASE64);
+ cipherInformation.setInType(EncodingType.BASE64); //TODO
DecryptionProvider baseCipher =
CipherFactory.createCipher(cipherInformation, keyStoreWrapper);
for (Object alias : cipherProperties.keySet()) {
- //Creates a cipher
- String decryptedText = new String(baseCipher.decrypt(
- cipherProperties.getProperty(String.valueOf(alias)).getBytes()));
- secrets.put(String.valueOf(alias), decryptedText);
- initialize = true;
+ //decrypt the encrypted text
+ String key = String.valueOf(alias);
+ String encryptedText = cipherProperties.getProperty(key);
+ if (encryptedText == null || "".equals(encryptedText.trim())) {
+ if (log.isDebugEnabled()) {
+ log.debug("There is no secret for the alias : " + alias);
+ }
+ continue;
+ }
+
+ String decryptedText = new String(baseCipher.decrypt(encryptedText.trim().getBytes()));
+ secrets.put(key, decryptedText);
}
+ initialize = true;
}
/**
Modified: synapse/trunk/java/repository/conf/synapse.properties
URL: http://svn.apache.org/viewvc/synapse/trunk/java/repository/conf/synapse.properties?rev=943107&r1=943106&r2=943107&view=diff
==============================================================================
--- synapse/trunk/java/repository/conf/synapse.properties (original)
+++ synapse/trunk/java/repository/conf/synapse.properties Tue May 11 12:48:07 2010
@@ -61,16 +61,16 @@
#keystore.identity.type=JKS
#keystore.identity.alias=synapse
#keystore.identity.store.password=password
-#keystore.identity.store.secretProvider=<any implementation of org.apache.synapse.commons.security.secret.SecretCallbackHandler>
+#keystore.identity.store.passwordProvider=<any implementation of org.apache.synapse.commons.security.secret.SecretCallbackHandler>
#keystore.identity.key.password=password
-#keystore.identity.key.secretProvider=<any implementation of org.apache.synapse.commons.security.secret.SecretCallbackHandler>
+#keystore.identity.key.passwordProvider=<any implementation of org.apache.synapse.commons.security.secret.SecretCallbackHandler>
##keystore.identity.parameters=enableHostnameVerifier=false;keyStoreCertificateFilePath=/home/esb.cer
#
#keystore.trust.location=lib/trust.jks
#keystore.trust.type=JKS
#keystore.trust.alias=synapse
#keystore.trust.store.password=password
-#keystore.trust.store.secretProvider=<any implementation of org.apache.synapse.commons.security.secret.SecretCallbackHandler>
+#keystore.trust.store.passwordProvider=<any implementation of org.apache.synapse.commons.security.secret.SecretCallbackHandler>
#
################################################################################
# DataSources Configuration