ARIA: hashedPassword 설정 추가

master
mjkhan21 10 months ago
parent c5b72e1160
commit c3ab91c47c

@ -13,6 +13,7 @@ import cokr.xit.base.crypto.Cryptography;
public class ARIA extends Cryptography {
private String
key,
hashedPassword,
algorithm;
private int blockSize;
@ -39,6 +40,21 @@ public class ARIA extends Cryptography {
return this;
}
/** .
* @return
*/
public String getHashedPassword() {
return hashedPassword;
}
/** .
* @param hashedPassword
*/
public ARIA setHashedPassword(String hashedPassword) {
this.hashedPassword = hashedPassword;
return this;
}
/** . SHA-256.
* @return
*/
@ -71,17 +87,20 @@ public class ARIA extends Cryptography {
return this;
}
public byte[] encrypt(byte[] plain) {
return service().encrypt(plain, key);
}
@Override
protected String doEncrypt(String plain) {
byte[] bytes = service().encrypt(plain.getBytes(), key);
byte[] bytes = encrypt(plain.getBytes());
return Base64.getEncoder().encodeToString(bytes);
}
private EgovPasswordEncoder passwordEncoder() {
if (passwordEncoder == null) {
passwordEncoder = new EgovPasswordEncoder();
String hashed = passwordEncoder.encryptPassword(getKey());
passwordEncoder.setHashedPassword(hashed);
passwordEncoder.setHashedPassword(ifEmpty(hashedPassword, hashedPassword = passwordEncoder.encryptPassword(getKey())));
passwordEncoder.setAlgorithm(getAlgorithm());
}
return passwordEncoder;
@ -96,10 +115,14 @@ public class ARIA extends Cryptography {
return aria;
}
public byte[] decrypt(byte[] encrypted) {
return service().decrypt(encrypted, key);
}
@Override
protected String doDecrypt(String encrypted) {
byte[] bytes = Base64.getDecoder().decode(encrypted);
return new String(service().decrypt(bytes, key));
return new String(decrypt(bytes));
}
/** .

@ -4,6 +4,7 @@
"class": "cokr.xit.base.crypto.bean.ARIA",
"settings": {
"key": "Copyright (c) 2015 - (주)엑스아이티",
// "hashedPassword": "", // 지정하지 않으면 key로 생성
"algorithm": "SHA-256",
"blockSize": 1024
}

Loading…
Cancel
Save