Skip to content

Commit

Permalink
공개키 SDK 에 포함 / 의존성 최신화
Browse files Browse the repository at this point in the history
  • Loading branch information
kaifer committed Apr 15, 2022
1 parent 56bc2a2 commit c932899
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 16 deletions.
8 changes: 4 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ plugins {
}

group 'com.github.toss'
version '0.0.1'
version '0.0.2'

sourceCompatibility = JavaVersion.VERSION_1_7
targetCompatibility = JavaVersion.VERSION_1_7
Expand All @@ -23,9 +23,9 @@ repositories {
}

dependencies {
implementation 'commons-codec:commons-codec:1.9'
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.1'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.8.1'
implementation 'commons-codec:commons-codec:1.15'
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.2'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.8.2'

}

Expand Down
5 changes: 5 additions & 0 deletions src/main/java/im/toss/cert/sdk/TossCertSessionGenerator.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,14 @@

public class TossCertSessionGenerator {
private final static String version = "v1";
private final static String publicKey = "MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAoVdxG0Qi9pip46Jw9ImSlPVD8+L2mM47ey6EZna7D7utgNdh8Tzkjrm1Yl4h6kPJrhdWvMIJGS51+6dh041IXcJEoUquNblUEqAUXBYwQM8PdfnS12SjlvZrP4q6whBE7IV1SEIBJP0gSK5/8Iu+uld2ctJiU4p8uswL2bCPGWdvVPltxAg6hfAG/ImRUKPRewQsFhkFvqIDCpO6aeaR10q6wwENZltlJeeRnl02VWSneRmPqqypqCxz0Y+yWCYtsA+ngfZmwRMaFkXcWjaWnvSqqV33OAsrQkvuBHWoEEkvQ0P08+h9Fy2+FhY9TeuukQ2CVFz5YyOhp25QtWyQI+IaDKk+hLxJ1APR0c3tmV0ANEIjO6HhJIdu2KQKtgFppvqSrZp2OKtI8EZgVbWuho50xvlaPGzWoMi9HSCb+8ARamlOpesxHH3O0cTRUnft2Zk1FHQb2Pidb2z5onMEnzP2xpTqAIVQyb6nMac9tof5NFxwR/c4pmci+1n8GFJIFN18j2XGad1mNyio/R8LabqnzNwJC6VPnZJz5/pDUIk9yKNOY0KJe64SRiL0a4SNMohtyj6QlA/3SGxaEXb8UHpophv4G9wN1CgfyUamsRqp8zo5qDxBvlaIlfkqJvYPkltj7/23FHDjPi8q8UkSiAeu7IV5FTfB5KsiN8+sGSMCAwEAAQ==";

private final RSACipher rsaCipher;

public TossCertSessionGenerator() {
this(publicKey);
}

public TossCertSessionGenerator(String publicKeyString) {
try {
this.rsaCipher = new RSACipher(publicKeyString);
Expand Down
15 changes: 3 additions & 12 deletions src/test/java/im/toss/cert/sdk/TossCertSessionTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,8 @@
class TossCertSessionTest {
@Test
public void test() {
// 0. 사전에 전달받은 RSA 공개키 입니다.
String publicKeyString = "MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAoNsnNuQYnGR2v3XSJc2VNxYSBsykuSLJiOeSbWBSEmNG7Fm48rpzZ5bS2diRjHL55ZWBmtJ2k2WqIcHAQS8VnzhFM+bawDwfk6O8xT6hUr+C6ELENWlk2cJchAuGs5HU5bORorIqU+zuhV3kCj7XcZTIYJepWvK2OoIHORH6YkuISpuQUn1ekY11Da/wiZDdLaz7HhKFmkXdV81C13MnsCj8+81akZSupB2QNBbIW3KOVVlfB9zK+3uFoZCqn68C1iZB0u0BCNFF3/N3mNN3tXTmCtSBD+W8+yxowYM4t9ifX19m6sV1mzrGq0/wsXR5jbizAFe79vONuSS7GnG05SO+ZQe/zg9vh3upuQ9P/nmMvRzpTzXJJ9IliNQCboSpIOsbi5IcNqi1G8EVeKNd3IcK3Z5v8nvEpRqn5vD1MU3FNshrHRPxBNZfz3/6NWjlS+af01Q2Y1NYRtuGJNtIUXjHeexkVZycgI7feXs3XtG+yjJU6Z1SnXj5HJbMneCiQbg/aTMsHG57m8+t5QdA+Zx1Gkz3uxpl92/qzZIWV7JwXbR0l2GmSM8I397zT8e2rlIWmQ8XUESjXdmWWBMR2Oqri8drfzHzvfVG5W2D8lcmyHW2yLJ/JBQNK1CJH+NAwJaOmK5sQK8sSLtp8axcveKN+3Dn1kWDrJqk5O90CfUCAwEAAQ==";

// 1. 세션 생성기를 사전에 생성해 주세요.
TossCertSessionGenerator tossCertSessionGenerator = new TossCertSessionGenerator(publicKeyString);
TossCertSessionGenerator tossCertSessionGenerator = new TossCertSessionGenerator();

// 2. 인증 요청(개인정보가 포함된 경우) API 호출 전에, 세션을 생성해 주세요.
TossCertSession tossCertSession = tossCertSessionGenerator.generate();
Expand All @@ -36,11 +33,8 @@ public void test() {

@Test
public void cbcTest() {
// 0. 사전에 전달받은 RSA 공개키 입니다.
String publicKeyString = "MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAoNsnNuQYnGR2v3XSJc2VNxYSBsykuSLJiOeSbWBSEmNG7Fm48rpzZ5bS2diRjHL55ZWBmtJ2k2WqIcHAQS8VnzhFM+bawDwfk6O8xT6hUr+C6ELENWlk2cJchAuGs5HU5bORorIqU+zuhV3kCj7XcZTIYJepWvK2OoIHORH6YkuISpuQUn1ekY11Da/wiZDdLaz7HhKFmkXdV81C13MnsCj8+81akZSupB2QNBbIW3KOVVlfB9zK+3uFoZCqn68C1iZB0u0BCNFF3/N3mNN3tXTmCtSBD+W8+yxowYM4t9ifX19m6sV1mzrGq0/wsXR5jbizAFe79vONuSS7GnG05SO+ZQe/zg9vh3upuQ9P/nmMvRzpTzXJJ9IliNQCboSpIOsbi5IcNqi1G8EVeKNd3IcK3Z5v8nvEpRqn5vD1MU3FNshrHRPxBNZfz3/6NWjlS+af01Q2Y1NYRtuGJNtIUXjHeexkVZycgI7feXs3XtG+yjJU6Z1SnXj5HJbMneCiQbg/aTMsHG57m8+t5QdA+Zx1Gkz3uxpl92/qzZIWV7JwXbR0l2GmSM8I397zT8e2rlIWmQ8XUESjXdmWWBMR2Oqri8drfzHzvfVG5W2D8lcmyHW2yLJ/JBQNK1CJH+NAwJaOmK5sQK8sSLtp8axcveKN+3Dn1kWDrJqk5O90CfUCAwEAAQ==";

// 1. 세션 생성기를 사전에 생성해 주세요.
TossCertSessionGenerator tossCertSessionGenerator = new TossCertSessionGenerator(publicKeyString);
TossCertSessionGenerator tossCertSessionGenerator = new TossCertSessionGenerator();

// 2. 인증 요청(개인정보가 포함된 경우) API 호출 전에, 세션을 생성해 주세요.
TossCertSession tossCertSession = tossCertSessionGenerator.generate(AESAlgorithm.AES_CBC);
Expand All @@ -66,11 +60,8 @@ public void cbcTest() {

@Test
public void deserializeTest() {
// 0. 사전에 전달받은 RSA 공개키 입니다.
String publicKeyString = "MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAoNsnNuQYnGR2v3XSJc2VNxYSBsykuSLJiOeSbWBSEmNG7Fm48rpzZ5bS2diRjHL55ZWBmtJ2k2WqIcHAQS8VnzhFM+bawDwfk6O8xT6hUr+C6ELENWlk2cJchAuGs5HU5bORorIqU+zuhV3kCj7XcZTIYJepWvK2OoIHORH6YkuISpuQUn1ekY11Da/wiZDdLaz7HhKFmkXdV81C13MnsCj8+81akZSupB2QNBbIW3KOVVlfB9zK+3uFoZCqn68C1iZB0u0BCNFF3/N3mNN3tXTmCtSBD+W8+yxowYM4t9ifX19m6sV1mzrGq0/wsXR5jbizAFe79vONuSS7GnG05SO+ZQe/zg9vh3upuQ9P/nmMvRzpTzXJJ9IliNQCboSpIOsbi5IcNqi1G8EVeKNd3IcK3Z5v8nvEpRqn5vD1MU3FNshrHRPxBNZfz3/6NWjlS+af01Q2Y1NYRtuGJNtIUXjHeexkVZycgI7feXs3XtG+yjJU6Z1SnXj5HJbMneCiQbg/aTMsHG57m8+t5QdA+Zx1Gkz3uxpl92/qzZIWV7JwXbR0l2GmSM8I397zT8e2rlIWmQ8XUESjXdmWWBMR2Oqri8drfzHzvfVG5W2D8lcmyHW2yLJ/JBQNK1CJH+NAwJaOmK5sQK8sSLtp8axcveKN+3Dn1kWDrJqk5O90CfUCAwEAAQ==";

// 1. 세션 생성기를 사전에 생성해 주세요.
TossCertSessionGenerator tossCertSessionGenerator = new TossCertSessionGenerator(publicKeyString);
TossCertSessionGenerator tossCertSessionGenerator = new TossCertSessionGenerator();

TossCertSession tossCertSession = tossCertSessionGenerator.generate();

Expand Down

0 comments on commit c932899

Please sign in to comment.