You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
VMIS-interface/GPKI 설정 분석.md

88 lines
4.4 KiB
Markdown

This file contains invisible Unicode characters!

This file contains invisible Unicode characters that may be processed differently from what appears below. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to reveal hidden characters.

### 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`만 디렉토리 경로로 사용되며, 나머지는 전체 파일 경로입니다.