diff --git a/src/main/java/cokr/xit/base/crypto/Cryptography.java b/src/main/java/cokr/xit/base/crypto/Cryptography.java index c223ce8..7569017 100644 --- a/src/main/java/cokr/xit/base/crypto/Cryptography.java +++ b/src/main/java/cokr/xit/base/crypto/Cryptography.java @@ -19,6 +19,15 @@ import cokr.xit.foundation.data.JSON; * @author mjkhan */ public abstract class Cryptography extends AbstractComponent { + /**설정파일(xit-crypto.conf)에서 지정한 이름의 설정을 읽어 Cryptography를 반환한다. + * @param name 설정 이름 + * @return Cryptography + */ + public static Cryptography get(String name) { + CryptoDef def = Config.conf.getCryptoDef(name); + return def.newCrypto(); + } + /** 암복호화 설정정보 */ protected CryptoDef def; protected String charset; diff --git a/src/test/java/cokr/xit/base/crypto/CryptographyTest.java b/src/test/java/cokr/xit/base/crypto/CryptographyTest.java index 4487d53..68ee18b 100644 --- a/src/test/java/cokr/xit/base/crypto/CryptographyTest.java +++ b/src/test/java/cokr/xit/base/crypto/CryptographyTest.java @@ -7,10 +7,8 @@ import org.apache.commons.beanutils.PropertyUtils; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; -import cokr.xit.base.crypto.bean.ARIA; import cokr.xit.base.crypto.bean.DGuard; import cokr.xit.base.crypto.bean.Echelon; -import cokr.xit.base.crypto.bean.XitAria; public class CryptographyTest /* extends TestSupport */ { private String @@ -37,7 +35,7 @@ public class CryptographyTest /* extends TestSupport */ { @Test void aria() { String name = "aria"; - Cryptography aria = new ARIA(name); + Cryptography aria = Cryptography.get(name); Assertions.assertEquals(name, aria.name()); String encrypted = aria.encrypt(text), @@ -54,7 +52,7 @@ public class CryptographyTest /* extends TestSupport */ { @Test void xitAria() { String name = "xit-aria"; - Cryptography aria = new XitAria(name); + Cryptography aria = Cryptography.get(name); String str = "7011102177320", encrypted = aria.encrypt(str),