本文整理匯總了Java中org.jasypt.encryption.pbe.StandardPBEStringEncryptor.setProvider方法的典型用法代碼示例。如果您正苦於以下問題:Java StandardPBEStringEncryptor.setProvider方法的具體用法?Java StandardPBEStringEncryptor.setProvider怎麽用?Java StandardPBEStringEncryptor.setProvider使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.jasypt.encryption.pbe.StandardPBEStringEncryptor
的用法示例。
在下文中一共展示了StandardPBEStringEncryptor.setProvider方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: testEncrypt
import org.jasypt.encryption.pbe.StandardPBEStringEncryptor; //導入方法依賴的package包/類
@Test
public void testEncrypt()
{
StandardPBEStringEncryptor encryptor = new StandardPBEStringEncryptor();
encryptor.setProvider(new BouncyCastleProvider());
encryptor.setAlgorithm("PBEWITHSHA256AND256BITAES-CBC-BC");
encryptor.setPassword("[email protected][email protected]");
encryptor.setKeyObtentionIterations(1000);
String clearText = "1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890";
System.out.println("clearText.length="+clearText.length());
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);
}
示例2: getConfigurationEncryptor
import org.jasypt.encryption.pbe.StandardPBEStringEncryptor; //導入方法依賴的package包/類
private static StandardPBEStringEncryptor getConfigurationEncryptor(String password) {
StandardPBEStringEncryptor encryptor = new StandardPBEStringEncryptor();
encryptor.setProvider(new BouncyCastleProvider());
encryptor.setAlgorithm(ALGORITHM);
encryptor.setPassword(password);
encryptor.setKeyObtentionIterations(KEY_OBTENTION_ITERATIONS);
return encryptor;
}
示例3: newEncryptor
import org.jasypt.encryption.pbe.StandardPBEStringEncryptor; //導入方法依賴的package包/類
/**
* AES algorithm
* @param passphrase
* @return
*/
private PBEStringEncryptor newEncryptor(String passphrase) {
StandardPBEStringEncryptor encryptor = new StandardPBEStringEncryptor();
encryptor.setPassword(passphrase);
encryptor.setProvider(PROVIDER);
encryptor.setAlgorithm(CRYPTO_ALGO);
return encryptor;
}