當前位置: 首頁>>代碼示例>>Java>>正文


Java StandardPBEStringEncryptor.setKeyObtentionIterations方法代碼示例

本文整理匯總了Java中org.jasypt.encryption.pbe.StandardPBEStringEncryptor.setKeyObtentionIterations方法的典型用法代碼示例。如果您正苦於以下問題:Java StandardPBEStringEncryptor.setKeyObtentionIterations方法的具體用法?Java StandardPBEStringEncryptor.setKeyObtentionIterations怎麽用?Java StandardPBEStringEncryptor.setKeyObtentionIterations使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.jasypt.encryption.pbe.StandardPBEStringEncryptor的用法示例。


在下文中一共展示了StandardPBEStringEncryptor.setKeyObtentionIterations方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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);
}
 
開發者ID:alfameCom,項目名稱:salasanasiilo,代碼行數:20,代碼來源:JasyptBCAESEncryptionTest.java

示例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;
}
 
開發者ID:solita,項目名稱:kansalaisaloite,代碼行數:9,代碼來源:EncryptablePropertiesConfigurer.java

示例3: encryptToHexadecimalString

import org.jasypt.encryption.pbe.StandardPBEStringEncryptor; //導入方法依賴的package包/類
/**
 * Encrypt a Message Text to a Hexadecimal String usable for a WEB Url.
 *
 * @param message to be encrypted
 * @return String of a Encrypted Hexadecimal String
 */
public static String encryptToHexadecimalString(String message) {
    initializeDefaultCryptographyProvider();
    StandardPBEStringEncryptor encryptor = new StandardPBEStringEncryptor();
    encryptor.setPassword(SALT_PW);
    encryptor.setAlgorithm(BC_ALGORITHM_NAME_PBE_MD5_TRIPLE_DES);
    encryptor.setKeyObtentionIterations(KEY_OBTENTION_ITERATIONS);
    encryptor.setStringOutputType(STRING_OUTPUT_TYPE_HEXADECIMAL);
    return encryptor.encrypt(message);
}
 
開發者ID:jaschenk,項目名稱:jeffaschenk-commons,代碼行數:16,代碼來源:SecurityServiceProviderUtility.java

示例4: decryptFromHexadecimalString

import org.jasypt.encryption.pbe.StandardPBEStringEncryptor; //導入方法依賴的package包/類
/**
 * Decrypt a Message Test from a Hexadecimal String.
 *
 * @param encryptedHexadecimalMessage hexadecimal message string to be decrypted
 * @return String of decrypted String.
 */
public static String decryptFromHexadecimalString(String encryptedHexadecimalMessage) {
    initializeDefaultCryptographyProvider();
    StandardPBEStringEncryptor encryptor = new StandardPBEStringEncryptor();
    encryptor.setPassword(SALT_PW);
    encryptor.setAlgorithm(BC_ALGORITHM_NAME_PBE_MD5_TRIPLE_DES);
    encryptor.setKeyObtentionIterations(KEY_OBTENTION_ITERATIONS);
    encryptor.setStringOutputType(STRING_OUTPUT_TYPE_HEXADECIMAL);
    return encryptor.decrypt(encryptedHexadecimalMessage);
}
 
開發者ID:jaschenk,項目名稱:jeffaschenk-commons,代碼行數:16,代碼來源:SecurityServiceProviderUtility.java

示例5: stringEncryptor

import org.jasypt.encryption.pbe.StandardPBEStringEncryptor; //導入方法依賴的package包/類
@Bean
PBEStringEncryptor stringEncryptor(String encryptionKey) {
    StandardPBEStringEncryptor encryptor = new StandardPBEStringEncryptor();
    encryptor.setAlgorithm("PBEWithMD5AndDES");
    encryptor.setKeyObtentionIterations(1000);
    encryptor.setPassword(encryptionKey);

    HibernatePBEEncryptorRegistry.getInstance().registerPBEStringEncryptor("basicStringEncryptor", encryptor);

    return encryptor;
}
 
開發者ID:pivotalsoftware,項目名稱:github-cla-integration,代碼行數:12,代碼來源:RepositoryConfiguration.java


注:本文中的org.jasypt.encryption.pbe.StandardPBEStringEncryptor.setKeyObtentionIterations方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。