Oracle® Database Advanced Security Administrator's Guide 10g Release 2 (10.2) Part Number B14268-02 |
|
|
PDF · Mobi · ePub |
The orapki
utility is provided to manage public key infrastructure (PKI) elements, such as wallets and certificate revocation lists, on the command line so the tasks it performs can be incorporated into scripts. Providing a way to incorporate the management of PKI elements into scripts makes it possible to automate many of the routine tasks of maintaining a PKI.
The following topics are included in this appendix:
This command line utility can be used to perform the following tasks:
Creating and viewing signed certificates for testing purposes
Manage Oracle wallets:
Create and display Oracle wallets
Add and remove certificate requests
Add and remove certificates
Add and remove trusted certificates
Manage certificate revocation lists (CRLs):
Renaming CRLs with a hash value for certificate validation
Uploading, listing, viewing, and deleting CRLs in Oracle Internet Directory
The basic syntax of the orapki
command line utility is as follows:
orapki module command -parameter value
where module
can be wallet
(Oracle wallet), crl
(certificate revocation list), or cert
(PKI digital certificate). The available commands depend on the module
you are using. For example, if you are working with a wallet
, then you can add a certificate or a key to the wallet with the add
command. The following example adds the user certificate located at /private/lhale/cert.txt
to the wallet located at $ORACLE_HOME/wallet/ewallet.p12:
orapki wallet add -wallet $ORACLE_HOME/wallet/ewallet.p12 -user_cert -cert /private/lhale/cert.txt
This command line utility provides a convenient, lightweight way to create signed certificates for testing purposes. The following syntax can be used to create signed certificates and to view certificates:
To create a signed certificate for testing purposes:
orapki cert create [-wallet wallet_location] -request certificate_request_location -cert certificate_location -validity number_of_days [-summary]
This command creates a signed certificate from the certificate request. The -wallet
parameter specifies the wallet containing the user certificate and private key that will be used to sign the certificate request. The -validity
parameter specifies the number of days, starting from the current date, that this certificate will be valid. Specifying a certificate and certificate request is mandatory for this command.
orapki cert display -cert certificate_location [-summary | -complete]
This command enables you to view a test certificate that you have created with orapki
. You can choose either -summary
or -complete
, which determines how much detail the command will display. If you choose -summary
, the command will display the certificate and its expiration date. If you choose -complete
, it will display additional certificate information, including the serial number and public key.
The following sections describe the syntax used to create and manage Oracle wallets with the orapki
command line utility. You can use these orapki
utility wallet
module commands in scripts to automate the wallet creation process.
Adding Certificates and Certificate Requests to Oracle Wallets with orapki
Exporting Certificates and Certificate Requests from Oracle Wallets with orapki
Note:
The-wallet
parameter is mandatory for all wallet
module commands.orapki wallet create -wallet wallet_location [-pwd password]
This command will prompt you to enter and reenter a wallet password, if no password has been specified on the command line. It creates a wallet in the location specified for -wallet
.
To create an Oracle wallet with auto login enabled:
orapki wallet create -wallet wallet_location -auto_login [-pwd password]
This command creates a wallet with auto login enabled, or it can also be used to enable auto login on an existing wallet. If the wallet_location
already contains a wallet, then auto login will be enabled for it. To turn the auto login feature off, use Oracle Wallet Manager.
See Also:
"Using Auto Login" for more informationNote:
For wallets with the auto login feature enabled, you are prompted for a password only for operations that modify the wallet, such asadd
.orapki wallet display -wallet wallet_location
Displays the certificate requests, user certificates, and trusted certificates contained in the wallet, which must be a binary PKCS12
file, with extension .p12
. Other files will fail.
Following sections describe how to add certificates and certificate requests to Oracle Wallets with orapki utility.
To add a certificate request to an Oracle wallet:
orapki wallet add -wallet wallet_location -dn user_dn -keySize 512|1024|2048
This command adds a certificate request to a wallet for the user with the specified distinguished name (user_dn
). The request also specifies the requested certificate's key size (512, 1024, or 2048 bits). To sign the request, export it with the export option.
See Also:
"Exporting Certificates and Certificate Requests from Oracle Wallets with orapki" for more informationTo add a trusted certificate to an Oracle wallet:
orapki wallet add -wallet wallet_location -trusted_cert -cert certificate_location
This command adds a trusted certificate, at the specified location (-cert certificate_location
), to a wallet. You must add all trusted certificates in the certificate chain of a user certificate before adding a user certificate, or the command to add the user certificate will fail.
To add a root certificate to an Oracle wallet
orapki wallet add -wallet wallet_location -dn certificate_dn -keySize 512|1024|2048 -self_signed -validity number_of_days
This command creates a new self-signed (root) certificate and adds it to the wallet. The -validity
parameter (mandatory) specifies the number of days, starting from the current date, that this certificate will be valid. You can specify a key size for this root certificate (-keySize
) of 512, 1024, or 2048 bits.
To add a user certificate to an Oracle wallet:
orapki wallet add -wallet wallet_location -user_cert -cert certificate_location
This command adds the user certificate at the location specified with the -cert
parameter to the Oracle wallet at the wallet_location
. Before you add a user certificate to a wallet, you must add all the trusted certificates that make up the certificate chain. If all trusted certificates are not installed in the wallet before you add the user certificate, then adding the user certificate will fail.
To add PKCS#11 information to a wallet
You can use a wallet containing PKCS#11 information like any Oracle wallet. The private keys are stored on a hardware device. The cryptographic operations are also performed on the device.
Use the following command to add PKCS#11 information to a wallet:
orapki wallet p11_add -wallet wallet_location -p11_lib pkcs11Lib [-p11_tokenlabel tokenLabel] [-p11_tokenpw tokenPassphrase] [-p11_certlabel certLabel] [-pwd password]
The parameters have the following meaning:
-wallet
specifies the wallet location.
-p11_lib
specifies the path to the PKCS#11 library. This includes the library filename.
-p11_tokenlabel
specifies the token or smart card used on the device. Use this when there are multiple tokens on the device. Token labels are set using vendor tools.
-p11_tokenpw
specifies the password that is used to access the token. Token passwords are set using vendor tools.
-p11_certlabel
is used to specify a certificate label on the token. Use this when a token contains multiple certificates. Certificate labels are set using vendor tools.
-pwd
is used to specify the wallet password.
You can verify credentials on the hardware device using the PKCS#11 wallet. Use the following command for this purpose:
orapki wallet p11_verify -wallet wallet_location [-pwd password]
Following steps describe how to export certificates and certificate requests from Oracle Wallets with orapki utility.
To export a certificate from an Oracle wallet:
orapki wallet export -wallet wallet_location -dn certificate_dn -cert certificate_filename
This command exports a certificate with the subject's distinguished name (-dn
) from a wallet to a file that is specified by -cert
.
To export a certificate request from an Oracle wallet:
orapki wallet export -wallet wallet_location -dn certificate_request_dn -request certificate_request_filename
This command exports a certificate request with the subject's distinguished name (-dn
) from a wallet to a file that is specified by -request
.
CRLs must be managed with orapki
. This utility creates a hashed value of the CRL issuer's name to identify the CRLs location in your system. If you do not use orapki
, your Oracle server cannot locate CRLs to validate PKI digital certificates. For detailed information about using orapki
to manage CRLs refer to "Certificate Revocation List Management".
This section includes examples of some of the orapki
commands discussed in the preceding sections.
Example F-1 illustrates the steps to create a wallet with a self-signed certificate and export the certificate to a file.
Example F-1 Create a Wallet with a Self-Signed Certificate and Export the Certificate
The following steps illustrate creating a wallet, adding a self-signed certificate to it, viewing the wallet and exporting the certificate:
Create a wallet
orapki wallet create -wallet /private/user/orapki_use/root
The wallet is created at the location, /private/user/orapki_use/root
.
Add a self-signed certificate to the wallet
orapki wallet add -wallet /private/user/orapki_use/root -dn 'CN=root_test,C=US' -keysize 2048 -self_signed -validity 3650
This creates a self-signed certificate with a validity of 3650 days. The distinguished name of the subject is CN=root_test,C=US
. The key size for the certificate is 2048 bits.
View the wallet
orapki wallet display -wallet /private/user/orapki_use/root
This is used to view the certificate contained in the wallet.
Export the certificate
orapki wallet export -wallet /private/user/orapki_use/root -dn 'CN=root_test,C=US' -cert /private/user/orapki_use/root/b64certificate.txt
This exports the self-signed certificate to the file, b64certificate.txt
. Note that the distinguished name used is the same as in step 2.
Example F-2 illustrates miscellaneous tasks related to creating user certificates.
Example F-2 Create a Wallet and a User Certificate
The following steps illustrate creating a wallet, creating a certificate request, exporting the certificate request, creating a signed certificate from the request for testing, viewing the certificate, adding a trusted certificate to the wallet and adding a user certificate to the wallet.
Create a wallet with auto login enabled
orapki wallet create -wallet /private/user/orapki_use/server -auto_login
This creates a wallet at /private/user/orapki_use/server
with auto login enabled.
Add a certificate request to the wallet
orapki wallet add -wallet /private/user/orapki_use/server -dn 'CN=server_test,C=US' -keysize 2048
This adds a certificate request to the wallet that was created. The distinguished name of the subject is CN=server_test,C=US
. The key size specified is 2048 bits.
Export the certificate request to a file
orapki wallet export -wallet /private/user/orapki_use/server -dn 'CN=server_test,C=US' -request /private/user/orapki_use/server/creq.txt
This exports the certificate request to the specified file, which is creq.txt
in this case.
Create a signed certificate from the request for test purposes
orapki cert create -wallet /private/user/orapki_use/server -request /private/user/orapki_use/server/creq.txt -cert /private/user/orapki_use/server/cert.txt -validity 3650
This creates a certificate, cert.txt
with a validity of 3650 days. The certificate is created from the certificate request generated in the preceding step.
View the certificate
orapki cert display -cert /private/user/orapki_use/server/cert.txt -complete
This displays the the certificate generated in the preceding step. The -complete
option allows you to display additional certificate information, including the serial number and public key.
Add a trusted certificate to the wallet
orapki wallet add -wallet /private/user/orapki_use/server -trusted_cert -cert /private/user/orapki_use/root/b64certificate.txt
This adds a trusted certificate, b64certificate.txt
to the wallet. You must add all trusted certificates in the certificate chain of a user certificate before adding a user certificate.
Add a user certificate to the wallet
orapki wallet add -wallet /private/user/orapki_use/server -user_cert -cert /private/user/orapki_use/server/cert.txt
This adds the user certificate, cert.txt
to the wallet.
This section lists and describes the following orapki
commands:
The following sections describe this command.
Use the orapki cert create
command to create a signed certificate for testing purposes.
orapki cert create [-wallet wallet_location] -request certificate_request_location -cert certificate_location -validity number_of_days [-summary]
The -wallet
parameter specifies the wallet containing the user certificate and private key that will be used to sign the certificate request.
The -request
parameter (mandatory) specifies the location of the certificate request for the certificate you are creating.
The -cert
parameter (mandatory) specifies the directory location where the tool places the new signed certificate.
The -validity
parameter (mandatory) specifies the number of days, starting from the current date, that this certificate will be valid.
The following sections describe this command.
orapki cert display -cert certificate_location [-summary|-complete]
The -cert
parameter specifies the location of the certificate you want to display.
You can use either the -summary
or the -complete
parameter to display the following information:
-summary
displays the certificate and its expiration date
-complete
displays additional certificate information, including the serial number and public key
The following sections describe this command.
Use the orapki crl delete
command to delete CRLs from Oracle Internet Directory. Note that the user who deletes CRLs from the directory by using orapki
must be a member of the CRLAdmins
(cn=CRLAdmins,cn=groups,%s_OracleContextDN%
) directory group.
orapki crl delete -issuer issuer_name -ldap hostname:ssl_port -user username [-wallet wallet_location] [-summary]
The -issuer
parameter specifies the name of the certificate authority (CA) who issued the CRL.
The -ldap
parameter specifies the host name and SSL port for the directory where the CRLs are to be deleted. Note that this must be a directory SSL port with no authentication.
See Also:
Refer to "Uploading CRLs to Oracle Internet Directory" for more information about this port.The -user
parameter specifies the user name of the directory user who has permission to delete CRLs from the CRL subtree in the directory.
The -wallet
parameter (optional) specifies the location of the wallet that contains the certificate of the certificate authority (CA) who issued the CRL. Using it causes the tool to verify the validity of the CRL against the CA's certificate prior to deleting it from the directory.
The -summary
parameter is optional. Using it causes the tool to print the CRL LDAP entry that was deleted.
The following sections describe this command.
Use the orapki crl display
command to display specific CRLs that are stored in Oracle Internet Directory.
orapki crl display -crl crl_location [-wallet wallet_location] [-summary|-complete]
The -crl
parameter specifies the location of the CRL in the directory. It is convenient to paste the CRL location from the list that displays when you use the orapki crl list
command. Refer to "orapki crl list"
The -wallet
parameter (optional) specifies the location of the wallet that contains the certificate of the certificate authority (CA) who issued the CRL. Using it causes the tool to verify the validity of the CRL against the CA's certificate prior to displaying it.
Choosing either the -summary
or the -complete
parameters displays the following information:
-summary
provides a listing that contains the CRL issuer's name and the CRL's validity period
-complete
provides a list of all revoked certificates that the CRL contains. Note that this option may take a long time to display, depending on the size of the CRL.
The following sections describe this command.
Use the orapki crl hash
command to generate a hash value of the certificate revocation list (CRL) issuer to identify the location of the CRL in the file system for certificate validation.
orapki crl hash -crl crl_filename|URL [-wallet wallet_location] [-symlink|-copy] crl_directory [-summary]
The -crl
parameter specifies the filename that contains the CRL or the URL where it can be found.
The -wallet
parameter (optional) specifies the location of the wallet that contains the certificate of the certificate authority (CA) who issued the CRL. Using it causes the tool to verify the validity of the CRL against the CA's certificate prior to uploading it to the directory.
Depending on the operating system, use either the -symlink
or the -copy
parameter:
(UNIX) use -symlink
to create a symbolic link to the CRL at the crl_directory
location
(Windows) use -copy
to create a copy of the CRL at the crl_directory
location
The -summary
parameter (optional) causes the tool to display the CRL issuer's name.
The following sections describe this command.
Use the orapki crl list
command to display a list of CRLs stored in Oracle Internet Directory. This is useful for browsing to locate a particular CRL to view or download to your local file system.
orapki crl list -ldap hostname:ssl_port
The -ldap
parameter specifies the host name and SSL port for the directory server from where you want to list CRLs. Note that this must be a directory SSL port with no authentication.
Tip:
"Uploading CRLs to Oracle Internet Directory" for more information about this portThe following sections describe this command.
Use the orapki crl upload
command to upload certificate revocation lists (CRLs) to the CRL subtree in Oracle Internet Directory. Note that you must be a member of the directory administrative group CRLAdmins
(cn=CRLAdmins,cn=groups,%s_OracleContextDN%
) to upload CRLs to the directory.
orapki crl upload -crl crl_location -ldap hostname:ssl_port -user username [-wallet wallet_location] [-summary]
The -crl
parameter specifies the directory location or the URL where the CRL is located that you are uploading to the directory.
The -ldap
parameter specifies the host name and SSL port for the directory where you are uploading the CRLs. Note that this must be a directory SSL port with no authentication.
See Also:
"Uploading CRLs to Oracle Internet Directory" for more information about this portThe -user
parameter specifies the user name of the directory user who has permission to add CRLs to the CRL subtree in the directory.
The -wallet
parameter specifies the location of the wallet that contains the certificate of the certificate authority (CA) who issued the CRL. This is an optional parameter. Using it causes the tool to verify the validity of the CRL against the CA's certificate prior to uploading it to the directory.
The -summary
parameter is also optional. Using it causes the tool to display the CRL issuer's name and the LDAP entry where the CRL is stored in the directory.
The following sections describe this command.
Use the orapki wallet add
command to add certificate requests and certificates to an Oracle wallet.
To add certificate requests:
orapki wallet add -wallet wallet_location -dn user_dn -keySize 512|1024|2048
The -wallet
parameter specifies the location of the wallet to which you want to add a certificate request.
The -dn
parameter specifies the distinguished name of the certificate owner.
The -keySize
parameter specifies the key size for the certificate.
To sign the request, export it with the export option. Refer to "orapki wallet export"
To add trusted certificates:
orapki wallet add -wallet wallet_location -trusted_cert -cert certificate_location
The -trusted_cert
parameter causes the tool to add the trusted certificate, at the location specified with -cert
, to the wallet.
To add root certificates:
orapki wallet add -wallet wallet_location -dn certificate_dn -keySize 512|1024|2048 -self_signed -validity number_of_days
The -self_signed
parameter causes the tool to create a root certificate.
The -validity
parameter is mandatory. Use it to specify the number of days, starting from the current date, that this root certificate will be valid.
To add user certificates:
orapki wallet add -wallet wallet_location -user_cert -cert certificate_location
The -user_cert
parameter causes the tool to add the user certificate at the location specified with the -cert
parameter to the wallet. Before you add a user certificate to a wallet, you must add all the trusted certificates that make up the certificate chain. If all trusted certificates are not installed in the wallet before you add the user certificate, then adding the user certificate will fail.
The following sections describe this command.
Use the orapki wallet create
command to create an Oracle wallet or to set auto login on for an Oracle wallet.
orapki wallet create -wallet wallet_location [-auto_login]
The -wallet
parameter specifies a location for the new wallet or the location of the wallet for which you want to turn on auto login.
The -auto_login
parameter creates an auto login wallet, or it turns on automatic login for the wallet specified with the -wallet
option.
See Also:
"Using Auto Login" for details about auto login walletsThe following sections describe this command.
The following sections describe this command.
Use the orapki wallet export
command to export certificate requests and certificates from an Oracle wallet.
To export a certificate from an Oracle wallet:
orapki wallet export -wallet wallet_location -dn certificate_dn -cert certificate_filename
The -wallet
parameter specifies the location of the wallet from which you want to export the certificate.
The -dn
parameter specifies the distinguished name of the certificate.
The -cert
parameter specifies the name of the file that contains the exported certificate.
To export a certificate request from an Oracle wallet:
orapki wallet export -wallet wallet_location -dn certificate_request_dn -request certificate_request_filename
The -request
parameter specifies the name of the file that contains the exported certificate request.