/** * AES algorithm */ private PBEStringEncryptor newEncryptor(final String passphrase) { final StandardPBEStringEncryptor encryptor = new StandardPBEStringEncryptor(); encryptor.setPassword(passphrase); encryptor.setProvider(PROVIDER); encryptor.setAlgorithm(CRYPTO_ALGO); return encryptor; } }
@Override protected PasswordEncoder createStringEncoder() { byte[] password = lookupPasswordFromKeyStore(); char[] chars = toChars(password); try { stringEncrypter = new StandardPBEStringEncryptor(); stringEncrypter.setPasswordCharArray(chars); if (getProviderName() != null && !getProviderName().isEmpty()) { stringEncrypter.setProviderName(getProviderName()); } stringEncrypter.setAlgorithm(getAlgorithm()); JasyptPBEPasswordEncoderWrapper encoder = new JasyptPBEPasswordEncoderWrapper(); encoder.setPbeStringEncryptor(stringEncrypter); return encoder; } finally { scramble(password); scramble(chars); } }
private static void initialize(String key) { StandardPBEStringEncryptor standardPBEStringEncryptor = new StandardPBEStringEncryptor(); standardPBEStringEncryptor.setAlgorithm("PBEWITHSHA1ANDDESEDE"); standardPBEStringEncryptor.setPassword(key); encryptor = standardPBEStringEncryptor; }
private void initEncryptor(StandardPBEStringEncryptor encryptor, String secretKey) { encryptor.setAlgorithm("PBEWithMD5AndDES"); SimpleStringPBEConfig stringConfig = new SimpleStringPBEConfig(); stringConfig.setPassword(secretKey); encryptor.setConfig(stringConfig); }
public static void initEncryptorForMigration(String secretKey) { s_encryptor.setAlgorithm("PBEWithMD5AndDES"); SimpleStringPBEConfig stringConfig = new SimpleStringPBEConfig(); stringConfig.setPassword(secretKey); s_encryptor.setConfig(stringConfig); s_useEncryption = true; } }
s_encryptor.setAlgorithm("PBEWithMD5AndDES"); String secretKey = null;
private static void initialize() { final Properties dbProps = DbProperties.getDbProperties(); if (EncryptionSecretKeyChecker.useEncryption()) { String dbSecretKey = dbProps.getProperty("db.cloud.encrypt.secret"); if (dbSecretKey == null || dbSecretKey.isEmpty()) { throw new CloudRuntimeException("Empty DB secret key in db.properties"); } s_encryptor = new StandardPBEStringEncryptor(); s_encryptor.setAlgorithm("PBEWithMD5AndDES"); s_encryptor.setPassword(dbSecretKey); } else { throw new CloudRuntimeException("Trying to encrypt db values when encrytion is not enabled"); } } }
/** * Creates a new instance of <tt>StrongTextEncryptor</tt>. */ public StrongTextEncryptor() { super(); this.encryptor = new StandardPBEStringEncryptor(); this.encryptor.setAlgorithm("PBEWithMD5AndTripleDES"); }
/** * Creates a new instance of <tt>BasicTextEncryptor</tt>. */ public BasicTextEncryptor() { super(); this.encryptor = new StandardPBEStringEncryptor(); this.encryptor.setAlgorithm("PBEWithMD5AndDES"); }
/** * Creates a new instance of <tt>StrongTextEncryptor</tt>. */ public StrongTextEncryptor() { super(); this.encryptor = new StandardPBEStringEncryptor(); this.encryptor.setAlgorithm("PBEWithMD5AndTripleDES"); }
/** * Creates a new instance of <tt>BasicTextEncryptor</tt>. */ public BasicTextEncryptor() { super(); this.encryptor = new StandardPBEStringEncryptor(); this.encryptor.setAlgorithm("PBEWithMD5AndDES"); }
/** * Creates a new instance of <tt>BasicTextEncryptor</tt>. */ public BasicTextEncryptor() { super(); this.encryptor = new StandardPBEStringEncryptor(); this.encryptor.setAlgorithm("PBEWithMD5AndDES"); }
/** * Creates a new instance of <tt>StrongTextEncryptor</tt>. */ public StrongTextEncryptor() { super(); this.encryptor = new StandardPBEStringEncryptor(); this.encryptor.setAlgorithm("PBEWithMD5AndTripleDES"); }
public JasyptPasswordEncryptor(CallbackHandler callbackHandler, String algorithm) { passwordEncryptor = new StandardPBEStringEncryptor(); passwordEncryptor.setAlgorithm(algorithm); this.callbackHandler = callbackHandler; }
public JasyptPasswordEncryptor(String masterPassword, String algorithm) { passwordEncryptor = new StandardPBEStringEncryptor(); passwordEncryptor.setPassword(masterPassword); passwordEncryptor.setAlgorithm(algorithm); }
StandardPBEStringEncryptor encryptor =new StandardPBEStringEncryptor(); encryptor.setPassword("somePass"); encryptor.setAlgorithm("PBEWITHMD5ANDDES"); Configuration configuration = new Configuration().configure(); String pass=encryptor.decrypt(configuration.getProperty("hibernate.connection.password")); configuration.setProperty("hibernate.connection.password",pass);
StandardPBEStringEncryptor myFirstEncryptor = new StandardPBEStringEncryptor(); myFirstEncryptor.setProvider(new BouncyCastleProvider()); myFirstEncryptor.setAlgorithm("PBEWITHSHA256AND128BITAES-CBC-BC"); myFirstEncryptor.setPassword(myPassword); String myFirstEncryptedText = myFirstEncryptor.encrypt(myText);
/** * 编码 默认算法为"PBEWithMD5AndDES" * @param keyt 秘钥 * @param source 原始数据 * @return 这里每次加密后的密文结果都不一样 */ public static String encrypt(String keyt, String source){ StandardPBEStringEncryptor encryptor = new StandardPBEStringEncryptor(); encryptor.setPassword(keyt); encryptor.setAlgorithm("PBEWithMD5AndDES"); return encryptor.encrypt(source); }
@Override public Boolean isEncEnabled() { Boolean encEnabled = getResolvedBooleanProperty(PROPERTY_ENC_ENABLED); if (encEnabled) { this.encryptor = new StandardPBEStringEncryptor(); this.encryptor.setPassword(getEncMasterPassword()); this.encryptor.setAlgorithm(getEncAlgorithm()); } return encEnabled; }
private StandardPBEStringEncryptor setupEncryptor(String password, String algorithm) { final StandardPBEStringEncryptor encryptor = new StandardPBEStringEncryptor(); encryptor.setPassword(password); encryptor.setAlgorithm(algorithm); return encryptor; } }