<?Pub UDT _bookmark _target?><?Pub EntList bsol dash hellip gt lt minus?><?Pub CX solbook(book(title()bookinfo()part(3)part(title()partintro()chapter()?><chapter id="kmf-1"><?Pub Tag atict:info tracking="off" ref="0"?><?Pub Tag atict:user
user="sharonr" fullname="Sharon Veach"?><title>Solaris Key Management Framework</title><highlights><para>In the Solaris Express Community Edition,
the Key Management Framework (KMF) provides tools and programming interfaces
for managing public key objects. Public key objects include X.509 certificates
and public/private key pairs. The formats for storing these objects can vary.
KMF also provides a tool for managing policies that define the use of X.509
certificates by applications. In the Solaris Express Community Edition, KMF supports third-party plugins.</para><itemizedlist remap="jumplist"><listitem><para><olink targetptr="kmf-28" remap="internal">Managing Public Key Technologies</olink></para>
</listitem><listitem><para><olink targetptr="kmf-2" remap="internal">Key Management Framework Utilities</olink></para>
</listitem><listitem><para><olink targetptr="kmf-6" remap="internal">Using the Key Management Framework
(Tasks)</olink></para>
</listitem>
</itemizedlist>
</highlights><sect1 id="kmf-28"><title>Managing Public Key Technologies</title><para><indexterm><primary>key management framework (KMF)</primary><see>KMF</see></indexterm><indexterm><primary>public key technologies</primary><see>PKI</see></indexterm><indexterm><primary>KMF</primary><secondary>managing</secondary><tertiary>public key technologies (PKI)</tertiary></indexterm><indexterm><primary>PKI</primary><secondary>managed by KMF</secondary></indexterm>The
Key Management Framework (KMF) provides a unified approach to managing public
key technologies (PKI). The Solaris OS has several different applications that
make use of PKI technologies. Each application provides its own programming
interfaces, key storage mechanisms, and administrative utilities. If an application
provides a policy enforcement mechanism, the mechanism applies to that application
only. With KMF, applications use a unified set of administrative tools, a
single set of programming interfaces, and a single policy enforcement mechanism.
These features manage the PKI needs of all applications that adopt these interfaces.</para><itemizedlist><para>KMF unifies the management of public key technologies with the following
interfaces:</para><listitem><para><indexterm><primary><command>pktool</command> command</primary><secondary>managing PKI objects</secondary></indexterm><emphasis role="strong">pktool
command &ndash;</emphasis> This command manages PKI objects, such as certificates,
in a variety of keystores.</para>
</listitem><listitem><para><indexterm><primary><command>kmfcfg</command> command</primary><secondary>plugin subcommands</secondary></indexterm><emphasis role="strong">kmfcfg
command &ndash;</emphasis> This command manages the PKI policy database and third-party plugins.</para><para>PKI policy decisions include operations such as the validation method
for an operation. Also, PKI policy can limit the scope of a certificate. For
example, PKI policy might assert that a certificate can be used only for specific
purposes. Such a policy would prevent that certificate from being used for
other requests.</para>
</listitem><listitem><para><indexterm><primary>KMF</primary><secondary>library</secondary></indexterm><emphasis role="strong">KMF library &ndash;</emphasis> This library
contains programming interfaces that abstract the underlying keystore mechanism.</para><para>Applications do not have to choose one particular keystore mechanism,
but can migrate from one mechanism to another mechanism. The supported keystores
are PKCS&nbsp;#11, NSS, and OpenSSL. The library includes a pluggable framework
so that new keystore mechanisms can be added. Therefore, applications that
use the new mechanisms would require only minor modifications to use a new
keystore.</para>
</listitem>
</itemizedlist>
</sect1><sect1 id="kmf-2"><title>Key Management Framework Utilities</title><indexterm><primary>keystores</primary><secondary>managed by KMF</secondary>
</indexterm><indexterm><primary>KMF</primary><secondary>utilities</secondary>
</indexterm><itemizedlist><para>KMF provides methods for managing the storage of keys and provides the
overall policy for the use of those keys.  KMF manages the policy, keys, and
certificates for three public key technologies:</para><listitem><para>Tokens from PKCS&nbsp;#11 providers, that is, from the Solaris
Cryptographic Framework</para>
</listitem><listitem><para>NSS, that is, Network Security Services</para>
</listitem><listitem><para>OpenSSL, a file-based keystore</para>
</listitem>
</itemizedlist><para>The <command>kmfcfg</command> tool can create, modify, or delete KMF
policy entries. The tool also manages plugins to the framework. KMF
manages keystores through the <command>pktool</command> command. For more
information, see the <olink targetdoc="group-refman" targetptr="kmfcfg-1" remap="external"><citerefentry><refentrytitle>kmfcfg</refentrytitle><manvolnum>1</manvolnum></citerefentry></olink> 
and <olink targetdoc="group-refman" targetptr="pktool-1" remap="external"><citerefentry><refentrytitle>pktool</refentrytitle><manvolnum>1</manvolnum></citerefentry></olink> man
pages, and the following sections.</para>
</sect1><sect1 id="kmf-3"><title>KMF Policy Management</title><para><indexterm><primary>KMF</primary><secondary>managing</secondary><tertiary>PKI policy</tertiary></indexterm><indexterm><primary>PKI</primary><secondary>policy managed by KMF</secondary></indexterm>KMF policy is stored in a database.
This policy database is accessed internally by all applications that use the
KMF programming interfaces. The database can constrain the use of the keys
and certificates that are managed by the KMF library. When an application
attempts to verify a certificate, the application checks the policy database.
The <command>kmfcfg</command> command modifies the policy database.</para>
</sect1><sect1 id="kmf-14"><title>KMF Plugin Management</title><indexterm><primary><command>kmfcfg</command> command</primary><secondary>plugin subcommands</secondary>
</indexterm><indexterm><primary>plugins</primary><secondary>managed in KMF</secondary>
</indexterm><indexterm><primary>KMF</primary><secondary>managing</secondary><tertiary>plugins</tertiary>
</indexterm><itemizedlist><para>The <command>kmfcfg</command> command provides the following subcommands for plugins:</para><listitem><para><command>list plugin</command> &ndash; Lists plugins that are managed by KMF.</para>
</listitem><listitem><para><command>install</command> <replaceable>plugin</replaceable> &ndash; Installs the plugin by the module's path name and creates a keystore for the plugin. To remove the plugin from KMF, you remove the keystore.</para>
</listitem><listitem><para><command>uninstall</command> <replaceable>plugin</replaceable> &ndash; Removes the plugin from KMF by removing its keystore.</para>
</listitem><listitem><para><command>modify</command> <replaceable>plugin</replaceable> &ndash; Enables the plugin to be run with an option that is defined in the code for the plugin, such as <literal>debug</literal>.</para>
</listitem>
</itemizedlist><para>For more information, see the <olink targetdoc="group-refman" targetptr="kmfcfg-1" remap="external"><citerefentry><refentrytitle>kmfcfg</refentrytitle><manvolnum>1</manvolnum></citerefentry></olink> man page. For the procedure, see <olink targetptr="kmf-22" remap="internal">How to Manage Third-Party Plugins in KMF</olink>.</para>
</sect1><sect1 id="kmf-4"><title>KMF Keystore Management</title><itemizedlist><para><indexterm><primary>KMF</primary><secondary>managing</secondary><tertiary>keystores</tertiary></indexterm><indexterm><primary>managing</primary><secondary>keystores with KMF</secondary></indexterm><indexterm><primary>NSS</primary><secondary>managing keystore</secondary></indexterm><indexterm><primary>OpenSSL</primary><secondary>managing keystore</secondary></indexterm><indexterm><primary>PKCS #11 softtokens</primary><secondary>managing keystore</secondary></indexterm>KMF manages the keystores
for three public key technologies, PKCS&nbsp;#11  tokens, NSS, and OpenSSL.
For all of these technologies, the <command>pktool</command>  command enables
you to do the following:</para><listitem><para>Designate a keystore for each certificate and PIN.</para>
</listitem><listitem><para>Generate a self-signed certificate.</para>
</listitem><listitem><para>Generate a certificate request.</para>
</listitem><listitem><para>Generate a symmetric key.</para>
</listitem><listitem><para>Import objects into the keystore.</para>
</listitem><listitem><para>List the objects in the keystore.</para>
</listitem><listitem><para>Delete objects from the keystore.</para>
</listitem><listitem><para>Download a CRL.</para>
</listitem>
</itemizedlist><itemizedlist><para><indexterm><primary>KMF</primary><secondary>creating</secondary><tertiary>passphrases for keystores</tertiary></indexterm>For the PKCS&nbsp;#11 and NSS technologies,
the <command>pktool</command>  command also enables you to set a PIN by generating
a passphrase:</para><listitem><para>Generate a passphrase for the keystore.</para>
</listitem><listitem><para>Generate a passphrase for an object in the keystore.</para>
</listitem>
</itemizedlist><para>For examples of using the <command>pktool</command> utility, see the <olink targetdoc="group-refman" targetptr="pktool-1" remap="external"><citerefentry><refentrytitle>pktool</refentrytitle><manvolnum>1</manvolnum></citerefentry></olink> man page and <olink targetptr="kmf-5" remap="internal">Using the Key Management Framework (Task Map)</olink>.</para>
</sect1><sect1 id="kmf-5"><title>Using the Key Management Framework (Task Map)</title><indexterm><primary>task maps</primary><secondary>Using the Key Management Framework (Task Map)</secondary>
</indexterm><indexterm><primary>Using the Key Management Framework (Task Map)</primary>
</indexterm><indexterm><primary>protecting</primary><secondary>by using passwords with cryptographic framework</secondary>
</indexterm><indexterm><primary>user procedures</primary><secondary>using <command>pktool</command> command</secondary>
</indexterm><para>The Key Management Framework (KMF) enables you to centrally manage public
key technologies.</para><informaltable frame="all" pgwide="1"><tgroup cols="3" colsep="0" rowsep="0"><colspec colname="colspec0" colwidth="20.28*"/><colspec colname="colspec1" colwidth="47.28*"/><colspec colname="colspec2" colwidth="31.44*"/><thead><row rowsep="1"><entry colsep="1" rowsep="1"><para>Task</para>
</entry><entry colsep="1" rowsep="1"><para>Description</para>
</entry><entry colsep="1" rowsep="1"><para>For Instructions</para>
</entry>
</row>
</thead><tbody><row><entry colsep="1" rowsep="1"><para>Create a certificate.</para>
</entry><entry colsep="1" rowsep="1"><para>Creates a certificate for use by PKCS&nbsp;#11, NSS, or SSL.</para>
</entry><entry colsep="1" rowsep="1"><para><olink targetptr="kmf-8" remap="internal">How to Create a Certificate by Using the pktool&nbsp;gencert
Command</olink></para>
</entry>
</row><row><entry colsep="1" rowsep="1"><para>Export a certificate.</para>
</entry><entry colsep="1" rowsep="1"><para>Creates a file with the certificate and its supporting keys. The file
can be protected with a password.</para>
</entry><entry colsep="1" rowsep="1"><para><olink targetptr="kmf-12" remap="internal">How to Export a Certificate and Private Key
in PKCS&nbsp;#12 Format</olink></para>
</entry>
</row><row><entry morerows="1" colsep="1" rowsep="1"><para>Import a certificate.</para>
</entry><entry colsep="1" rowsep="1"><para>Imports a certificate from another system.</para>
</entry><entry colsep="1" rowsep="1"><para><olink targetptr="kmf-16" remap="internal">How to Import a Certificate Into Your Keystore</olink></para>
</entry>
</row><row><entry colsep="1" rowsep="1"><para>Imports a certificate in PKCS&nbsp;#12 format from another system.</para>
</entry><entry colsep="1" rowsep="1"><para><olink targetptr="kmf-17" remap="internal">Example&nbsp;15&ndash;2</olink></para>
</entry>
</row><row><entry colsep="1" rowsep="1"><para>Generate a passphrase.</para>
</entry><entry colsep="1" rowsep="1"><para>Generates a passphrase for access to a PKCS&nbsp;#11 keystore or an
NSS keystore.</para>
</entry><entry colsep="1" rowsep="1"><para><olink targetptr="kmf-9" remap="internal">How to Generate a Passphrase by Using the pktool&nbsp;setpin
Command</olink></para>
</entry>
</row><row><entry colsep="1" rowsep="1"><para>Generate a symmetric key.</para>
</entry><entry colsep="1" rowsep="1"><para>Generates symmetric keys for use in encrypting files, creating a MAC
of a file, and for applications.</para>
</entry><entry colsep="1" rowsep="1"><para><olink targetptr="kmf-20" remap="internal">How to Generate a Symmetric Key by Using the
pktool Command</olink></para>
</entry>
</row><row><entry colsep="1" rowsep="1"><para>Add a plugin to KMF.</para>
</entry><entry colsep="1" rowsep="1"><para>Installs, modifies, and lists a plugin. Also, removes the plugin from
the KMF.</para>
</entry><entry colsep="1" rowsep="1"><para><olink targetptr="kmf-22" remap="internal">How to Manage Third-Party Plugins in KMF</olink></para>
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</sect1><sect1 id="kmf-6"><title>Using the Key Management Framework (Tasks)</title><para>This section describes how to use the <command>pktool</command> command
to manage your public key objects, such as passwords, passphrases, files,
keystores, certificates, and CRLs.</para><task id="kmf-8"><title>How to Create a Certificate by Using the <command>pktool&nbsp;gencert</command> Command</title><indexterm><primary><command>pktool</command> command</primary><secondary><command>gencert</command> subcommand</secondary>
</indexterm><indexterm><primary><command>gencert</command> subcommand</primary><secondary><command>pktool</command> command</secondary>
</indexterm><indexterm><primary>generating</primary><secondary>certificates with <command>pktool</command> command</secondary>
</indexterm><indexterm><primary>certificates</primary><secondary>generating with <command>pktool gencert</command> command</secondary>
</indexterm><indexterm><primary><command>pktool</command> command</primary><secondary>creating self-signed certificate</secondary>
</indexterm><indexterm><primary>KMF</primary><secondary>creating</secondary><tertiary>self-signed certificate</tertiary>
</indexterm><indexterm><primary>user procedures</primary><secondary>creating self-signed certificate</secondary>
</indexterm><tasksummary><para>This procedure creates a self-signed certificate and stores the certificate
in the PKCS&nbsp;#11 keystore. As a part of this operation, an RSA public/private
key pair is also created. The private key is stored in the keystore with the
certificate.</para>
</tasksummary><procedure><step><para>Generate a self-signed certificate.</para><screen>% pktool gencert [keystore=<replaceable>keystore</replaceable>] label=<replaceable>label-name</replaceable> \
subject=<replaceable>subject-DN</replaceable> serial=<replaceable>hex-serial-number</replaceable></screen><variablelist><varlistentry><term><option role="nodash">keystore=</option><replaceable>keystore</replaceable></term><listitem><para>Specifies the keystore by type of public key object. The value
can be <literal>nss</literal>, <literal>pkcs11</literal>, or <literal>ssl</literal>.
This keyword is optional.</para>
</listitem>
</varlistentry><varlistentry><term><option role="nodash">label=</option><replaceable>label-name</replaceable></term><listitem><para>Is a unique name that the issuer gives to the certificate.</para>
</listitem>
</varlistentry><varlistentry><term><option role="nodash">subject=</option><replaceable>subject-DN</replaceable></term><listitem><para>Is the distinguished name for the certificate.</para>
</listitem>
</varlistentry><varlistentry><term><option role="nodash">serial=</option><replaceable>hex-serial-number</replaceable></term><listitem><para>Is the serial number in hexadecimal format. The issuer of
the certificate chooses the number, such as <literal>0x0102030405</literal>.</para>
</listitem>
</varlistentry>
</variablelist>
</step><step><para><indexterm><primary>keystores</primary><secondary>listing contents</secondary></indexterm><indexterm><primary>listing</primary><secondary>contents of keystore</secondary></indexterm><indexterm><primary><command>pktool</command> command</primary><secondary><command>list</command> subcommand</secondary></indexterm><indexterm><primary><command>list</command> subcommand</primary><secondary><command>pktool</command> command</secondary></indexterm>Verify the contents of the keystore.</para><screen>% <userinput>pktool list</userinput>
Found <replaceable>number</replaceable> certificates.
1. (X.509 certificate)
      Label:  <replaceable>label-name</replaceable>
      ID: <replaceable>Fingerprint that binds certificate to private key</replaceable>
      Subject: <replaceable>subject-DN</replaceable>
      Issuer:  <replaceable>distinguished-name</replaceable>
      Serial:  <replaceable>hex-serial-number</replaceable>
<replaceable>n</replaceable>. ...</screen><para>This command lists all certificates in the keystore. In the following
example, the keystore contains one certificate only.</para>
</step>
</procedure><example id="kmf-25"><title>Creating a Self-Signed Certificate by Using <command>pktool</command></title><para>In the following example, a user at <literal>My Company</literal> creates
a self-signed certificate and stores the certificate in a keystore for PKCS&nbsp;#11
objects. The keystore is initially empty. If the keystore has not been initialized,
the PIN for the softtoken is <literal>changeme</literal>.</para><screen>% <userinput>pktool gencert keystore=pkcs11 label="My Cert" \</userinput>
<userinput>subject="C=US, O=My Company, OU=Security Engineering Group, CN=MyCA" \</userinput>
<userinput>serial=0x000000001</userinput>
Enter pin for Sun Software PKCS#11 softtoken:<lineannotation>Type PIN for token</lineannotation></screen><screen>% <userinput>pktool list</userinput>
Found 1 certificates.
1. (X.509 certificate)
      Label: My Cert
      ID: 12:82:17:5f:80:78:eb:44:8b:98:e3:3c:11:c0:32:5e:b6:4c:ea:eb
      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: 0x01</screen>
</example>
</task><task id="kmf-16"><title>How to Import a Certificate Into Your Keystore</title><indexterm><primary><command>pktool</command> command</primary><secondary><command>import</command> subcommand</secondary>
</indexterm><indexterm><primary><command>import</command> subcommand</primary><secondary><command>pktool</command> command</secondary>
</indexterm><indexterm><primary>certificates</primary><secondary>importing into keystore</secondary>
</indexterm><indexterm><primary>KMF</primary><secondary>importing certificates into keystore</secondary>
</indexterm><indexterm><primary>keystores</primary><secondary>importing certificates</secondary>
</indexterm><indexterm><primary>user procedures</primary><secondary>importing certificates</secondary>
</indexterm><tasksummary><para>This procedure describes how to import a file with PKI information that
is encoded with PEM or with raw DER into your keystore. For an export procedure,
see <olink targetptr="kmf-19" remap="internal">Example&nbsp;15&ndash;4</olink>.</para>
</tasksummary><procedure><step><para>Import the certificate.</para><screen>% pktool import keystore=<replaceable>keystore</replaceable> infile=<replaceable>infile-name</replaceable> label=<replaceable>label-name</replaceable></screen>
</step><step><para>If you are importing private PKI objects, provide passwords when
prompted.</para><substeps><step><para>At the prompt, provide the password for the file.</para><para>If
you are importing PKI information that is private, such as an export file
in PKCS&nbsp;#12 format, the file requires a password. The creator of the
file that you are importing provides you with the PKCS&nbsp;#12 password.</para><screen>Enter password to use for accessing the PKCS12 file:<lineannotation>Type PKCS #12 password</lineannotation></screen>
</step><step><para>At the prompt, type the password for your keystore.</para><screen>Enter pin for Sun Software PKCS#11 softtoken: <lineannotation>Type PIN for token</lineannotation></screen>
</step>
</substeps>
</step><step><para>Verify the contents of the keystore.</para><screen>% <userinput>pktool list</userinput>
Found <replaceable>number</replaceable> certificates.
1. (X.509 certificate)
      Label:  <replaceable>label-name</replaceable>
      ID: <replaceable>Fingerprint that binds certificate to private key</replaceable>
      Subject: <replaceable>subject-DN</replaceable>
      Issuer:  <replaceable>distinguished-name</replaceable>
      Serial:  <replaceable>hex-serial-number</replaceable>
2. ...</screen>
</step>
</procedure><example id="kmf-17"><title>Importing a PKCS&nbsp;#12 File Into Your Keystore</title><para>In the following example, the user imports a PKCS&nbsp;#12 file from
a third party. The <command>pktool import</command> command extracts the private
key and the certificate from the <filename>gracedata.p12</filename> file,
and stores them in the user's preferred keystore.</para><screen>% <userinput>pktool import keystore=pkcs11 infile=gracedata.p12 label=GraceCert</userinput>
Enter password to use for accessing the PKCS12 file:<lineannotation>Type PKCS #12 password</lineannotation>
Enter pin for Sun Software PKCS#11 softtoken: <lineannotation>Type PIN for token</lineannotation>
Found 1 certificate(s) and 1 key(s) in gracedata.p12
% <userinput>pktool list</userinput>
Found 1 certificates.
1. (X.509 certificate)
        Label: GraceCert
        ID: 12:82:17:5f:80:78:eb:44:8b:98:e3:3c:11:c0:32:5e:b6:4c:ea:eb
        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: 0x01</screen>
</example><example id="kmf-15"><title>Importing an X.509 Certificate Into Your Keystore</title><para>In the following example, the user imports an X.509 certificate in PEM
format into the user's preferred keystore. This public certificate is not
protected with a password. The user's public keystore is also not protected
by a password.</para><screen>% <userinput>pktool import keystore=pkcs11 infile=somecert.pem label="TheirCompany Root Cert"</userinput>
% <userinput>pktool list</userinput>
Found 1 certificates.
1. (X.509 certificate)
        Label: TheirCompany Root Cert
        ID: 21:ae:83:98:24:d1:1f:cb:65:5b:48:75:7d:02:47:cf:98:1f:ec:a0
        Subject: C=US, O=TheirCompany, OU=Security, CN=TheirCompany Root CA
        Issuer: C=US, O=TheirCompany, OU=Security, CN=TheirCompany Root CA
        Serial: 0x01</screen>
</example>
</task><task id="kmf-12"><title>How to Export a Certificate and Private
Key in PKCS&nbsp;#12 Format</title><indexterm><primary><command>pktool</command> command</primary><secondary><command>export</command> subcommand</secondary>
</indexterm><indexterm><primary><command>export</command> subcommand</primary><secondary><command>pktool</command> command</secondary>
</indexterm><indexterm><primary>certificates</primary><secondary>exporting for use by another system</secondary>
</indexterm><indexterm><primary>KMF</primary><secondary>exporting certificates</secondary>
</indexterm><indexterm><primary>keystores</primary><secondary>exporting certificates</secondary>
</indexterm><indexterm><primary>user procedures</primary><secondary>exporting certificates</secondary>
</indexterm><tasksummary><para>You can create a file in PKCS&nbsp;#12 format to export private keys
and their associated X.509 certificate to other systems. Access to the file
is protected by a password. </para>
</tasksummary><procedure><step><para>Find the certificate to export.</para><screen>% <userinput>pktool list</userinput>
Found <replaceable>number</replaceable> certificates.
1. (X.509 certificate)
      Label:  <replaceable>label-name</replaceable>
      ID: <replaceable>Fingerprint that binds certificate to private key</replaceable>
      Subject: <replaceable>subject-DN</replaceable>
      Issuer:  <replaceable>distinguished-name</replaceable>
      Serial:  <replaceable>hex-serial-number</replaceable>
2. ...</screen>
</step><step><para>Export the keys and certificate.</para><para>Use the keystore
and label from the <command>pktool list</command> command. Provide a file
name for the export file. When the name contains a space, surround the name
with double quotes.</para><screen>% pktool export keystore=<replaceable>keystore</replaceable> outfile=<replaceable>outfile-name</replaceable> label=<replaceable>label-name</replaceable></screen>
</step><step><para>Protect the export file with a password.</para><para>At the prompt,
type the current password for the keystore. At this point, you create a password
for the export file. The receiver must provide this password when importing
the file.</para><screen>Enter pin for Sun Software PKCS#11 softtoken: <lineannotation>Type PIN for token</lineannotation>
Enter password to use for accessing the PKCS12 file:<lineannotation>Create PKCS #12 password</lineannotation></screen><tip><para>Send the password separately from the export file. Best practice
suggests that you provide the password out of band, such as during a telephone
call.</para>
</tip>
</step>
</procedure><example id="kmf-19"><title>Exporting a Certificate and Private Key in PKCS&nbsp;#12 Format</title><para><indexterm><primary>protecting</primary><secondary>contents of keystore</secondary></indexterm><indexterm><primary>passwords</primary><secondary>protecting</secondary><tertiary>keystore</tertiary></indexterm><indexterm><primary>passwords</primary><secondary>protecting</secondary><tertiary>PKCS #12 file</tertiary></indexterm><indexterm><primary>PKCS #12 files</primary><secondary>protecting</secondary></indexterm><indexterm><primary>files</primary><secondary>PKCS #12</secondary></indexterm>In the
following example, a user exports the private keys with their associated X.509
certificate into a standard PKCS&nbsp;#12 file. This file can be imported
into other keystores. The PKCS&nbsp;#11 password protects the source keystore.
The PKCS&nbsp;#12 password is used to protect private data in the  PKCS&nbsp;#12
file. This password is required to import the file.</para><screen>% <userinput>pktool list</userinput>
Found 1 certificates.
1. (X.509 certificate)
      Label: My Cert
      ID: 12:82:17:5f:80:78:eb:44:8b:98:e3:3c:11:c0:32:5e:b6:4c:ea:eb
      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: 0x01</screen><screen>% <userinput>pktool export keystore=pkcs11 outfile=mydata.p12 label="My Cert"</userinput>
Enter pin for Sun Software PKCS#11 softtoken: <lineannotation>Type PIN for token</lineannotation>
Enter password to use for accessing the PKCS12 file:<lineannotation>Create PKCS #12 password</lineannotation></screen><para>The user then telephones the recipient and provides the PKCS #12 password.</para>
</example>
</task><task id="kmf-9"><title>How to Generate a Passphrase by Using the <command>pktool&nbsp;setpin</command> Command</title><indexterm><primary><command>pktool</command> command</primary><secondary><command>setpin</command> subcommand</secondary>
</indexterm><indexterm><primary><command>setpin</command> subcommand</primary><secondary><command>pktool</command> command</secondary>
</indexterm><indexterm><primary>generating</primary><secondary>passphrases with <command>pktool</command> command</secondary>
</indexterm><indexterm><primary>passphrases</primary><secondary>generating in KMF</secondary>
</indexterm><indexterm><primary>KMF</primary><secondary>creating</secondary><tertiary>password for keystore</tertiary>
</indexterm><indexterm><primary>keystores</primary><secondary>protecting with password in KMF</secondary>
</indexterm><indexterm><primary>user procedures</primary><secondary>generating passphrase for keystore</secondary>
</indexterm><tasksummary><para>You can generate a passphrase for an object in a keystore, and for the
keystore itself. The passphrase is required to access the object or keystore.
For an example of generating a passphrase for an object in a keystore, see <olink targetptr="kmf-19" remap="internal">Example&nbsp;15&ndash;4</olink>.</para>
</tasksummary><procedure><step><para>Generate a passphrase for access to a keystore.</para><screen>% pktool setpin keystore=nss|pkcs11 dir=<replaceable>directory</replaceable></screen>
</step><step><para>Answer the prompts.</para><para>If the keystore does not have
a password already set, press the <keysym>Return</keysym> key to create the
password.</para><screen>Enter current token passphrase:<lineannotation>Press the Return key</lineannotation>
Create new passphrase:<lineannotation>Type the passphrase that you want to use</lineannotation>
Re-enter new passphrase:<lineannotation>Retype the passphrase</lineannotation>
Passphrase changed.</screen><para>The keystore is now protected by <replaceable>passphrase</replaceable>.
If you lose the passphrase, you lose access to the objects in the keystore.</para>
</step>
</procedure><example id="kmf-11"><title>Protecting a Keystore With a Passphrase</title><para>The following example shows how to set the passphrase for an NSS database.
Because no passphrase has been created, the user presses the <keysym>Return</keysym> key
at the first prompt.</para><screen>% <userinput>pktool setpin keystore=nss dir=/var/nss</userinput>
Enter current token passphrase:<lineannotation>Press the Return key</lineannotation>
Create new passphrase:    <userinput>has8n0NdaH</userinput>
Re-enter new passphrase:  <userinput>has8n0NdaH</userinput>
Passphrase changed.</screen>
</example>
</task><task id="kmf-22"><title>How to Manage Third-Party Plugins in KMF</title><indexterm><primary><command>kmfcfg</command> command</primary><secondary><command>list plugin</command> subcommand</secondary>
</indexterm><indexterm><primary><command>list plugin</command> subcommand</primary><secondary><command>kmcfg</command> command</secondary>
</indexterm><indexterm><primary>adding</primary><secondary>plugins to KMF</secondary>
</indexterm><indexterm><primary>plugins</primary><secondary>adding to KMF</secondary>
</indexterm><indexterm><primary>removing</primary><secondary>plugins from KMF</secondary>
</indexterm><indexterm><primary>plugins</primary><secondary>removing from KMF</secondary>
</indexterm><indexterm><primary>KMF</primary><secondary>adding plugin</secondary>
</indexterm><indexterm><primary>KMF</primary><secondary>listing plugins</secondary>
</indexterm><indexterm><primary>KMF</primary><secondary>removing plugin</secondary>
</indexterm><indexterm><primary>user procedures</primary><secondary>adding plugins to KMF</secondary>
</indexterm><tasksummary><para>You identify your plugin by giving it a keystore name. When you add the plugin to KMF, the software identifies it by its keystore name. The plugin can be defined to accept an option. This procedure includes how to remove the plugin from KMF.</para>
</tasksummary><procedure><step><para>Install the plugin.</para><screen>% /usr/bin/kmfcfg install keystore=<replaceable>keystore-name</replaceable> \
modulepath=<replaceable>path-to-plugin</replaceable> [option="<replaceable>option-string</replaceable>"]</screen><para>where</para><para><replaceable>keystore-name</replaceable> &ndash; Is a unique name for the keystore that you provide.</para><para><replaceable>path-to-plugin</replaceable> &ndash; Is the full path to the shared library object for the KMF plugin.</para><para><replaceable>option-string</replaceable> &ndash; Is an optional argument to the shared library object.</para>
</step><step><para>List the plugins.</para><screen>% <userinput>kmfcfg list plugin</userinput>
<replaceable>keystore-name</replaceable>:<replaceable>path-to-plugin</replaceable> [(built-in)] | [;option=<replaceable>option-string</replaceable>]</screen>
</step><step><para>To remove the plugin, uninstall it and verify its removal.</para><screen>% <userinput>kmfcfg uninstall keystore=<replaceable>keystore-name</replaceable></userinput>
% <userinput>kmfcfg plugin list</userinput></screen>
</step>
</procedure><example id="kmf-27"><title>Calling a KMF Plugin With an Option</title><para>In the following example, the administrator stores a KMF plugin in a site-specific directory. The plugin is defined to accept a <literal>debug</literal> option. The administrator adds the plugin and verifies that the plugin is installed.</para><screen># <userinput>/usr/bin/kmfcfg install keystore=mykmfplug \</userinput>
<userinput>modulepath=/usr/lib/security/site-modules/mykmfplug.so</userinput>
# <userinput>kmfcfg list plugin</userinput>
KMF plugin information:
-----------------------
pkcs11:kmf_pkcs11.so.1 (built-in)
file:kmf_openssl.so.1 (built-in)
nss:kmf_nss.so.1 (built-in)
mykmfplug:/usr/lib/security/site-modules/mykmfplug.so
# <userinput>kmfcfg modify plugin keystore=mykmfplug option="debug"</userinput>
# <userinput>kmfcfg list plugin</userinput>
KMF plugin information:
-----------------------
...
mykmfplug:/usr/lib/security/site-modules/mykmfplug.so;option=debug</screen><para>The plugin now runs in debugging mode.</para>
</example>
</task>
</sect1>
</chapter><?Pub *0000034138 0?>