Class StrongHashCredential

java.lang.Object
com.easydesk.security.credentials.StrongHashCredential
All Implemented Interfaces:
CredentialService

@Component public class StrongHashCredential extends Object implements 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
    Modifier and Type
    Field
    Description
    protected static String
    Deprecated.
    password hash algorithm
  • Constructor Summary

    Constructors
    Constructor
    Description
    Deprecated.
     
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    authenticate(User user, String plainTextNewPassword)
    Deprecated.
    입력한 password 가 사용자에게 저장된 password 와 일치하는지 검증한다.
    protected String
    Deprecated.
    password 를 임의의 salt 와 반복 횟수로 hash 한 후 system password 로 암호화한다.
    protected String
    hasing(int iterations, byte[] salt, String plainTextPassword)
    Deprecated.
    주어진 salt 와 반복 횟수로 password 를 hash 한다.
    void
    setPassword(User user, String plainTextNewPassword)
    Deprecated.
    password 를 hash 하고 암호화하여 사용자 object 에 설정한다.
    protected boolean
    validatePassword(String plainTextPassword, String storedEncodedPassword)
    Deprecated.
    입력한 password 가 저장된 password 와 일치하는지 검증한다.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • ALGORITHM

      protected static String 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:
      authenticate in interface CredentialService
      Parameters:
      user - 대상 사용자
      plainTextNewPassword - 입력한 password (plain text)
      Returns:
      일치하면 true
      Throws:
      PasswordMismatchException - 저장된 password 를 복호화하거나 해석할 수 없는 경우
      UnknownEntityException - 사용자가 존재하지 않는 경우
      DataBackendException - 저장소 접근 중 오류가 발생한 경우
    • setPassword

      public void setPassword(User user, String plainTextNewPassword) throws DataBackendException
      Deprecated.
      password 를 hash 하고 암호화하여 사용자 object 에 설정한다. 저장소에 저장하지는 않는다.
      Specified by:
      setPassword in interface CredentialService
      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 - salt
      plainTextPassword - hash 할 password (plain text)
      Returns:
      iterations:salt:hash 형식의 문자열
      Throws:
      NoSuchAlgorithmException - hash algorithm 을 사용할 수 없는 경우
      InvalidKeySpecException - key spec 이 올바르지 않은 경우