Template Version: @(#)sac_nextcase 1.68 02/23/09 SMI This information is Copyright 2009 Sun Microsystems 1. Introduction 1.1. Project/Component Working Name: OpenSSL RSA keys by reference in PKCS#11 keystores through the PKCS11 engine 1.2. Name of Document Author/Supplier: Author: Jan Pechanec 1.3 Date of This Document: 13 October, 2009 1.5. Email Aliases: 1.5.1. Responsible Manager: Anup.Sekhar@Sun.COM 1.5.2. Responsible Engineer: Jan.Pechanec@Sun.COM 1.5.3. Marketing Manager: Mark.Thacker@Sun.COM 1.5.4. Interest List: openssl-interest@Sun.COM 2. Project Summary 2.1. Project Description: OpenSSL applications can not currently take advantage of the added security provided by hardware keystores/tokens. Changes are needed to allow OpenSSL applications to use PKCS#11 keystores provided via the Solaris Crypto Framework (softtoken, Sun Crypto Accelerator 6000, etc.) so that it's possible to access existing RSA private and public keys in the keystores through the OpenSSL API. Certificates cannot be used due to the limitations of the ENGINE API. The change needed is entirely within the PKCS#11 engine that has been internally developed at Sun. Presently the engine can load only RSA keys from files in PEM format stored on disk so no support for DSA keys will be added as part of this project. DSA keys in PKCS#11 keystores seem not be of the interest to our PKCS#11 engine users for now. Given the limitation of the existing OpenSSL ENGINE API we can only work with existing keys in the keystore. We will not be able to generate keys. For such operations, the PKCS#11 API or different tools such as pktool(1) must be used. While DSA keys support seems to be possible to add in the future, we would not be able to add support for referencing symmetric keys without extending the external ENGINE API. A potential use case might be mod_ssl in Apache, for example, or using OpenSSL scripts that implement basic certification authority together with SCA-6000 hardware keystore. Note that Apache's mod_ssl would need nontrivial changes to make use of RSA keys by reference and such changes are not part of this project. 2.2. Risks and Assumptions: None. 3. Business Summary 3.1. Problem Area: Users are more familiar with the OpenSSL API than the PKCS#11 API or NSS API, and more applications exist using the OpenSSL API than those using the latter ones. It's usually easier to modify an existing application that uses OpenSSL than to develop a new one, possibly using a different API. From those reasons, users are asking for a way to access RSA keys stored in PKCS#11 keystores through the OpenSSL API. 3.3. Business Justification: People who buy SCA-6000 crypto cards very often want to use its HW keystore for RSA keys through OpenSSL API. 4. Technical Description: 4.1. Details: 4.1.1 Overview The OpenSSL ENGINE interface provides 2 functions for accessing private and public keys through an engine from any OpenSSL application: ENGINE_load_private_key(), ENGINE_load_public_key() the identification of the key is in the 1st parameter, "char *key_id", and it is up to the engine how to interpret it. Currently, the PKCS#11 engine supports only RSA keys and "key_id" is interpreted as a filename. The present semantics of the "key_id" parameter will be extended to accept a PKCS#11 URI. Such URI should uniquely identify the key in the PKCS#11 keystore. We will also start accepting "file://" URI to provide a workaround to solve possible clashes with the existing filenames starting with "pkcs11:" prefix. Note that "file://" URI will be only accepted when the engine is used. 4.1.2 PKCS#11 URI The format of PKCS#11 URI was designed in Sun with possible future integration into the PKCS#11 standard in mind, and was discussed openly in the community mailing list. Its format follows. The ordering of attributes is NOT significant but every attribute can can be used at most once. pkcs11:[token=