PeterL355
PeterL355

Reputation: 87

How to implement Shiro2CryptFormat in Shiro 2

Does anyone has the solution how to implement Shiro2CryptFormat in encrypting? Below codes are from V 1. I just upgraded from Shiro V 1 to 2.0.1. And prefers to use the new Argon2. When changing from Shiro1CryptFormat to Shiro2CryptFormat, it reported as java.lang.UnsupportedOperationException: Shiro2CryptFormat.

final DefaultPasswordService dfPS = new DefaultPasswordService();
((DefaultHashService) dfPS.getHashService()).setDefaultAlgorithmName(SHA_256); 
dfPS.setHashFormat(new Shiro1CryptFormat()); 
return dfPS.encryptPassword(plaintextPWD));

Upvotes: 0

Views: 36

Answers (0)

Related Questions