edu.vt.middleware.crypt.tasks.DecryptPropertyTask Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of vt-crypt Show documentation
Show all versions of vt-crypt Show documentation
Library for performing common cryptographic operations
/*
$Id$
Copyright (C) 2007-2011 Virginia Tech.
All rights reserved.
SEE LICENSE FOR MORE INFORMATION
Author: Middleware Services
Email: [email protected]
Version: $Revision$
Updated: $Date$
*/
package edu.vt.middleware.crypt.tasks;
import edu.vt.middleware.crypt.symmetric.SymmetricAlgorithm;
import edu.vt.middleware.crypt.util.Base64Converter;
import org.apache.tools.ant.BuildException;
/**
* DecryptPropertyTask
will decrypt an ant property using a
* symmetric algorithm. Encrypted value must be BASE64 encoded.
*
* @author Middleware Services
* @version $Revision: 21 $
*/
public final class DecryptPropertyTask extends AbstractCryptTask
{
/** See @link{org.apache.tools.ant.Task}.
*/
public void execute()
{
try {
final SymmetricAlgorithm crypt = createAlgorithm();
crypt.initDecrypt();
final String propertyValue = this.getProject().getProperty(
this.propertyName);
final String decryptValue = new String(
crypt.decrypt(propertyValue, new Base64Converter()));
this.getProject().setProperty(this.propertyName, decryptValue);
} catch (Exception e) {
e.printStackTrace();
throw new BuildException(e);
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy