Java Code Examples for org.jasypt.encryption.pbe.StandardPBEStringEncryptor#setConfig()
The following examples show how to use
org.jasypt.encryption.pbe.StandardPBEStringEncryptor#setConfig() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: HibernatePBEStringEncryptor.java From jasypt with Apache License 2.0 | 5 votes |
/** * Sets the PBEConfig to be used by the internal encryptor, * if a specific encryptor has not been set with <tt>setEncryptor(...)</tt>. * * @param config the PBEConfig to be set for the internal encryptor */ public void setConfig(final PBEConfig config) { if (this.encryptorSet) { throw new EncryptionInitializationException( "An encryptor has been already set: no " + "further configuration possible on hibernate wrapper"); } final StandardPBEStringEncryptor standardPBEStringEncryptor = (StandardPBEStringEncryptor) this.encryptor; standardPBEStringEncryptor.setConfig(config); }
Example 2
Source File: HibernatePBEStringEncryptor.java From jasypt with Apache License 2.0 | 5 votes |
/** * Sets the PBEConfig to be used by the internal encryptor, * if a specific encryptor has not been set with <tt>setEncryptor(...)</tt>. * * @param config the PBEConfig to be set for the internal encryptor */ public void setConfig(final PBEConfig config) { if (this.encryptorSet) { throw new EncryptionInitializationException( "An encryptor has been already set: no " + "further configuration possible on hibernate wrapper"); } final StandardPBEStringEncryptor standardPBEStringEncryptor = (StandardPBEStringEncryptor) this.encryptor; standardPBEStringEncryptor.setConfig(config); }
Example 3
Source File: HibernatePBEStringEncryptor.java From jasypt with Apache License 2.0 | 5 votes |
/** * Sets the PBEConfig to be used by the internal encryptor, * if a specific encryptor has not been set with <tt>setEncryptor(...)</tt>. * * @param config the PBEConfig to be set for the internal encryptor */ public void setConfig(final PBEConfig config) { if (this.encryptorSet) { throw new EncryptionInitializationException( "An encryptor has been already set: no " + "further configuration possible on hibernate wrapper"); } final StandardPBEStringEncryptor standardPBEStringEncryptor = (StandardPBEStringEncryptor) this.encryptor; standardPBEStringEncryptor.setConfig(config); }
Example 4
Source File: HibernatePBEStringEncryptor.java From jasypt with Apache License 2.0 | 5 votes |
/** * Sets the PBEConfig to be used by the internal encryptor, * if a specific encryptor has not been set with <tt>setEncryptor(...)</tt>. * * @param config the PBEConfig to be set for the internal encryptor */ public void setConfig(final PBEConfig config) { if (this.encryptorSet) { throw new EncryptionInitializationException( "An encryptor has been already set: no " + "further configuration possible on hibernate wrapper"); } final StandardPBEStringEncryptor standardPBEStringEncryptor = (StandardPBEStringEncryptor) this.encryptor; standardPBEStringEncryptor.setConfig(config); }
Example 5
Source File: BaseWebApplicationTests.java From hdw-dubbo with Apache License 2.0 | 5 votes |
/** * 加密 * @throws Exception */ @Test public void testEncrypt() throws Exception { StandardPBEStringEncryptor standardPBEStringEncryptor = new StandardPBEStringEncryptor(); EnvironmentPBEConfig config = new EnvironmentPBEConfig(); //TODO: 加密的算法,这个算法是默认的 config.setAlgorithm("PBEWithMD5AndDES"); //TODO: 加密的密钥 config.setPassword(CommonConstant.JWT_DEFAULT_ISSUER); standardPBEStringEncryptor.setConfig(config); //[email protected] String plainText = "abc123"; String encryptedText = standardPBEStringEncryptor.encrypt(plainText); System.out.println(encryptedText); }
Example 6
Source File: BaseWebApplicationTests.java From hdw-dubbo with Apache License 2.0 | 5 votes |
/** * 解密 * @throws Exception */ @Test public void testDecrypt() throws Exception { StandardPBEStringEncryptor standardPBEStringEncryptor = new StandardPBEStringEncryptor(); EnvironmentPBEConfig config = new EnvironmentPBEConfig(); //TODO: 加密的算法,这个算法是默认的 config.setAlgorithm("PBEWithMD5AndDES"); //TODO: 加密的密钥 config.setPassword(CommonConstant.JWT_DEFAULT_ISSUER); standardPBEStringEncryptor.setConfig(config); String encryptedText = "xRL1CVgzfFKBnPxCr+xjkg=="; String plainText = standardPBEStringEncryptor.decrypt(encryptedText); System.out.println(plainText); }
Example 7
Source File: PasswordUtilTest.java From ueboot with BSD 3-Clause "New" or "Revised" License | 5 votes |
@Test public void test(){ StandardPBEStringEncryptor standardPBEStringEncryptor = new StandardPBEStringEncryptor(); EnvironmentPBEConfig config = new EnvironmentPBEConfig(); config.setAlgorithm("PBEWithMD5AndDES"); // 加密的算法,这个算法是默认的 config.setPassword("ueboot"); // 加密的密钥 standardPBEStringEncryptor.setConfig(config); String plainText = ""; String encryptedText = standardPBEStringEncryptor.encrypt(plainText); System.out.println(encryptedText); }
Example 8
Source File: DataUtil.java From framework with Apache License 2.0 | 5 votes |
/** * Description: 可以解密的加密<br> * * @author 王伟<br> * @taskId <br> * @param password * @return <br> */ public static String encrypt(final String password) { // 加密工具 StandardPBEStringEncryptor encryptor = new StandardPBEStringEncryptor(); // 加密配置 EnvironmentStringPBEConfig config = new EnvironmentStringPBEConfig(); config.setAlgorithm(ALGORITHM); // 自己在用的时候更改此密码 config.setPassword(SITE_WIDE_SECRET); // 应用配置 encryptor.setConfig(config); // 加密 return encryptor.encrypt(password); }
Example 9
Source File: DataUtil.java From framework with Apache License 2.0 | 5 votes |
/** * Description: 解密 <br> * * @author 王伟<br> * @taskId <br> * @param password * @return <br> */ public static String decrypt(final String password) { StandardPBEStringEncryptor encryptor = new StandardPBEStringEncryptor(); // 加密配置 EnvironmentStringPBEConfig config = new EnvironmentStringPBEConfig(); config.setAlgorithm(ALGORITHM); // 自己在用的时候更改此密码 config.setPassword(SITE_WIDE_SECRET); // 应用配置 encryptor.setConfig(config); // 解密 return encryptor.decrypt(password); }
Example 10
Source File: EncryptionConfig.java From bearchoke with Apache License 2.0 | 5 votes |
@Bean public StandardPBEStringEncryptor standardPBEStringEncryptor() { StandardPBEStringEncryptor sse = new StandardPBEStringEncryptor(); sse.setConfig(environmentStringPBEConfig()); return sse; }
Example 11
Source File: EncryptionSecretKeyChanger.java From cloudstack with Apache License 2.0 | 4 votes |
private void initEncryptor(StandardPBEStringEncryptor encryptor, String secretKey) { encryptor.setAlgorithm("PBEWithMD5AndDES"); SimpleStringPBEConfig stringConfig = new SimpleStringPBEConfig(); stringConfig.setPassword(secretKey); encryptor.setConfig(stringConfig); }