Package org.jasypt.encryption.pbe

Examples of org.jasypt.encryption.pbe.StandardPBEStringEncryptor.decrypt()


   */
  public static String decryptString(String cypher, String password) {

    StandardPBEStringEncryptor encryptor = initCypher();
    encryptor.setPassword(password);
    String output = encryptor.decrypt(cypher);
    return output;
  }

  /**
   * Encrypt a plaintext with the given password. The password will be treated
View Full Code Here


    logger.debug("entering decryptString");

    try {
      StandardPBEStringEncryptor encryptor = initCypher();
      encryptor.setPassword(password);
      String output = encryptor.decrypt(cypher);

      logger.debug("exiting decryptString");
      return output;

    } catch (EncryptionOperationNotPossibleException ex) {
View Full Code Here

    LOG.info("Starting decryption");
    String decrypted = null;
    StandardPBEStringEncryptor encryptor = new StandardPBEStringEncryptor();
    if (TYPE_ENCRYP.PBES.equals(type)) {
      encryptor.setPassword(SEED_PBES);
      decrypted = encryptor.decrypt(text);
      LOG.info(decrypted);
    } else if (TYPE_ENCRYP.BC.equals(type)) {
      encryptor.setProvider(new BouncyCastleProvider());
      encryptor.setPassword(SEED_BC);
      encryptor.setAlgorithm("PBEWITHSHA256AND128BITAES-CBC-BC");
View Full Code Here

      LOG.info(decrypted);
    } else if (TYPE_ENCRYP.BC.equals(type)) {
      encryptor.setProvider(new BouncyCastleProvider());
      encryptor.setPassword(SEED_BC);
      encryptor.setAlgorithm("PBEWITHSHA256AND128BITAES-CBC-BC");
      decrypted = encryptor.decrypt(text);
      LOG.info(decrypted);
    } else {
      throw new EncryptDecryptUtilException(
          "Error can not determine the type of encryption algorithm to use");
    }
View Full Code Here

        System.out.println("clearText="+clearText);
        String encryptedText = encryptor.encrypt(clearText);
        System.out.println("encryptedText.length="+encryptedText.length());
        System.out.println("encryptedText="+encryptedText);
        assertEquals(encryptedText.length(), 172);
        String decryptedText = encryptor.decrypt(encryptedText);
        assertEquals(decryptedText, clearText);
    }
}
View Full Code Here

            user =  findOneBy(sc);
            if ( user != null && user.getSecretKey() != null) {
                // if the cloud db is encrypted, decrypt the secret_key returned by cloud db before signature generation
                if( EncryptionSecretKeyCheckerUtil.useEncryption() ) {
                    StandardPBEStringEncryptor encryptor = EncryptionSecretKeyCheckerUtil.getEncryptor();
                    cloudSecretKey = encryptor.decrypt( user.getSecretKey() );
                } else {
                    cloudSecretKey = user.getSecretKey();
                }
            }
            return cloudSecretKey;
View Full Code Here

       
       
        StandardPBEStringEncryptor encryptor = new StandardPBEStringEncryptor();
        encryptor.setConfig(config);
       
        return encryptor.decrypt(input);
       
    }
   
}
View Full Code Here

       
       
        final StandardPBEStringEncryptor encryptor = new StandardPBEStringEncryptor();
        encryptor.setConfig(config);
       
        return encryptor.decrypt(input);
       
    }
   
}
View Full Code Here

            user =  findOneBy(sc);
            if ( user != null && user.getSecretKey() != null) {
                // if the cloud db is encrypted, decrypt the secret_key returned by cloud db before signature generation
                if( EncryptionSecretKeyCheckerUtil.useEncryption() ) {
                    StandardPBEStringEncryptor encryptor = EncryptionSecretKeyCheckerUtil.getEncryptor();
                    cloudSecretKey = encryptor.decrypt( user.getSecretKey() );
                } else {
                    cloudSecretKey = user.getSecretKey();
                }
            }
            return cloudSecretKey;
View Full Code Here

        encryptor.setPassword( SECURE_STRING );
        encryptor.setAlgorithm( SECURE_ALGORITHM );

        String result = encryptedText;
        try {
            result = encryptor.decrypt( encryptedText );
        } catch ( EncryptionOperationNotPossibleException e ) {
            log.error( "Unable to decrypt", e );
        }
        return result;
    }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.