{"id":543,"date":"2015-12-02T10:38:49","date_gmt":"2015-12-02T18:38:49","guid":{"rendered":"http:\/\/unmitigatedrisk.com\/?p=543"},"modified":"2015-12-05T09:44:14","modified_gmt":"2015-12-05T17:44:14","slug":"pkcs12-needs-another-update","status":"publish","type":"post","link":"https:\/\/unmitigatedrisk.com\/?p=543","title":{"rendered":"The PKCS#12 standard needs another update"},"content":{"rendered":"<p><a href=\"https:\/\/en.wikipedia.org\/wiki\/PKCS_12\"><span style=\"font-weight: 400;\">PKCS#12<\/span><\/a><span style=\"font-weight: 400;\"> is the defacto file format for moving private keys and certificates around. It was defined by RSA and Microsoft in the late 90s and is used by Windows extensively. It was also recently added to <\/span><a href=\"https:\/\/www.oasis-open.org\/committees\/kmip\/\"><span style=\"font-weight: 400;\">KIMP<\/span><\/a><span style=\"font-weight: 400;\"> as a means to export key material.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">As an older format, it was designed with support for algorithms like MD2, MD5, SHA1, RC2, RC4, DES and 3DES. It was recently standardized by <\/span><a href=\"https:\/\/tools.ietf.org\/html\/rfc7292\"><span style=\"font-weight: 400;\">IETF RFC 7292 <\/span><\/a><span style=\"font-weight: 400;\">and the IETF took this opportunity to add support for SHA2 but have not made an accommodation for any mode of AES.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Thankfully PKCS #12 is based on <\/span><a href=\"https:\/\/tools.ietf.org\/html\/rfc5652\"><span style=\"font-weight: 400;\">CMS<\/span><\/a><span style=\"font-weight: 400;\"> which does support AES (see <\/span><a href=\"https:\/\/tools.ietf.org\/html\/rfc3565\"><span style=\"font-weight: 400;\">RFC 3565<\/span><\/a><span style=\"font-weight: 400;\"> and <\/span><a href=\"https:\/\/tools.ietf.org\/html\/rfc5959\"><span style=\"font-weight: 400;\">RFC 5959<\/span><\/a><span style=\"font-weight: 400;\">). In theory, even though RFC 7292 doesn\u2019t specify a need to support AES, \u00a0there is enough information to use it in an interoperable way.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Another standard used by PKCS#12 is PKCS #5 (<\/span><a href=\"https:\/\/www.ietf.org\/rfc\/rfc2898.txt\"><span style=\"font-weight: 400;\">RFC 2898<\/span><\/a><span style=\"font-weight: 400;\">), this specifies the mechanics of password-based encryption. It provides two ways to do this PBES1 and PBES2, more on this later. <\/span><\/p>\n<p><span style=\"font-weight: 400;\">Despite these complexities and constraints, we wanted to see if we could provide a secure and interoperable implementation of PKCS#12 in <a href=\"http:\/\/pkijs.org\/\">PKIjs<\/a> since it is one of the most requested features. This post documents our findings.<\/span><\/p>\n<h1><span style=\"font-weight: 400;\">Observations<\/span><\/h1>\n<h2><span style=\"font-weight: 400;\">Lots of unused options<\/span><\/h2>\n<p><span style=\"font-weight: 400;\">PKCS#12 is the swiss army knife of certificate and key transport. It can carry keys, certificates, CRLs and other metadata. The specification offers both password and certificate-based schemes for privacy and integrity protection.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">This is accomplished by having an outer \u201cintegrity envelope\u201d that may contain many \u201cprivacy envelopes\u201d. <\/span><\/p>\n<p><span style=\"font-weight: 400;\">When using certificates to protect the integrity of its contents, the specification uses the CMS SignedData message to represent this envelope. <\/span><\/p>\n<p>When using passwords it uses an HMAC placed into its own data structure.<\/p>\n<p><span style=\"font-weight: 400;\">The use of an outer envelope containing many different inner envelopes enables the implementor to mix and match various types of protection approaches into a single file. It also enables implementers to use different secrets for integrity and privacy protection.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Despite this flexibility, most implementations only support the following combination:<\/span><\/p>\n<ol>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Optionally using the HMAC mechanism for integrity protection of certificates<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Using password-based privacy protection for keys<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Using the same password for privacy protection of keys<\/span><\/li>\n<\/ol>\n<p style=\"padding-left: 30px;\"><b>NOTE<\/b><span style=\"font-weight: 400;\">: OpenSSL was the only implementation we found that supports the ability to use a different password for the \u201cintegrity envelope\u201d and \u00a0\u201cprivacy envelope\u201d. This is done using the \u201ctwopass\u201d option of the <\/span><b>pkcs12<\/b><span style=\"font-weight: 400;\"> command.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">The formats flexibility is great. We can envision a few different types of scenarios one might be able to create with it, but there appears to be no documented profile making it clear what is necessary to interoperate with other implementations.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">It would be ideal if a future incarnation of the specification provided this information for implementers. <\/span><\/p>\n<h2><span style=\"font-weight: 400;\">Consequences of legacy<\/span><\/h2>\n<p><span style=\"font-weight: 400;\">As mentioned earlier there are two approaches for password based encryption defined in PKCS#5 (<\/span><a href=\"https:\/\/tools.ietf.org\/html\/rfc2898\"><span style=\"font-weight: 400;\">RFC 2989<\/span><\/a><span style=\"font-weight: 400;\">). <\/span><\/p>\n<p><span style=\"font-weight: 400;\">The first is called PBES1, according to the RFC :<\/span><\/p>\n<blockquote><p><i><span style=\"font-weight: 400;\">PBES1 is recommended only for compatibility with existing<\/span><\/i><i><span style=\"font-weight: 400;\"><br \/>\n<\/span><\/i><i><span style=\"font-weight: 400;\">applications, since it supports only two underlying encryption<\/span><\/i><i><span style=\"font-weight: 400;\"><br \/>\n<\/span><\/i><i><span style=\"font-weight: 400;\">schemes, each of which has a key size (56 or 64 bits) that may not be<\/span><\/i><i><span style=\"font-weight: 400;\"><br \/>\n<\/span><\/i><i><span style=\"font-weight: 400;\">large enough for some applications.<\/span><\/i><\/p><\/blockquote>\n<p><span style=\"font-weight: 400;\">The PKCS#12 RFC reinforces this by saying:<\/span><\/p>\n<blockquote><p><i><span style=\"font-weight: 400;\">The procedures and algorithms<\/span><\/i><i><span style=\"font-weight: 400;\"><br \/>\n<\/span><\/i><i><span style=\"font-weight: 400;\">defined in PKCS #5 v2.1 should be used instead.<\/span><\/i><i><span style=\"font-weight: 400;\"><br \/>\n<\/span><\/i><i><span style=\"font-weight: 400;\">Specifically, PBES2 should be used as encryption scheme, with PBKDF2<\/span><\/i><i><span style=\"font-weight: 400;\"><br \/>\n<\/span><\/i><i><span style=\"font-weight: 400;\">as the key derivation function.<\/span><\/i><\/p><\/blockquote>\n<p><span style=\"font-weight: 400;\">With that said it seems, there is no indication in the format on which scheme is used which leaves an implementor forced with trying both options to \u201cjust see which one works\u201d.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Additionally it seems none of the implementations we have encountered followed this advice and only support the PBES1 approach.<\/span><\/p>\n<h2><span style=\"font-weight: 400;\">Cryptographic strength<\/span><\/h2>\n<p><span style=\"font-weight: 400;\">When choosing cryptographic algorithm one of the things you need to be mindful of is the minimum effective strength. There are differing opinions on what each algorithm&#8217;s minimum effective strength is at different key lengths, but normally the difference not significant. These opinions also change as computing power increases along with our ability to break different algorithms.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">When choosing which algorithms to use together you want to make sure all algorithms you use in the construction offer similar security properties If you do not do this the weakest algorithm is the weakest link in the construction. It seems there is no guidance in the standard for topic, as a result we have found:<\/span><\/p>\n<ol>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Files that use weak algorithms protection of strong \u00a0keys,<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Files that use a weaker algorithm for integrity than they do for privacy.<\/span><\/li>\n<\/ol>\n<p><span style=\"font-weight: 400;\">This first point is particularly important. The most recently available guidance for minimum effective key length comes from the German Federal Office for Information Security, BSI. These guidelines, when interpreted in the context of PKCS #12, recommend that a 2048-bit RSA key protection happens using SHA2-256 and a 128-bit symmetric key. <\/span><\/p>\n<p><span style=\"font-weight: 400;\">The strongest symmetric algorithm specified in the PKCS #12 standard is 3DES which only offers an effective strength of 112-bits. \u00a0This means, if you believe the BSI, it is not possible to create a standards compliant PKCS#12 that offer the effective security necessary to protect a 2048-bit RSA key. <\/span><\/p>\n<p><span style=\"font-weight: 400;\">ANSI on the other hand, currently recommends that 100-bit symmetric key is an acceptable minimum strength to protect a 2048-bit RSA key (though this recommendation was made a year earlier than the BSI recommendation).<\/span><\/p>\n<p><span style=\"font-weight: 400;\">So if you believe ANSI, the strongest suite offered by RFC 7292 is strong enough to \u201cadequately\u201d protect such a key, just not a larger one.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">The unfortunate situation we are left with in is that it is not possible to create a \u201cstandards compliant\u201d PKCS12 that support\u00a0modern cryptographic recommendations.<\/span><\/p>\n<h1><span style=\"font-weight: 400;\">Implementations<\/span><\/h1>\n<h2><span style=\"font-weight: 400;\">OpenSSL<\/span><\/h2>\n<p><span style=\"font-weight: 400;\">A while ago OpenSSL was updated to support AES-CBC in PKCS#8 which is the format that PKCS#12 uses to represent keys. \u00a0In an ideal world, we would be using AES-GCM for our interoperability target but we will take what we can get.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">To create such a file you would use a command similar to this:<\/span><\/p>\n<table>\n<tbody>\n<tr>\n<td><span style=\"font-weight: 400;\">rmh$ openssl genrsa 2048|openssl pkcs8 -topk8 -v2 aes-256-cbc -out key.pem<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Generating RSA private key, 2048 bit long modulus<\/span><\/p>\n<p><span style=\"font-weight: 400;\">&#8230;&#8230;&#8230;&#8230;&#8230;+++<\/span><\/p>\n<p><span style=\"font-weight: 400;\">&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;.+++<\/span><\/p>\n<p><span style=\"font-weight: 400;\">e is 65537 (0x10001)<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Enter Encryption Password:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Verifying &#8211; Enter Encryption Password:<\/span><br \/>\n<span style=\"font-weight: 400;\">rmh$ cat key.pem <\/span><\/p>\n<p><span style=\"font-weight: 400;\">&#8212;&#8211;BEGIN ENCRYPTED PRIVATE KEY&#8212;&#8211;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u2026<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u2026<\/span><\/p>\n<p><span style=\"font-weight: 400;\">&#8230;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">&#8212;&#8211;END ENCRYPTED PRIVATE KEY&#8212;&#8211;<\/span><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><span style=\"font-weight: 400;\">If you look at the resulting file with an <\/span><a href=\"https:\/\/lapo.it\/asn1js\"><span style=\"font-weight: 400;\">ASN.1 parser<\/span><\/a><span style=\"font-weight: 400;\"> you will see the file says the Key Encryption Key (KEK) is <\/span><a href=\"http:\/\/www.alvestrand.no\/objectid\/2.16.840.1.101.3.4.1.42.html\"><span style=\"font-weight: 400;\">aes-256-cbc<\/span><\/a><span style=\"font-weight: 400;\">. <\/span><\/p>\n<p><span style=\"font-weight: 400;\">It seems the latest OpenSSL (1.0.2d) will even let us do this with a PKCS#12, those commands would look something like this:<\/span><\/p>\n<table>\n<tbody>\n<tr>\n<td><span style=\"font-weight: 400;\">openssl genrsa 2048|openssl pkcs8 -topk8 -v2 aes-256-cbc -out key.pem<\/span><\/p>\n<p><span style=\"font-weight: 400;\">openssl req -new -key key.pem -out test.csr<\/span><\/p>\n<p><span style=\"font-weight: 400;\">openssl x509 -req -days 365 -in test.csr -signkey key.pem -out test.cer<\/span><\/p>\n<p><span style=\"font-weight: 400;\">openssl pkcs12 -export -inkey key.pem -in test.cer -out test.p12 -certpbe AES-256-CBC -keypbe AES-256-CBC<\/span><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p style=\"padding-left: 30px;\"><b>NOTE<\/b><span style=\"font-weight: 400;\">: If you do not specify explicitly specify the certpbe and keypbe algorithm this version defaults to using <\/span><a href=\"http:\/\/www.alvestrand.no\/objectid\/1.2.840.113549.1.12.1.6.html\"><span style=\"font-weight: 400;\">pbewithSHAAnd40BitRC2-CBC<\/span><\/a><span style=\"font-weight: 400;\"> to protect the certificate and <\/span><a href=\"http:\/\/www.alvestrand.no\/objectid\/1.2.840.113549.1.12.1.3\"><span style=\"font-weight: 400;\">pbeWithSHAAnd3-KeyTripleDES-CBC<\/span><\/a><span style=\"font-weight: 400;\"> to protect the key. <\/span><\/p>\n<p style=\"padding-left: 30px;\"><span style=\"font-weight: 400;\">RC2 was designed in 1987 and has been considered weak for a very long time. 3DES is still considered by many to offer 112-bits of security though in 2015 it is clearly not an algorithm that should still be in use.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Since it supports it OpenSSL should really be updated to use aes-cbc-256 by default and it would be nice if \u00a0support for AES-GCM was also added.<\/span><\/p>\n<p style=\"padding-left: 30px;\"><b>NOTE<\/b><span style=\"font-weight: 400;\">: We also noticed if you specify \u201c-certpbe NONE and -keypbe NONE\u201d (which we would not recommend) that OpenSSL will create a PKCS#12 that uses password-based integrity protection and no privacy protection.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Another unfortunate realization is OpenSSL uses an iteration count of 2048 when deriving a key from a password,\u00a0<\/span><a href=\"http:\/\/security.stackexchange.com\/questions\/3959\/recommended-of-iterations-when-using-pkbdf2-sha256\"><span style=\"font-weight: 400;\">by today\u2019s standards is far too small<\/span><\/a><span style=\"font-weight: 400;\">.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">We also noticed the OpenSSL output of the pkcs12 command does not indicate what algorithms were used to protect the key or the certificate, this may be one reason why the defaults were never changed &#8212; users simply did not notice:<\/span><\/p>\n<table>\n<tbody>\n<tr>\n<td><span style=\"font-weight: 400;\">rmh$ openssl pkcs12 -in windows10_test.pfx <\/span><\/p>\n<p><span style=\"font-weight: 400;\">Enter Import Password:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">MAC verified OK<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Bag Attributes<\/span><\/p>\n<p><span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0localKeyID: 01 00 00 00 <\/span><\/p>\n<p><span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0friendlyName: {4BC68C1A-28E3-41DA-BFDF-07EB52C5D72E}<\/span><\/p>\n<p><span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0Microsoft CSP Name: Microsoft Base Cryptographic Provider v1.0<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Key Attributes<\/span><\/p>\n<p><span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0X509v3 Key Usage: 10 <\/span><\/p>\n<p><span style=\"font-weight: 400;\">Enter PEM pass phrase:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Bag Attributes<\/span><\/p>\n<p><span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0localKeyID: 01 00 00 00 <\/span><\/p>\n<p><span style=\"font-weight: 400;\">subject=\/CN=Test\/O=2\/OU=1\/emailAddress=2@2.com\/C=&lt;\\xD0\\xBE<\/span><\/p>\n<p><span style=\"font-weight: 400;\">issuer=\/CN=Test\/O=2\/OU=1\/emailAddress=2@2.com\/C=&lt;\\xD0\\xBE<\/span><\/p>\n<p><span style=\"font-weight: 400;\">&#8212;&#8211;BEGIN CERTIFICATE&#8212;&#8211;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u2026<\/span><\/p>\n<p><span style=\"font-weight: 400;\">&#8230;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">&#8212;&#8211;END CERTIFICATE&#8212;&#8211;<\/span><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h2><span style=\"font-weight: 400;\">Windows<\/span><\/h2>\n<p><span style=\"font-weight: 400;\">Unfortunately, it seems that all versions of Windows (even Windows 10) still produces PKCS #12\u2019s using <\/span><b>pbeWithSHAAnd3-KeyTripleDES-CBC<\/b><span style=\"font-weight: 400;\"> for \u201cprivacy\u201d of keys and privacy of certificates it uses <\/span><b>pbeWithSHAAnd40BitRC2-CBC<\/b><span style=\"font-weight: 400;\">. It then relies on the HMAC scheme for integrity.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Additionally it seems it only supports PBES1 and not PBES2.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Windows also uses an iteration count of 2048 when deriving keys from passwords which is far too small<\/span><span style=\"font-weight: 400;\">.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">It also seems unlike OpenSSL, Windows is not able to work with files produced with more secure encryption schemes and ciphers.<\/span><\/p>\n<h2><span style=\"font-weight: 400;\">PKIjs<\/span><\/h2>\n<p><span style=\"font-weight: 400;\">PKIjs has two, arguably conflicting goals, the first of which is to enable modern web applications to interoperate with traditional X.509 based applications. The second of which is to use modern and secure options when doing this.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">WebCrypto has a similar set of guiding principles, this is why it does not support weaker algorithms like RC2, RC4 and 3DES.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Instead of bringing in javascript based implementations of these weak algorithms into PKIjs we have decided to only support the algorithms supported by webCrypto (aes-256-cbc, aes-256-gcm with SHA1 or SHA2 using PBES2.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">This represents a tradeoff. The keys and certificates and exported by PKIjs will be protected with the most interoperable and secure pairing of algorithms available but the resulting files will still not work in any version of Windows (even the latest Windows 10 1511 build).<\/span><\/p>\n<p><span style=\"font-weight: 400;\">The profile of PKCS#12 PKIjs creates that will work with OpenSSL will only do so if you the -nomacver option:<\/span><\/p>\n<table>\n<tbody>\n<tr>\n<td><span style=\"font-weight: 400;\">openssl pkcs12 -in pkijs_pkcs12.pfx -nomacver\u2028<\/span><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><span style=\"font-weight: 400;\">This is because OpenSSL uses the older PBKDF1 for integrity protection and PKIjs is using the newer PBKDF2, as a result of this command integrity will not be checked on the PKCS#12.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">With that caveat, here is an example of how one would generate a <\/span><span style=\"font-weight: 400;\"><a href=\"https:\/\/pkijs.org\/examples\/PKCS12SimpleExample.html\">PKCS#12 with PKIjs<\/a>.<\/span><\/p>\n<h1><span style=\"font-weight: 400;\">Summary<\/span><\/h1>\n<p><span style=\"font-weight: 400;\">Despite its <\/span><a href=\"https:\/\/www.cs.auckland.ac.nz\/~pgut001\/pubs\/pfx.html\"><span style=\"font-weight: 400;\">rocky start<\/span><\/a><span style=\"font-weight: 400;\">, PKCS#12 is still arguably one of the most important cryptographic message formats. An attempt has been made to modernize it somewhat, but they did not go far enough.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">It also seems OpenSSL has made an attempt to work around this gap by adding support for AES-CBC to their implementation.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Windows on the other hand still only appear to support only the older encryption construct with the weaker ciphers.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">That said even when strong, modern cryptography are in use we must remember any password-based encryption scheme will only be as secure as the password that is used with it. As a proof point,\u00a0consider these tools for <\/span><a href=\"http:\/\/sourceforge.net\/projects\/crackpkcs12\/\"><span style=\"font-weight: 400;\">PKCS#12<\/span><\/a><span style=\"font-weight: 400;\"> and <\/span><a href=\"https:\/\/github.com\/robertdavidgraham\/pemcrack\"><span style=\"font-weight: 400;\">PKCS#8<\/span><\/a><span style=\"font-weight: 400;\"> that make password cracking trivial for these formats.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">We believe the storage and transport of encrypted private keys is an important enough topic that it deserves a modern and secure standard. With that in mind recommend the following changes to RFC 7292 be made:<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Deprecate the use of all weaker algorithms,<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Make it clear both AES-CBC and AES-GCM should be supported,<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Make it clear what the minimal profile of this fairly complex standard is,<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Require the support of PBES2,<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Be explicit and provide modern <\/span><a href=\"http:\/\/unmitigatedrisk.com\/?p=543\"><span style=\"font-weight: 400;\">key stretching guidance for use with PBKDF2<\/span><\/a><span style=\"font-weight: 400;\">,<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Clarify how one uses PBMAC1 for integrity protection,<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Require that the certificates and the keys are both protected with the same or equally secure mechanisms.<\/span><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400;\">As for users, there are a few things you can do to protect yourself from the associated issues discussed here, some of which include:<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Do not use passwords to protect your private keys. Instead generated symmetric keys or generated passwords of an appropriate lengths (e.g. \u201copenssl rand -base64 32\u201d),<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">When using OpenSSL always specify which algorithms are being used when creating your PKCS#12 files and double check those are actually the algorithms being used,<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Ensure that the algorithms you are choosing to protect your keys offer a minimum effective key length equal to or greater than the keys you will protect,<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Securely delete any intermediate copies of keys or inputs to the key generation or export process.<\/span><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400;\">Ryan &amp; Yury<\/span><\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>PKCS#12 is the defacto file format for moving private keys and certificates around. It was defined by RSA and Microsoft in the late 90s and is used by Windows extensively. It was also recently added to KIMP as a means to export key material. As an older format, it was designed with support for algorithms [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[26,12,3,1],"tags":[32,118,187,124],"class_list":["post-543","post","type-post","status-publish","format-standard","hentry","category-opensource","category-programming","category-security","category-uncategorized","tag-cryptography","tag-javascript","tag-pkcs12","tag-pkijs"],"_links":{"self":[{"href":"https:\/\/unmitigatedrisk.com\/index.php?rest_route=\/wp\/v2\/posts\/543","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unmitigatedrisk.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unmitigatedrisk.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unmitigatedrisk.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/unmitigatedrisk.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=543"}],"version-history":[{"count":0,"href":"https:\/\/unmitigatedrisk.com\/index.php?rest_route=\/wp\/v2\/posts\/543\/revisions"}],"wp:attachment":[{"href":"https:\/\/unmitigatedrisk.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=543"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unmitigatedrisk.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=543"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unmitigatedrisk.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=543"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}