Using a Cryptographic Hardware Token with Linux: the OpenSSL Project's New Engin
Public Key Infrastructure (PKI) is a critical technology in today's computer oriented world. Without it there would be no secure e-commerce transactions or secure connections. Remember the days when clear-text passwords regularly flew across the Net? That's history now due to the increasing diligence of "bad people" sniffing the Net, looking for potential security loopholes to exploit. These days, paranoia is the normal state for computer security, and PKI plays a role in helping to ease that paranoia.
PKI provides a high level of protection by allowing the signing of e-mails, encryption of sockets and other cryptographic functions. A large standards base has evolved around PKI, and the open-source domain has taken on the task of implementing those standards to a high degree. PKI is based on the now well known public/private key-pair interaction. In this interaction a public/private key-pair is generated, and the public-key is used by external entities to verify data signed or encrypted by the private key. The private-key is held securely by the owner. The key can be held secure by a passphrase on either an encrypted file or a hardware token.
Another important component of PKI is a certificate (X.509 format), a document that is signed by a known authority (known as a certificate authority or CA) and says the originator of the public-key is who they really say they are. In order to obtain a valid certificate, the key-pair owner must sign a certificate request using their private-key and send it to the CA. The certificate request provides the certificate authority with information about the owner of the key and a copy of the public-key.
With this background, I can start explaining our adventure with PKI. A client wanted to provide digitally signed e-mails for critical data originating from a Linux PC. The critical data had to arrive at a site and be assured that it originated from a given Linux PC. The client needed to perform this task using S/MIME, a standard designed for this purpose (see glossary). The client also wanted to use a hardware cryptographic token for security reasons. Hardware tokens are nearly tamper proof and assure that the data are originating from a given Linux PC provided that the token is plugged into it. Tamper switches on the PC and the token prevented either from being moved without authorities' knowledge.
Since my company prefers to start with open source tools, rather than dive into proprietary libraries or write new code from the "ground up", we quickly discovered the OpenSSL project. The OpenSSL project supported almost all of the necessary components needed to complete our client's project. I say almost all, otherwise our story would have ended here and proven rather boring. The client required the ability to store a 1,024-bit DSA private-key on a specific PCMCIA-based hardware token, generate a certificate request and then, using the certificate and the private-key, clear sign an e-mail using the S/MIME format.
As luck would have it, back in September 2000, the OpenSSL project released version 0.9.6 and a parallel release that included an engine component. The engine component caught our eye because it dealt with using cryptographic hardware tokens. Sadly, the token we were requested to integrate, the Chrysalis-ITS Luna2 PC card, was not on the list of the three tokens implemented in the engine. This forced us to go under the hood of the OpenSSL engine code.
Chrysalis-ITS provided our client with the libraries needed to interact with their token under both Solaris and Linux and the OpenSSL code-base compiles for both. Chrysalis-ITS's Luna2 toolkit library is based on the PKCS#11 standard that is documented by RSA Laboratories. The PKCS#11 is a C/C++ programming standard library for using a cryptographic hardware token with public-key technology. A quick e-mail to the author of the OpenSSL engine component, Geoff Thorpe, confirmed that it would be possible to use a PKCS#11 library with the way the engine was designed. Unfortunately, none of the other 3 cards implemented in the engine were using this standard library (they all had proprietary libraries), so we had to develop an engine implementation without any example code.
Actually, it is not true that we didn't have any example code to work with; we had access to the implementations for the other three hardware tokens. We also had done some work with the PKCS#11 library for the Luna2 token. However, each of these other hardware tokens used RSA (see glossary) and not DSA as the cryptographic mechanism. It seems RSA is the more prevalent method because it is a stronger cryptographic mechanism than DSA. One step forward with an example, but two steps backward since none implemented DSA. However, the CryptoSwift token implementation in OpenSSL, by Geoff Thorpe, did provide a DSA acceleration, so this was the best starting point to implement a solution for the Luna2.
It's interesting to watch different people's approaches to integrating systems. Some like to sit down and spend time reading manuals, and others like to dive in and get into the guts. I am one of the latter types. Rather than rely on reading volumes of manuals to understand how something is glued together, I prefer to run through the code with a debugger (ups is my particular favorite open source debugger). That way I can step in and out of all the functions, look at structures and see all the details being passed around. Once I get a handle on how it all glues together, I proceed to the manuals to get more specifics on code not presented clearly. While the OpenSSL project is doing a great job, some of the documentation on the cryptographic library (libcrypto) is a bit sparse. After testing the command line OpenSSL interface by running all of the tasks, without using the engine (using only text files holding the keys), I had a pretty good understanding of the way it was pieced together.
I next implemented the necessary engine structures for the token and tied the PKCS#11 calls to the appropriate functions. The only conversions necessary were the data types from the native PKCS#11 data into the OpenSSL values. The tricky part was binding all of the necessary PKCS#11 function calls dynamically at run time to the OpenSSL engine.
Today’s modular x86 servers are compute-centric, designed as a least common denominator to support a wide range of IT workloads. Those generic, virtualized IT workloads have much different resource optimization requirements than hyperscale and cloud applications. They have resulted in a “one size fits all” enterprise IT architecture that is not optimized for a specific set of IT workloads, and especially not emerging hyperscale workloads, such as web applications, big data, and object storage. In this report, you will learn how shifting the focus from traditional compute-centric IT architectures to an innovative disaggregated fabric-based architecture can optimize and scale your data center.
Sponsored by AMD
Built-in forensics, incident response, and security with Red Hat Enterprise Linux 6
Every security policy provides guidance and requirements for ensuring adequate protection of information and data, as well as high-level technical and administrative security requirements for a system in a given environment. Traditionally, providing security for a system focuses on the confidentiality of the information on it. However, protecting the data integrity and system and data availability is just as important. For example, when processing United States intelligence information, there are three attributes that require protection: confidentiality, integrity, and availability.
Learn more about catching the bad guy in this free white paper.
Sponsored by DLT Solutions
| Making Linux and Android Get Along (It's Not as Hard as It Sounds) | May 16, 2013 |
| Drupal Is a Framework: Why Everyone Needs to Understand This | May 15, 2013 |
| Home, My Backup Data Center | May 13, 2013 |
| Non-Linux FOSS: Seashore | May 10, 2013 |
| Trying to Tame the Tablet | May 08, 2013 |
| Dart: a New Web Programming Experience | May 07, 2013 |
- New Products
- Making Linux and Android Get Along (It's Not as Hard as It Sounds)
- Drupal Is a Framework: Why Everyone Needs to Understand This
- A Topic for Discussion - Open Source Feature-Richness?
- Home, My Backup Data Center
- What's the tweeting protocol?
- New Products
- RSS Feeds
- Readers' Choice Awards
- Dart: a New Web Programming Experience
Free Webinar: Linux Backup and Recovery
Most companies incorporate backup procedures for critical data, which can be restored quickly if a loss occurs. However, fewer companies are prepared for catastrophic system failures, in which they lose all data, the entire operating system, applications, settings, patches and more, reducing their system(s) to “bare metal.” After all, before data can be restored to a system, there must be a system to restore it to.
In this one hour webinar, learn how to enhance your existing backup strategies for better disaster recovery preparedness using Storix System Backup Administrator (SBAdmin), a highly flexible bare-metal recovery solution for UNIX and Linux systems.



12 hours 15 min ago
14 hours 48 min ago
16 hours 5 min ago
16 hours 40 min ago
17 hours 2 min ago
21 hours 51 min ago
22 hours 38 min ago
1 day 11 min ago
1 day 1 hour ago
1 day 3 hours ago