mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
ALF-9510 checkin. Also some fixes for ALF-8702.
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@30070 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -18,6 +18,9 @@
|
||||
*/
|
||||
package org.alfresco.encryption;
|
||||
|
||||
import org.alfresco.error.AlfrescoRuntimeException;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.springframework.context.ApplicationEvent;
|
||||
import org.springframework.extensions.surf.util.AbstractLifecycleBean;
|
||||
|
||||
@@ -28,9 +31,10 @@ import org.springframework.extensions.surf.util.AbstractLifecycleBean;
|
||||
*/
|
||||
public class BootstrapReEncryptor extends AbstractLifecycleBean
|
||||
{
|
||||
private static Log logger = LogFactory.getLog(BootstrapReEncryptor.class);
|
||||
|
||||
private boolean enabled;
|
||||
private ReEncryptor reEncryptor;
|
||||
private KeyStoreParameters oldKeyStoreParameters;
|
||||
|
||||
public void setEnabled(boolean enabled)
|
||||
{
|
||||
@@ -42,14 +46,20 @@ public class BootstrapReEncryptor extends AbstractLifecycleBean
|
||||
this.reEncryptor = reEncryptor;
|
||||
}
|
||||
|
||||
public void setOldKeyStoreParameters(KeyStoreParameters oldKeyStoreParameters)
|
||||
public int reEncrypt()
|
||||
{
|
||||
this.oldKeyStoreParameters = oldKeyStoreParameters;
|
||||
}
|
||||
|
||||
public void reEncrypt()
|
||||
{
|
||||
reEncryptor.execute(oldKeyStoreParameters);
|
||||
try
|
||||
{
|
||||
return reEncryptor.reEncrypt();
|
||||
}
|
||||
catch(MissingKeyException e)
|
||||
{
|
||||
throw new AlfrescoRuntimeException("Bootstrap re-encryption failed", e);
|
||||
}
|
||||
catch(MissingKeyStoreException e)
|
||||
{
|
||||
throw new AlfrescoRuntimeException("Bootstrap re-encryption failed", e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -57,7 +67,15 @@ public class BootstrapReEncryptor extends AbstractLifecycleBean
|
||||
{
|
||||
if(enabled)
|
||||
{
|
||||
reEncrypt();
|
||||
if(logger.isDebugEnabled())
|
||||
{
|
||||
logger.debug("Re-encrypting encryptable properties...");
|
||||
}
|
||||
int propertiesReEncrypted = reEncrypt();
|
||||
if(logger.isDebugEnabled())
|
||||
{
|
||||
logger.debug("...done, re-encrypted " + propertiesReEncrypted + " properties.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user