

기계 번역으로 제공되는 번역입니다. 제공된 번역과 원본 영어의 내용이 상충하는 경우에는 영어 버전이 우선합니다.

# AWS CloudHSM 키를 인증서와 연결
<a name="ksp-library-associate-key-certificate"></a>

Microsoft의 [SignTool](https://docs.microsoft.com/en-us/windows/win32/seccrypto/signtool)과 같은 타사 도구와 함께 AWS CloudHSM 키를 사용하려면 먼저 키의 메타데이터를 로컬 인증서 스토어로 가져오고 메타데이터를 인증서와 연결해야 합니다. 키의 메타데이터를 가져오려면 CloudHSM 버전 3.0 이상에 포함된 import\$1key.exe 유틸리티를 사용합니다. 다음 단계에서는 추가 정보와 샘플 출력을 제공합니다.

## 1단계: 인증서 가져오기
<a name="import-cert"></a>

Windows에서는 인증서를 두 번 클릭하여 로컬 인증서 스토어로 가져올 수 있습니다.

그러나 두 번 클릭해도 작동하지 않는다면 [Microsoft Certreq 도구](https://docs.microsoft.com/en-us/previous-versions/windows/it-pro/windows-server-2012-R2-and-2012/dn296456%28v%3dws.11%29)를 사용하여 인증서를 Certificate Manager로 가져옵니다. 예제: 

```
certreq -accept <certificatename>
```

이 작업이 실패하고 `Key not found` 오류가 표시되는 경우 2단계를 진행합니다. 인증서가 키 스토어에 나타나면 작업이 완료된 것이므로 추가 작업이 필요하지 않습니다.

## 2단계: 인증서 식별 정보 수집
<a name="cert-identifier"></a>

이전 단계가 성공하지 못한 경우 프라이빗 키를 인증서와 연결해야 합니다. 그러나 연결을 생성하려면 먼저 인증서의 고유 컨테이너 이름 및 일련번호를 찾아야 합니다. 필요한 인증서 정보를 표시하려면 **certutil**과 같은 유틸리티를 사용합니다. **certutil**의 다음 샘플 출력은 컨테이너 이름과 일련 번호를 보여줍니다.

```
================ Certificate 1 ================ Serial Number:
			72000000047f7f7a9d41851b4e000000000004Issuer: CN=Enterprise-CANotBefore: 10/8/2019 11:50
			AM NotAfter: 11/8/2020 12:00 PMSubject: CN=www.example.com, OU=Certificate Management,
			O=Information Technology, L=Seattle, S=Washington, C=USNon-root CertificateCert
			Hash(sha1): 7f d8 5c 00 27 bf 37 74 3d 71 5b 54 4e c0 94 20 45 75 bc 65No key provider
			information Simple container name: CertReq-39c04db0-6aa9-4310-93db-db0d9669f42c Unique
			container name: CertReq-39c04db0-6aa9-4310-93db-db0d9669f42c
```



## 3단계: AWS CloudHSM 프라이빗 키를 인증서와 연결
<a name="associate-key-certificate"></a>

키를 인증서와 연결하려면 먼저 [AWS CloudHSM 클라이언트 데몬을 시작해야](key_mgmt_util-setup.md#key_mgmt_util-start-cloudhsm-client) 합니다. 그런 다음 import\$1key.exe(CloudHSM 버전 3.0 이상에 포함되어 있음)를 사용하여 프라이빗 키를 인증서와 연결합니다. 인증서를 지정할 때 간단한 컨테이너 이름을 사용하십시오. 다음 예제에서는 명령과 응답을 보여줍니다. 이 작업은 키의 메타데이터만 복사하므로 키는 HSM에 남아 있습니다.

```
$> import_key.exe –RSA CertReq-39c04db0-6aa9-4310-93db-db0d9669f42c

Successfully opened Microsoft Software Key Storage Provider : 0NCryptOpenKey failed : 80090016
```

## 4단계: 인증서 스토어 업데이트
<a name="update-certificate-store"></a>

 AWS CloudHSM 클라이언트 데몬이 여전히 실행 중인지 확인합니다. 그런 다음 **certutil** 동사, **-repairstore**를 사용하여 인증서 일련 번호를 업데이트합니다. 다음 샘플은 명령 및 출력을 보여줍니다. [**-repairstore** 동사](https://docs.microsoft.com/en-us/previous-versions/windows/it-pro/windows-server-2012-R2-and-2012/cc732443(v=ws.11)?redirectedfrom=MSDN#-repairstore)에 대한 자세한 내용은 Microsoft 설명서를 참조하십시오.

```
C:\Program Files\Amazon\CloudHSM>certutil -f -csp "Cavium Key Storage Provider"-repairstore my "72000000047f7f7a9d41851b4e000000000004"
my "Personal"
================ Certificate 1 ================
Serial Number: 72000000047f7f7a9d41851b4e000000000004
Issuer: CN=Enterprise-CA
NotBefore: 10/8/2019 11:50 AM
NotAfter: 11/8/2020 12:00 PM
Subject: CN=www.example.com, OU=Certificate Management, O=Information Technology, L=Seattle, S=Washington, C=US
Non-root CertificateCert Hash(sha1): 7f d8 5c 00 27 bf 37 74 3d 71 5b 54 4e c0 94 20 45 75 bc 65       
SDK Version: 3.0 
Key Container = CertReq-39c04db0-6aa9-4310-93db-db0d9669f42c 
Provider = "Cavium Key Storage Provider"
Private key is NOT exportableEncryption test passedCertUtil: -repairstore command completed successfully.
```

인증서 일련 번호를 업데이트한 후이 인증서와 해당 AWS CloudHSM 프라이빗 키를 Windows의 타사 서명 도구와 함께 사용할 수 있습니다.