当前位置: 首页>>代码示例>>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;未经允许,请勿转载。