GlobalSign Blog

Cryptographic Key Storage Options & Best Practices

Cryptographic Key Storage Options & Best Practices

Use of PKI-based solutions continues to grow – more sites than ever are moving to HTTPS, enterprises are leveraging Digital Certificates as an authentication factor for users and machines, S/MIME is proving its worth as both an email encryption option and a way to validate the source of emails to counter phishing – but the encryption and authentication underlying these applications can be completely undermined if proper key management isn’t enforced.

Every time a Digital Certificate is issued, whether from a CA or self-signed, a private/public key pair must be generated. Best practice indicates that your private key(s) should remain secure and, well…private! Should anyone get a hold of it, depending on the certificate type, they could create phishing websites with your organization’s certificate in the address bar, authenticate to corporate networks by impersonating you, sign applications or documents in your name, or read your encrypted emails.

In many cases, your private keys are your employees’ identities (and therefore also an extension of your organization’s identity) and protecting them equates to protecting your fingerprints when using biometric credentials. You wouldn’t allow a hacker to get hold of your fingerprint, why let them have your private key?

In this post, we’ll discuss your options for private key protection and storage. As you’ll see, these can vary slightly depending on the type of certificate(s) and what you will use it for (e.g. best practices for SSL/TLS Certificates are different than those for end user certificates). 

Operating System and Browser Certificate/Key Stores

Examples: Windows Certificate Store, Mac OS Keychain

Several operating systems and browsers provide certificate or key stores. These are software-based databases that store your public/private keypair, as part of a certificate, locally on your machine. This type of key storage is quite popular because many applications know to look here automatically, rather than you manually looking for the certificate file each time, so it’s a fairly user-friendly option. 

Another appeal of this option is it’s fairly easy to customize – you can enable/disable private key exportability, enable strong private key protection (prompts for password every time your certificate is used) and you can create back-ups if your private key is exportable. Also, for Windows users, by enabling profile-roaming, your certificate is tied to your profile and available for use if you sign into another machine with that profile.

If you choose to go this route for your key storage, you should be aware of the following considerations. First, even if you mark your private key as non-exportable, there are utilities that can circumvent this protection (i.e. non-exportability is not 100% guaranteed). Also, if someone accessed your Windows account and you didn’t have strong private key protection enabled (no password required to use your certificate), they could use your certificate. Finally, if your private key is marked as exportable, someone using your machine would be able to export it. Even if you have private key protection enabled, they wouldn’t have to enter the password to export.

One final note is that Chrome and IE both use the Windows Certificate Store, while Firefox uses its own certificate store (provided by Mozilla). This means if you import into the Windows Store, Chrome and IE will automatically find your certificate, but Firefox will not.

Commonly Used For:

  • Applications for Digital Signing (e.g. Adobe Acrobat, Microsoft Outlook and Office will look to Windows [user] Certificate Store).
  • Microsoft IIS (Windows server) also looks to the Windows [machine] Certificate Store for SSL Certificates
  • Client Authentication (user or machine), depending on how it’s set up, most commonly looks to Windows ] Certificate Store.
  • Windows Code Signing (signing applications or drivers).

.pfx and .jks Files (Keystores)

PKCS#12 (.pfx or .p12) and .jks* (created by the Java keytool) are files containing your public/private keypair. Unlike the locally-stored OS and browser keystores, these files can be stored virtually anywhere, including remote servers and are always password protected (meaning any time you want to use your private key, you have to enter a password).  Another appeal is that since these are ultimately just files, you can easily distribute copies if you have multiple people who need to use the certificate.

If you decide to store your file on a remote server, you should take extra care to restrict access to it. If someone were able to gain access, they would be able to use your certificate. On a similar note, you should also be careful with the ease of duplication and distribution these files offer. While that can be a great convenience, it also means if someone gets their hands on your keystore, it wouldn’t be difficult to make and steal a copy. The private key password is still required for the copied file to be used effectively. This is yet another reason to use strong passwords with 15+ characters containing mixed-case letters, numbers and special characters. Another thing to consider with this storage option is that it leaves a lot of responsibility in the hands of the end user, in terms of where the file lives and whether it is properly stored.

If you can’t use cryptographic hardware or the Windows keystore (described above), but still want to enhance security (rather than just having the keystore file sitting on your machine), you can store these files on a removable thumb drive that you keep in a secure location. Of course, convenience is the counterpoint to this – if you do a lot of signing, you may want to keep the file local for easier access.

Commonly Used For:

  • Windows or Java Code Signing.
  • FDA ESG and IRS IDES both use .pfx for secure communications to government services.
  • Some webservers (e.g. Apache Tomcat or Jboss). 

*Note: It looks like Java is planning to transition from JKS to PKCS#12 as the default keystore type, but no launch date has been announced.

Cryptographic Tokens and Smart Cards

As hinted above, storing your private key on hardware can offer increased security. However, there is a big difference between using cryptographic tokens or smart cards and standard flash or thumb drives. With cryptographic hardware, the key is generated on the hardware itself and is not exportable. This means the private key never leaves the device, making it much more difficult for someone to access and compromise.

Note: If you want to leverage the extra security of crypto hardware for a private key that has already been generated (i.e. not generated on the token itself), you can import a .pfx file and then delete the original .pfx.

Using a crypto token will also prompt for a password each time you want to use your certificate. This means even if someone gets a hold of your token, they would still need your password before being able to use it. Storing your key on a token means you can also securely use the same certificate across multiple machines without having to make multiple copies and going through the export/import process. Cryptographic hardware can also help meet FIPS compliance, which is required for some industry and government regulations.

Of course, there are some other considerations to keep in mind if you decide to go this route…did you cringe at the first mention of hardware? Aside from managing the tokens, you should also know that this option might not work with automated builds because of the password requirement each time the certificate is used. There is also no way to back-up the certificate since the private key isn’t exportable (the downside to that extra security). Finally, there are some fringe scenarios where this storage option may not be ideal, including specialized appliances that don’t support tokens or smart cards and situations where employees do not have physical access to the computer, but are using a remote terminal.

Commonly Used For:

Generally, all use cases mentioned above for OS/browser keystores (Document Signing, Code Signing, Client Authentication, Windows IIS) are supported by crypto tokens or smart cards - as long as there’s a driver on the crypto token that can make a connection to your OS/browser certificate store, it can serve the same purpose. However, this might not always be practical (e.g. webservers, automated build processes for code signing that require a password each time a signature is applied).

Compliance is one of the leading reasons for using crypto tokens.

  • Required for Extended Validation (EV) Code Signing, as per CA/Browser Forum Guidelines.
  • Recommended for standard Code Signing, as per CA Security Council Minimum Requirements - Certificate Authorities are obligated to recommend crypto hardware as the primary issuance option. If not issued on crypto hardware, an agreement must be obtained from the customer that they will store the private key on some kind of removable hardware (that they remove when signing isn’t taking place)
  • Required for Digital Signatures to be publicly trusted in Adobe products, as per Adobe Approved Trust List (AATL) requirements.
  • Industry-specific regulations, such as the FDA’s CFR 21 Part 11 and state engineering Digital Signature requirements, often have language about the private key remaining in sole possession of the owner. Storing on crypto hardware meets these requirements.  

Hardware Security Modules (HSM)

HSMs are another cryptographic hardware-based option for key storage, especially if you don’t want to, or it would be too cumbersome to rely on individual tokens. While tokens are more geared toward end users with manual or one-off applications (e.g. signing lower volumes of documents or code, authenticating to VPNs or other networks), HSMs use APIs and can support automated workflows and builds. They can also help meet FIPS compliance and generally offer a higher rating than tokens.

Traditionally, HSMs are physical appliances located on-premises, requiring internal resources to manage and ensure baseline requirements and SLAs are met. This can get costly and resource-intensive, which has hindered adoption in the past. Fortunately, recent years have seen the emergence of cloud-based HSMs, which offer many of the same benefits as on-premises HSMs without requiring internal maintenance.

An example of this that you may be familiar with is Microsoft Azure’s Key Vault, which can safeguard your cryptographic keys in Microsoft’s own cloud HSM. If you are a smaller organization without the ability to purchase and manage your own HSM, this is a great solution and can be integrated with public CAs, including GlobalSign.

If you are looking at the document signing use case, you should also know that we recently launched a new Digital Signing Service, which also leverages cloud-based HSM storage for the private keys. It’s also worth noting that the new service can support individual signing identities. In the past, most HSM-based digital signing scenarios could only use a department or organization level identity (e.g. Accounting, Marketing, Finance), rather than an individual identity (e.g. John Doe). This meant organizations who needed employee credentials had to rely on tokens, which as we noted above, can be cumbersome to manage. With this new service, you can enable individual employee Digital Signatures without any hardware to manage (or for your employees to lose). 

Commonly Used For:

  • High volume Document or Code Signing.
  • SSL (dependent on server configuration).
  • CA infrastructure for running in-house CA (root CA, sub-CA, RFC 3161 Timestamping server) – one may be offline, one online (root CA is generally offline).

Looking Ahead - Next Generation Key Storage Methods

The key storage options discussed above are somewhat traditional methods that have been used for years. However, just like seemingly everything else in the world of information security, key storage is not immune to the IoT’s influence and new options are being developed accordingly.

As more and more devices are coming online with the need to authenticate themselves and communicate securely, many developers and manufacturers are turning to PKI-based solutions, which in turn is bringing about new considerations, requirements and technologies for protecting private keys. Below are two trends we’ve seen emerge.  

Trusted Platform Modules (TPM)

TPMs themselves are not new, but leveraging them for private key protection is gaining increasing use. A TPM can be used to store (or wrap) the root key and protects additional keys created by an application. The application keys cannot be used without the TPM, making this a very useful authentication method for endpoints like laptops, servers and IoT device manufacturers. While many laptops currently ship with TPMs today, we haven’t see much adoption in the enterprise space. We do see them a lot in the IoT space, however, where they’re used as a hardware root of trust for secure device identity.

The IoT has created a challenge where so many devices communicating anonymously are making it easier for hackers to intercept communications or pose as these devices. Because a chip can be introduced as early as in the manufacturing process it can be leveraged to protecting the device cryptographic key and hence the identity of the device.

During manufacturing, the device generates a private and public key pair. The public key is sent to the CA for signing and issuing a Digital Certificate. The private key never leaves the device and is stored securely on the chip and cannot be exported/copied/destroyed. The certificate is now the identity of the device, and the protected private key forms the hardware-based root of trust.

We’ve been working closely with our partner Infineon to develop IoT solutions that combine PKI-based device identities with TPM-based roots of trust. For more information, check out our Proof of Concept: Securely authenticating to and controlling hardware using GlobalSign's cloud-based Certificate Services and Infineon's OPTIGA™ TPM.

Physically Unclonable Functions (PUF)

Physical Unclonable Function (PUF) technology represents a paradigm shift in key protection.  Instead of keys being stored (where they are susceptible to physical attack), keys are instead derived from unique physical properties of a chip’s SRAM memory and exist only when powered up. That is, rather than securely storing the private key, the same key can be regenerated over and over again (for the lifetime of the device) on demand. Using an SRAM-based PUF, these are guaranteed to be unique since they utilize the inherent randomness in silicon bit patterns.

PUF technology in conjunction with a Trusted Execution Environment (TEE) presents an attractive solution to market needs demand for low-cost, easy-to-integrate ultra-secure key protection.  PUF in conjunction with PKI presents a comprehensive solution for identity.

Our partner, Intrinsic ID has created such a key provisioning system based on SRAM PUF that produces unique, unspoofable, unclonable device fingerprints identities rooted in hardware. Using our certificate services, we are able to bootstrap these fingerprints into digital identities and add PKI capabilities. Thus, each device ends up with a unique, uncloneable keypair that is not stored on the device when powered-off - but the same key can be regenerated on demand. This protects from attacks while the device (and its security) is powered down.

For more information about our joint IoT device identity solution, check out our recent webinar: Strong Device Identities through SRAM PUF-based Certificates.

Don't Lose the (Private) Keys to Your Castle!

Private key storage shouldn’t be a dark art. Ultimately, the right option for you is going to depend on who’s using the certificates and what they’re used for, any regulations you need to comply with, costs, and your current environment and available internal resources, and I hope this post will help guide you through your decision. 

Have questions about any of the methods discussed above or need help deciding which one is right for you? Talk to us today!

Share this Post

Recent Blogs