本文整理汇总了Java中org.springframework.security.crypto.keygen.BytesKeyGenerator类的典型用法代码示例。如果您正苦于以下问题:Java BytesKeyGenerator类的具体用法?Java BytesKeyGenerator怎么用?Java BytesKeyGenerator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
BytesKeyGenerator类属于org.springframework.security.crypto.keygen包,在下文中一共展示了BytesKeyGenerator类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: AndroidAesBytesEncryptor
import org.springframework.security.crypto.keygen.BytesKeyGenerator; //导入依赖的package包/类
public AndroidAesBytesEncryptor(String password, CharSequence salt, BytesKeyGenerator ivGenerator) {
PBEKeySpec keySpec = new PBEKeySpec(password.toCharArray(), Hex.decode(salt), 1024, 256);
SecretKey secretKey = newSecretKey("PBEWITHSHA256AND256BITAES-CBC-BC", keySpec);
this.secretKey = new SecretKeySpec(secretKey.getEncoded(), "AES");
encryptor = newCipher(AES_ALGORITHM);
decryptor = newCipher(AES_ALGORITHM);
this.ivGenerator = ivGenerator;
}
开发者ID:bestarandyan,项目名称:ShoppingMall,代码行数:9,代码来源:AndroidAesBytesEncryptor.java
示例2: Base64StringKeyGenerator
import org.springframework.security.crypto.keygen.BytesKeyGenerator; //导入依赖的package包/类
public Base64StringKeyGenerator(BytesKeyGenerator keyGenerator) {
this.keyGenerator = keyGenerator;
}
开发者ID:suomenriistakeskus,项目名称:oma-riista-web,代码行数:4,代码来源:Base64StringKeyGenerator.java
示例3: secureRandom
import org.springframework.security.crypto.keygen.BytesKeyGenerator; //导入依赖的package包/类
/**
* Create a {@link BytesKeyGenerator} that uses a {@link SecureRandom} to generate keys of 8 bytes in length.
*/
public static BytesKeyGenerator secureRandom() {
return new AndroidSecureRandomBytesKeyGenerator();
}
开发者ID:bestarandyan,项目名称:ShoppingMall,代码行数:7,代码来源:AndroidKeyGenerators.java
示例4: passwordEncoder
import org.springframework.security.crypto.keygen.BytesKeyGenerator; //导入依赖的package包/类
@Bean
public PasswordEncoder passwordEncoder() {
BytesKeyGenerator keyGenerator = KeyGenerators.secureRandom();
SecureRandom random = new SecureRandom(keyGenerator.generateKey());
return new BCryptPasswordEncoder(10, random);
}
开发者ID:vardis,项目名称:angularJavaAuthToken,代码行数:7,代码来源:SecurityConfig.java
示例5: shared
import org.springframework.security.crypto.keygen.BytesKeyGenerator; //导入依赖的package包/类
/**
* Create a {@link BytesKeyGenerator} that returns a single, shared {@link SecureRandom} key of a custom length.
* @param keyLength the key length in bytes, e.g. 16, for a 16 byte key.
*/
public static BytesKeyGenerator shared(int keyLength) {
return new SharedKeyGenerator(secureRandom(16).generateKey());
}
开发者ID:bestarandyan,项目名称:ShoppingMall,代码行数:8,代码来源:AndroidKeyGenerators.java
注:本文中的org.springframework.security.crypto.keygen.BytesKeyGenerator类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论