Class StrongHashCredential
java.lang.Object
com.easydesk.security.credentials.StrongHashCredential
- All Implemented Interfaces:
CredentialService
Deprecated.
this class will be moved to crypto package and modified to
CryptoAlgorithm interface. you can use it throw
CryptoCredential
PBKDF2WithHmacSHA512 algorithm 으로 password 를 hash 하고, hash 결과를 system password 로 암호화하여
저장/검증하는 CredentialService.
저장 형식은 iterations:salt:hash 를 암호화한 문자열이다.
- Version:
- $id: StrongHashCredential.java $Revision$, 01-19-22 10:18:20 PM KST
- Author:
- Youngho Cho
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanauthenticate(User user, String plainTextNewPassword) Deprecated.입력한 password 가 사용자에게 저장된 password 와 일치하는지 검증한다.protected StringgenerateStorngPasswordHash(String plainTextPassword) Deprecated.password 를 임의의 salt 와 반복 횟수로 hash 한 후 system password 로 암호화한다.protected StringDeprecated.주어진 salt 와 반복 횟수로 password 를 hash 한다.voidsetPassword(User user, String plainTextNewPassword) Deprecated.password 를 hash 하고 암호화하여 사용자 object 에 설정한다.protected booleanvalidatePassword(String plainTextPassword, String storedEncodedPassword) Deprecated.입력한 password 가 저장된 password 와 일치하는지 검증한다.
-
Field Details
-
ALGORITHM
Deprecated.password hash algorithm
-
-
Constructor Details
-
StrongHashCredential
public StrongHashCredential()Deprecated.
-
-
Method Details
-
authenticate
public boolean authenticate(User user, String plainTextNewPassword) throws PasswordMismatchException, UnknownEntityException, DataBackendException Deprecated.입력한 password 가 사용자에게 저장된 password 와 일치하는지 검증한다.- Specified by:
authenticatein interfaceCredentialService- Parameters:
user- 대상 사용자plainTextNewPassword- 입력한 password (plain text)- Returns:
- 일치하면
true - Throws:
PasswordMismatchException- 저장된 password 를 복호화하거나 해석할 수 없는 경우UnknownEntityException- 사용자가 존재하지 않는 경우DataBackendException- 저장소 접근 중 오류가 발생한 경우
-
setPassword
Deprecated.password 를 hash 하고 암호화하여 사용자 object 에 설정한다. 저장소에 저장하지는 않는다.- Specified by:
setPasswordin interfaceCredentialService- Parameters:
user- 대상 사용자plainTextNewPassword- 새 password (plain text)- Throws:
DataBackendException- hash 또는 암호화 중 오류가 발생한 경우
-
generateStorngPasswordHash
protected String generateStorngPasswordHash(String plainTextPassword) throws NoSuchAlgorithmException, InvalidKeySpecException, GeneralSecurityException Deprecated.password 를 임의의 salt 와 반복 횟수로 hash 한 후 system password 로 암호화한다.- Parameters:
plainTextPassword- hash 할 password (plain text)- Returns:
- 암호화된
iterations:salt:hash문자열 - Throws:
NoSuchAlgorithmException- hash algorithm 을 사용할 수 없는 경우InvalidKeySpecException- key spec 이 올바르지 않은 경우GeneralSecurityException- 암호화 중 오류가 발생한 경우
-
validatePassword
protected boolean validatePassword(String plainTextPassword, String storedEncodedPassword) throws PasswordMismatchException Deprecated.입력한 password 가 저장된 password 와 일치하는지 검증한다.저장된 값을 복호화하여
iterations:salt:hash를 구하고, 같은 조건으로 입력한 password 의 hash 를 계산하여 일정한 시간에 비교한다.- Parameters:
plainTextPassword- 입력한 password (plain text)storedEncodedPassword- 저장되어 있는 암호화된 password- Returns:
- 일치하면
true - Throws:
PasswordMismatchException- 저장된 password 를 복호화하거나 해석할 수 없는 경우
-
hasing
protected String hasing(int iterations, byte[] salt, String plainTextPassword) throws NoSuchAlgorithmException, InvalidKeySpecException Deprecated.주어진 salt 와 반복 횟수로 password 를 hash 한다. (암호화하지 않는다)- Parameters:
iterations- hash 반복 횟수salt- saltplainTextPassword- hash 할 password (plain text)- Returns:
iterations:salt:hash형식의 문자열- Throws:
NoSuchAlgorithmException- hash algorithm 을 사용할 수 없는 경우InvalidKeySpecException- key spec 이 올바르지 않은 경우
-