All Downloads are FREE. Search and download functionalities are using the official Maven repository.

edu.vt.middleware.crypt.tasks.DecryptPropertyTask Maven / Gradle / Ivy

There is a newer version: 2.2
Show newest version
/*
  $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