이 절차는 PEM 또는 원시 DER로 인코딩된 PKI 정보가 담긴 파일을 키 저장소로 가져오는 방법을 설명합니다. 내보내기 절차는 Example 4–4를 참조하십시오.
% pktool import keystore=keystore infile=infile-name label=label-name
PKCS #12 형식의 내보내기 파일과 같은 개인 PKI 정보를 가져오는 경우 파일에 암호가 필요합니다. 가져오기 중인 파일의 작성자가 사용자에게 PKCS #12 암호를 알려줍니다.
Enter password to use for accessing the PKCS12 file:Type PKCS #12 password
Enter pin for Sun Software PKCS#11 softtoken: Type PIN for token
% pktool list Found number certificates. 1. (X.509 certificate) Label: label-name ID: fingerprint that binds certificate to private key Subject: subject-DN Issuer: distinguished-name Serial: hex-serial-number 2. ...
다음 예에서 사용자가 PKCS #12 파일을 타사로부터 가져옵니다. pktool import 명령은 gracedata.p12 파일에서 개인 키 및 인증서를 추출하여 사용자의 선호 키 저장소에 저장합니다.
% pktool import keystore=pkcs11 infile=gracedata.p12 label=GraceCert Enter password to use for accessing the PKCS12 file:Type PKCS #12 password Enter pin for Sun Software PKCS#11 softtoken: Type PIN for token Found 1 certificate(s) and 1 key(s) in gracedata.p12 % pktool list No. Key Type Key Len. Key Label ---------------------------------------------------- Asymmetric public keys: 1 RSA GraceCert Certificates: 1 X.509 certificate Label: GraceCert ID: 71:8f:11:f5:62:10:35:c2:5d:b4:31:38:96:04:80:25:2e:ad:71:b3 Subject: C=US, O=My Company, OU=Security Engineering Group, CN=MyCA Issuer: C=US, O=My Company, OU=Security Engineering Group, CN=MyCA Serial: 0x00000010예 4-3 X.509 인증서를 키 저장소로 가져오기
다음 예에서 사용자가 PEM 형식의 X.509 인증서를 사용자의 선호 키 저장소로 가져옵니다. 이 공개 인증서는 암호로 보호되지 않습니다. 사용자의 공개 키 저장소도 암호로 보호되지 않습니다.
% pktool import keystore=pkcs11 infile=somecert.pem label="TheirCompany Root Cert" % pktool list No. Key Type Key Len. Key Label Certificates: 1 X.509 certificate Label: TheirCompany Root Cert ID: ec:a2:58:af:83:b9:30:9d:de:b2:06:62:46:a7:34:49:f1:39:00:0e Subject: C=US, O=TheirCompany, OU=Security, CN=TheirCompany Root CA Issuer: C=US, O=TheirCompany, OU=Security, CN=TheirCompany Root CA Serial: 0x00000001