private void setupEncryption( CloudloopConfig config )
throws InvalidConfigurationException,
IOException
{
Encryption encryptionConfig = config.getEncryption( );
if ( encryptionConfig == null )
{
// Encryption not configured. Return...
return;
}
File keyDirectory = new File( encryptionConfig.getKeyDirectory( ) );
if ( !keyDirectory.exists( ) || !keyDirectory.isDirectory( ) )
{
throw new InvalidConfigurationException(
"Could not find encryption key directory '"
+ keyDirectory.getAbsolutePath( ) + "'." );
}
try
{
_encryptionProvider = EncryptionProviderBuilder
.buildProvider( keyDirectory, encryptionConfig.getPreferredKey( ) );
}
catch ( NoSuchAlgorithmException e )
{
throw new InvalidConfigurationException( e );
}