Package au.net.causal.maven.nativesecurity.encrypter

Examples of au.net.causal.maven.nativesecurity.encrypter.NativeEncrypter


 
  @Override
  public void executeImpl()
  throws MojoExecutionException, MojoFailureException
  {
    NativeEncrypter encrypter = encrypterManager.findUsableEncrypter();
    if (encrypter == null)
      throw new MojoExecutionException("No native encrypters available for current platform.");
   
    try
    {
      String password;
      try
      {
        //For the secure non-echoing prompter, prompt twice and verify
        password = securePrompter.promptForPassword("Password");
        String passwordVerification = securePrompter.promptForPassword("Re-enter password");
       
        if (password != null && !password.equals(passwordVerification))
          throw new MojoFailureException("Entered passwords do not match.");
      }
      catch (PrompterException e)
      {
        //Don't need to prompt twice when password is echoed
        getLog().warn("Secure password prompter not available, entered password will be echoed to console!");
        password = fallbackPrompter.promptForPassword("Password");
      }
     
      //Prompt for password
      if (password == null || password.isEmpty())
        throw new MojoFailureException("No password entered");
     
      String encryptedBase64String = encrypter.encrypt(password);
     
      //Add our magic around the raw data
      String fullString = "{[type=native]" + encryptedBase64String + "}";
     
      //And display the result to the user
View Full Code Here


  private NativeEncrypterManager encrypterManager;
 
  @Override
  public String decrypt(String str, Map attributes, Map config) throws SecDispatcherException
  {
    NativeEncrypter encrypter = encrypterManager.findUsableEncrypter();
    if (encrypter == null)
      throw new SecDispatcherException("No native encrypters available for current platform.");
   
    getLogger().debug("Using native encrypter: " + encrypter);
   
    try
    {
      String password = encrypter.decrypt(str);
      return(password);
    }
    catch (EncryptionException e)
    {
      throw new SecDispatcherException(e);
View Full Code Here

TOP

Related Classes of au.net.causal.maven.nativesecurity.encrypter.NativeEncrypter

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.