From 00a98a229494fb8f9f6e340d77bb9a0f1348c45e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=B0=95=EC=84=B1=EC=98=81?= Date: Tue, 11 Nov 2025 15:17:34 +0900 Subject: [PATCH] =?UTF-8?q?gpki=20yml=20=ED=8C=8C=EC=9D=BC=20=EC=84=A4?= =?UTF-8?q?=EC=A0=95=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- GPKI 설정 분석.md | 88 ++++++++++++++++++++++++++ src/main/resources/application-dev.yml | 16 ++--- src/main/resources/application-prd.yml | 18 +++--- 3 files changed, 105 insertions(+), 17 deletions(-) create mode 100644 GPKI 설정 분석.md diff --git a/GPKI 설정 분석.md b/GPKI 설정 분석.md new file mode 100644 index 0000000..e6d857e --- /dev/null +++ b/GPKI 설정 분석.md @@ -0,0 +1,88 @@ +### GPKI 인증서 경로 설정 분석 결과 + +코드 내부 로직을 분석한 결과, **각 속성의 사용 방식이 다릅니다**: + +--- + +### 📋 경로 설정 규칙 + +#### 1️⃣ **certFilePath** (디렉토리 경로) +- **용도**: LDAP를 사용하지 않을 때 **대상 서버(target server)** 인증서를 읽기 위한 **디렉토리 경로** +- **사용 위치**: `NewGpkiUtil.java` 라인 108 +```java +cert = Disk.readCert(certFilePath + File.separator + certId + ".cer"); +``` +- **조합 방식**: `certFilePath + File.separator + certId + ".cer"` + - 예: `c:\GPKI\Certificate\class1` + `\` + `SVR1611000006` + `.cer` + - 결과: `c:\GPKI\Certificate\class1\SVR1611000006.cer` + +#### 2️⃣ **envCertFilePathName, envPrivateKeyFilePathName, sigCertFilePathName, sigPrivateKeyFilePathName** (전체 경로) +- **용도**: **본인(내 시스템)** 인증서 및 개인키 파일을 읽기 위한 **전체 파일 경로** +- **사용 위치**: `NewGpkiUtil.java` 라인 57-71 +```java +X509Certificate _myEnvCert = Disk.readCert(this.getEnvCertFilePathName()); +PrivateKey _myEnvKey = Disk.readPriKey(this.getEnvPrivateKeyFilePathName(), this.getEnvPrivateKeyPasswd()); +X509Certificate _mySigCert = Disk.readCert(this.getSigCertFilePathName()); +PrivateKey _mySigKey = Disk.readPriKey(this.getSigPrivateKeyFilePathName(), this.getSigPrivateKeyPasswd()); +``` +- **조합 방식**: **직접 사용 (조합하지 않음)** + +--- + +### ✅ 올바른 설정 방법 + +#### **방법 1: 전체 경로로 개별 설정 (현재 설정 - 권장)** +```yaml +vmis: + gpki: + certFilePath: "c:\\GPKI\\Certificate\\class1" # 대상 서버 인증서 디렉토리 + envCertFilePathName: "c:\\GPKI\\Certificate\\class1\\SVR5640020001_env.cer" # 전체 경로 + envPrivateKeyFilePathName: "c:\\GPKI\\Certificate\\class1\\SVR5640020001_env.key" # 전체 경로 + envPrivateKeyPasswd: "*sbm204221" + sigCertFilePathName: "c:\\GPKI\\Certificate\\class1\\SVR5640020001_sig.cer" # 전체 경로 + sigPrivateKeyFilePathName: "c:\\GPKI\\Certificate\\class1\\SVR5640020001_sig.key" # 전체 경로 + sigPrivateKeyPasswd: "*sbm204221" +``` + +#### **방법 2: 파일명만 설정 (동일 디렉토리에 모든 인증서가 있는 경우)** +```yaml +vmis: + gpki: + certFilePath: "c:\\GPKI\\Certificate\\class1" + envCertFilePathName: "SVR5640020001_env.cer" # 파일명만 + envPrivateKeyFilePathName: "SVR5640020001_env.key" # 파일명만 + envPrivateKeyPasswd: "*sbm204221" + sigCertFilePathName: "SVR5640020001_sig.cer" # 파일명만 + sigPrivateKeyFilePathName: "SVR5640020001_sig.key" # 파일명만 + sigPrivateKeyPasswd: "*sbm204221" +``` + +> ⚠️ **주의**: 방법 2는 코드 로직상 **작동하지 않습니다**. `Disk.readCert()`와 `Disk.readPriKey()`는 전체 경로를 요구하므로, 파일명만 제공하면 파일을 찾을 수 없습니다. + +--- + +### 🔍 현재 설정 검증 + +현재 `application-dev.yml`과 `application-prd.yml`의 설정은 **올바릅니다**: + +```yaml +certFilePath: "c:\\GPKI\\Certificate\\class1" # ✅ 디렉토리 경로 +envCertFilePathName: "c:\\GPKI\\Certificate\\class1\\SVR5640020001_env.cer" # ✅ 전체 경로 +envPrivateKeyFilePathName: "c:\\GPKI\\Certificate\\class1\\SVR5640020001_env.key" # ✅ 전체 경로 +sigCertFilePathName: "c:\\GPKI\\Certificate\\class1\\SVR5640020001_sig.cer" # ✅ 전체 경로 +sigPrivateKeyFilePathName: "c:\\GPKI\\Certificate\\class1\\SVR5640020001_sig.key" # ✅ 전체 경로 +``` + +--- + +### 📌 핵심 요약 + +| 속성 | 타입 | 사용 방식 | 예시 | +|------|------|-----------|------| +| `certFilePath` | 디렉토리 경로 | 대상 서버 인증서용 (LDAP 미사용 시) | `c:\GPKI\Certificate\class1` | +| `envCertFilePathName` | **전체 파일 경로** | 직접 사용 (조합 X) | `c:\GPKI\Certificate\class1\SVR5640020001_env.cer` | +| `envPrivateKeyFilePathName` | **전체 파일 경로** | 직접 사용 (조합 X) | `c:\GPKI\Certificate\class1\SVR5640020001_env.key` | +| `sigCertFilePathName` | **전체 파일 경로** | 직접 사용 (조합 X) | `c:\GPKI\Certificate\class1\SVR5640020001_sig.cer` | +| `sigPrivateKeyFilePathName` | **전체 파일 경로** | 직접 사용 (조합 X) | `c:\GPKI\Certificate\class1\SVR5640020001_sig.key` | + +**결론**: 현재 설정처럼 **모든 인증서/키 파일 경로를 전체 경로로 설정**하는 것이 정확합니다. `certFilePath`만 디렉토리 경로로 사용되며, 나머지는 전체 파일 경로입니다. \ No newline at end of file diff --git a/src/main/resources/application-dev.yml b/src/main/resources/application-dev.yml index 3b2de65..e93ed50 100644 --- a/src/main/resources/application-dev.yml +++ b/src/main/resources/application-dev.yml @@ -61,7 +61,7 @@ vmis: system: infoSysId: "41-345" # 정보시스템 ID infoSysIp: "105.19.10.135" # 정보시스템 IP 주소 - sigunguCode: "41460" # 시군구 코드 (화성시) + sigunguCode: "41460" # 시군구 코드 (경기도 용인시) departmentCode: "" # 부서 코드 chargerId: "" # 담당자 ID chargerIp: "" # 담당자 IP 주소 @@ -71,15 +71,15 @@ vmis: useSign: true # 서명 사용 여부 charset: "UTF-8" # 문자셋 인코딩 certServerId: "SVR5640020001" # 인증서 서버 ID (요청 시스템) - targetServerId: "SVR1500000015" # 대상 서버 ID (차세대교통안전공단) + targetServerId: "SVR1611000006" # 대상 서버 ID (차세대교통안전공단) ldap: true # LDAP 사용 여부 - gpkiLicPath: "src/GPKI/conf" # GPKI 라이선스 파일 경로 - certFilePath: "src/GPKI/certs" # 인증서 파일 디렉토리 경로 - envCertFilePathName: "src/GPKI/certs/SVR5640020001_env.cer" # 암호화용 인증서 파일 경로 - envPrivateKeyFilePathName: "src/GPKI/certs/SVR5640020001_env.key" # 암호화용 개인키 파일 경로 + gpkiLicPath: "C:\\GPKI\\Lic" # GPKI 라이선스 파일 경로 + certFilePath: "c:\\GPKI\\Certificate\\class1" # 인증서 파일 디렉토리 경로 + envCertFilePathName: "c:\\GPKI\\Certificate\\class1\\SVR5640020001_env.cer" # 암호화용 인증서 파일 경로 + envPrivateKeyFilePathName: "c:\\GPKI\\Certificate\\class1\\SVR5640020001_env.key" # 암호화용 개인키 파일 경로 envPrivateKeyPasswd: "*sbm204221" # 암호화용 개인키 비밀번호 - sigCertFilePathName: "src/GPKI/certs/SVR5640020001_sig.cer" # 서명용 인증서 파일 경로 - sigPrivateKeyFilePathName: "src/GPKI/certs/SVR5640020001_sig.key" # 서명용 개인키 파일 경로 + sigCertFilePathName: "c:\\GPKI\\Certificate\\class1\\SVR5640020001_sig.cer" # 서명용 인증서 파일 경로 + sigPrivateKeyFilePathName: "c:\\GPKI\\Certificate\\class1\\SVR5640020001_sig.key" # 서명용 개인키 파일 경로 sigPrivateKeyPasswd: "*sbm204221" # 서명용 개인키 비밀번호 gov: scheme: "http" # 프로토콜 (http/https) diff --git a/src/main/resources/application-prd.yml b/src/main/resources/application-prd.yml index c833027..5ce50fb 100644 --- a/src/main/resources/application-prd.yml +++ b/src/main/resources/application-prd.yml @@ -62,7 +62,7 @@ vmis: system: infoSysId: "41-345" # 정보시스템 ID infoSysIp: "105.19.10.135" # 정보시스템 IP 주소 - sigunguCode: "41460" # 시군구 코드 (화성시) + sigunguCode: "41460" # 시군구 코드 (경기도 용인시) departmentCode: "" # 부서 코드 chargerId: "" # 담당자 ID chargerIp: "" # 담당자 IP 주소 @@ -71,16 +71,16 @@ vmis: enabled: "Y" # GPKI 사용 여부 (운영환경에서는 활성화) useSign: true # 서명 사용 여부 charset: "UTF-8" # 문자셋 인코딩 - certServerId: "SVR5640020001" # 인증서 서버 ID (요청 시스템) - 운영 인증서 ID로 교체 - targetServerId: "SVR1500000015" # 대상 서버 ID (차세대교통안전공단) + certServerId: "SVR5640020001" # 인증서 서버 ID (요청 시스템) + targetServerId: "SVR1611000006" # 대상 서버 ID (차세대교통안전공단) ldap: true # LDAP 사용 여부 - gpkiLicPath: "src/GPKI/conf" # GPKI 라이선스 파일 경로 - certFilePath: "src/GPKI/certs" # 인증서 파일 디렉토리 경로 - envCertFilePathName: "src/GPKI/certs/SVR5640020001_env.cer" # 암호화용 인증서 파일 경로 - envPrivateKeyFilePathName: "src/GPKI/certs/SVR5640020001_env.key" # 암호화용 개인키 파일 경로 + gpkiLicPath: "C:\\GPKI\\Lic" # GPKI 라이선스 파일 경로 + certFilePath: "c:\\GPKI\\Certificate\\class1" # 인증서 파일 디렉토리 경로 + envCertFilePathName: "c:\\GPKI\\Certificate\\class1\\SVR5640020001_env.cer" # 암호화용 인증서 파일 경로 + envPrivateKeyFilePathName: "c:\\GPKI\\Certificate\\class1\\SVR5640020001_env.key" # 암호화용 개인키 파일 경로 envPrivateKeyPasswd: "*sbm204221" # 암호화용 개인키 비밀번호 - sigCertFilePathName: "src/GPKI/certs/SVR5640020001_sig.cer" # 서명용 인증서 파일 경로 - sigPrivateKeyFilePathName: "src/GPKI/certs/SVR5640020001_sig.key" # 서명용 개인키 파일 경로 + sigCertFilePathName: "c:\\GPKI\\Certificate\\class1\\SVR5640020001_sig.cer" # 서명용 인증서 파일 경로 + sigPrivateKeyFilePathName: "c:\\GPKI\\Certificate\\class1\\SVR5640020001_sig.key" # 서명용 개인키 파일 경로 sigPrivateKeyPasswd: "*sbm204221" # 서명용 개인키 비밀번호 gov: scheme: "http" # 프로토콜 (http/https)