PKCS #12 形式のファイルを作成し、非公開鍵とそれに関連付けられた X.509 証明書をほかのシステムにエクスポートすることができます。このファイルへのアクセスはパスワードで保護されます。
% 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. ...
pktool list コマンドから得られたキーストアとラベルを使用します。エクスポートファイルのファイル名を指定します。名前に空白が含まれている場合は、名前を二重引用符で囲みます。
% pktool export keystore=keystore outfile=outfile-name label=label-name
プロンプトで、キーストアの現在のパスワードを入力します。ここで、エクスポートファイルのパスワードを作成します。ファイルの受信者は、インポート時にこのパスワードを入力する必要があります。
Enter pin for Sun Software PKCS#11 softtoken: Type PIN for token Enter password to use for accessing the PKCS12 file:Create PKCS #12 password
次の例では、ユーザーが非公開鍵を関連付けられた X.509 証明書とともに標準の PKCS #12 ファイルにエクスポートしています。このファイルは、ほかのキーストアにインポートできます。PKCS #11 パスワードはソースのキーストアを保護します。PKCS #12 パスワードは、PKCS #12 ファイル内の非公開データを保護するために使用されます。このパスワードはファイルのインポート時に必要となります。
% pktool list No. Key Type Key Len. Key Label ---------------------------------------------------- Asymmetric public keys: 1 RSA My Cert Certificates: 1 X.509 certificate Label: My Cert ID: d2:7e:20:04:a5:66:e6:31:90:d8:53:28:bc:ef:55:55:dc:a3:69:93 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: 0x000001
% pktool export keystore=pkcs11 outfile=mydata.p12 label="My Cert" Enter pin for Sun Software PKCS#11 softtoken: Type PIN for token Enter password to use for accessing the PKCS12 file:Create PKCS #12 password
続いて、このユーザーは受信者に電話をかけ、PKCS #12 パスワードを伝えます。