<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>https://wiki.owasp.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Crashedmind</id>
		<title>OWASP - User contributions [en]</title>
		<link rel="self" type="application/atom+xml" href="https://wiki.owasp.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Crashedmind"/>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php/Special:Contributions/Crashedmind"/>
		<updated>2026-04-25T11:44:34Z</updated>
		<subtitle>User contributions</subtitle>
		<generator>MediaWiki 1.27.2</generator>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Transport_Layer_Protection_Cheat_Sheet&amp;diff=190507</id>
		<title>Transport Layer Protection Cheat Sheet</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Transport_Layer_Protection_Cheat_Sheet&amp;diff=190507"/>
				<updated>2015-03-01T18:13:47Z</updated>
		
		<summary type="html">&lt;p&gt;Crashedmind: 'expanded on &amp;quot;favour GCM over CBC&amp;quot;.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt; __NOTOC__&lt;br /&gt;
&amp;lt;div style=&amp;quot;width:100%;height:160px;border:0,margin:0;overflow: hidden;&amp;quot;&amp;gt;[[File:Cheatsheets-header.jpg|link=]]&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;padding: 0;margin:0;margin-top:10px;text-align:left;&amp;quot; |-&lt;br /&gt;
| valign=&amp;quot;top&amp;quot;  style=&amp;quot;border-right: 1px dotted gray;padding-right:25px;&amp;quot; |&lt;br /&gt;
Last revision (mm/dd/yy): '''{{REVISIONMONTH}}/{{REVISIONDAY}}/{{REVISIONYEAR}}''' &lt;br /&gt;
= Introduction  =&lt;br /&gt;
 __TOC__{{TOC hidden}}&lt;br /&gt;
&lt;br /&gt;
This cheat sheet provides a simple model to follow when implementing transport layer protection for an application. Although the concept of SSL is known to many, the actual details and security specific decisions of implementation are often poorly understood and frequently result in insecure deployments. This article establishes clear rules which provide guidance on securely designing and configuring transport layer security for an application. This article is focused on the use of SSL/TLS between a web application and a web browser, but we also encourage the use of SSL/TLS or other network encryption technologies, such as VPN, on back end and other non-browser based connections.&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
== Architectural Decision  ==&lt;br /&gt;
&lt;br /&gt;
An architectural decision must be made to determine the appropriate method to protect data when it is being transmitted.  The most common options available to corporations are Virtual Private Networks (VPN) or a SSL/TLS model commonly used by web applications. The selected model is determined by the business needs of the particular organization. For example, a VPN connection may be the best design for a partnership between two companies that includes mutual access to a shared server over a variety of protocols. Conversely, an Internet facing enterprise web application would likely be best served by a SSL/TLS model. &lt;br /&gt;
&lt;br /&gt;
This cheat sheet will focus on security considerations when the SSL/TLS model is selected. This is a frequently used model for publicly accessible web applications.&lt;br /&gt;
&lt;br /&gt;
= Providing Transport Layer Protection with SSL/TLS  =&lt;br /&gt;
&lt;br /&gt;
== Benefits  ==&lt;br /&gt;
&lt;br /&gt;
The primary benefit of transport layer security is the protection of web application data from unauthorized disclosure and modification when it is transmitted between clients (web browsers) and the web application server, and between the web application server and back end and other non-browser based enterprise components. &lt;br /&gt;
&lt;br /&gt;
The server validation component of TLS provides authentication of the server to the client.  If configured to require client side certificates, TLS can also play a role in client authentication to the server. However, in practice client side certificates are not often used in lieu of username and password based authentication models for clients.&lt;br /&gt;
&lt;br /&gt;
TLS also provides two additional benefits that are commonly overlooked; integrity guarantees and replay prevention. A TLS stream of communication contains built-in controls to prevent tampering with any portion of the encrypted data. In addition, controls are also built-in to prevent a captured stream of TLS data from being replayed at a later time.&lt;br /&gt;
&lt;br /&gt;
It should be noted that TLS provides the above guarantees to data during transmission. TLS does not offer any of these security benefits to data that is at rest. Therefore appropriate security controls must be added to protect data while at rest within the application or within data stores.&lt;br /&gt;
&lt;br /&gt;
== Basic Requirements ==&lt;br /&gt;
&lt;br /&gt;
The basic requirements for using TLS are: access to a Public Key Infrastructure (PKI) in order to obtain certificates, access to a directory or an Online Certificate Status Protocol (OCSP) responder in order to check certificate revocation status, and agreement/ability to support a minimum configuration of protocol versions and protocol options for each version.&lt;br /&gt;
&lt;br /&gt;
== SSL vs. TLS  ==&lt;br /&gt;
&lt;br /&gt;
The terms, Secure Socket Layer (SSL) and Transport Layer Security (TLS) are often used interchangeably. In fact, SSL v3.1 is equivalent to TLS v1.0. However, different versions of SSL and TLS are supported by modern web browsers and by most modern web frameworks and platforms. For the purposes of this cheat sheet we will refer to the technology generically as TLS. Recommendations regarding the use of SSL and TLS protocols, as well as browser support for TLS, can be found in the rule below titled [[Transport_Layer_Protection_Cheat_Sheet#Rule_-_Only_Support_Strong_Protocols| &amp;quot;Only Support Strong Protocols&amp;quot;]].&lt;br /&gt;
&lt;br /&gt;
[[Image:Asvs_cryptomodule.gif|thumb|350px|right|Cryptomodule Parts and Operation]]&lt;br /&gt;
&lt;br /&gt;
== When to Use a FIPS 140-2 Validated Cryptomodule ==&lt;br /&gt;
&lt;br /&gt;
If the web application may be the target of determined attackers (a common threat model for Internet accessible applications handling sensitive data), it is strongly advised to use TLS services that are provided by [http://csrc.nist.gov/groups/STM/cmvp/validation.html FIPS 140-2 validated cryptomodules]. &lt;br /&gt;
&lt;br /&gt;
A cryptomodule, whether it is a software library or a hardware device, basically consists of three parts:&lt;br /&gt;
&lt;br /&gt;
* Components that implement cryptographic algorithms (symmetric and asymmetric algorithms, hash algorithms, random number generator algorithms, and message authentication code algorithms) &lt;br /&gt;
* Components that call and manage cryptographic functions (inputs and outputs include cryptographic keys and so-called critical security parameters) &lt;br /&gt;
* A physical container around the components that implement cryptographic algorithms and the components that call and manage cryptographic functions&lt;br /&gt;
&lt;br /&gt;
The security of a cryptomodule and its services (and the web applications that call the cryptomodule) depend on the correct implementation and integration of each of these three parts. In addition, the cryptomodule must be used and accessed securely. The includes consideration for:&lt;br /&gt;
&lt;br /&gt;
* Calling and managing cryptographic functions&lt;br /&gt;
* Securely Handling inputs and output&lt;br /&gt;
* Ensuring the secure construction of the physical container around the components&lt;br /&gt;
&lt;br /&gt;
In order to leverage the benefits of TLS it is important to use a TLS service (e.g. library, web framework, web application server) which has been FIPS 140-2 validated. In addition, the cryptomodule must be installed, configured and operated in either an approved or an allowed mode to provide a high degree of certainty that the FIPS 140-2 validated cryptomodule is providing the expected security services in the expected manner.&lt;br /&gt;
&lt;br /&gt;
If the system is legally required to use FIPS 140-2 encryption (e.g., owned or operated by or on behalf of the U.S. Government) then TLS must be used and SSL disabled. Details on why SSL is unacceptable are described in Section 7.1 of [http://csrc.nist.gov/groups/STM/cmvp/documents/fips140-2/FIPS1402IG.pdf Implementation Guidance for FIPS PUB 140-2 and the Cryptographic Module Validation Program].&lt;br /&gt;
&lt;br /&gt;
Further reading on the use of TLS to protect highly sensitive data against determined attackers can be viewed in [http://csrc.nist.gov/publications/nistpubs/800-52/SP800-52.pdf SP800-52 Guidelines for the Selection and Use of Transport Layer Security (TLS) Implementations]&lt;br /&gt;
&lt;br /&gt;
== Secure Server Design  ==&lt;br /&gt;
&lt;br /&gt;
=== Rule - Use TLS for All Login Pages and All Authenticated Pages  ===&lt;br /&gt;
&lt;br /&gt;
The login page and all subsequent authenticated pages must be exclusively accessed over TLS. The initial login page, referred to as the &amp;quot;login landing page&amp;quot;, must be served over TLS. Failure to utilize TLS for the login landing page allows an attacker to modify the login form action, causing the user's credentials to be posted to an arbitrary location. Failure to utilize TLS for authenticated pages after the login enables an attacker to view the unencrypted session ID and compromise the user's authenticated session. &lt;br /&gt;
&lt;br /&gt;
=== Rule - Use TLS on Any Networks (External and Internal) Transmitting Sensitive Data  ===&lt;br /&gt;
&lt;br /&gt;
All networks, both external and internal, which transmit sensitive data must utilize TLS or an equivalent transport layer security mechanism. It is not sufficient to claim that access to the internal network is &amp;quot;restricted to employees&amp;quot;. Numerous recent data compromises have shown that the internal network can be breached by attackers. In these attacks, sniffers have been installed to access unencrypted sensitive data sent on the internal network. &lt;br /&gt;
&lt;br /&gt;
=== Rule - Do Not Provide Non-TLS Pages for Secure Content  ===&lt;br /&gt;
&lt;br /&gt;
All pages which are available over TLS must not be available over a non-TLS connection. A user may inadvertently bookmark or manually type a URL to a HTTP page (e.g. http://example.com/myaccount) within the authenticated portion of the application. If this request is processed by the application then the response, and any sensitive data, would be returned to the user over the clear text HTTP.&lt;br /&gt;
&lt;br /&gt;
=== Rule - REMOVED - Do Not Perform Redirects from Non-TLS Page to TLS Login Page  ===&lt;br /&gt;
&lt;br /&gt;
This recommendation has been removed. Ultimately, the below guidance will only provide user education and cannot provide any technical controls to protect the user against a man-in-the-middle attack.  &lt;br /&gt;
&lt;br /&gt;
--&lt;br /&gt;
&lt;br /&gt;
A common practice is to redirect users that have requested a non-TLS version of the login page to the TLS version (e.g. http://example.com/login redirects to https://example.com/login). This practice creates an additional attack vector for a man in the middle attack. In addition, redirecting from non-TLS versions to the TLS version reinforces to the user that the practice of requesting the non-TLS page is acceptable and secure.&lt;br /&gt;
&lt;br /&gt;
In this scenario, the man-in-the-middle attack is used by the attacker to intercept the non-TLS to TLS redirect message. The attacker then injects the HTML of the actual login page and changes the form to post over unencrypted HTTP. This allows the attacker to view the user's credentials as they are transmitted in the clear.&lt;br /&gt;
&lt;br /&gt;
It is recommended to display a security warning message to the user whenever the non-TLS login page is requested. This security warning should urge the user to always type &amp;quot;HTTPS&amp;quot; into the browser or bookmark the secure login page.  This approach will help educate users on the correct and most secure method of accessing the application.&lt;br /&gt;
&lt;br /&gt;
Currently there are no controls that an application can enforce to entirely mitigate this risk. Ultimately, this issue is the responsibility of the user since the application cannot prevent the user from initially typing [http://owasp.org http://example.com/login] (versus HTTPS). &lt;br /&gt;
&lt;br /&gt;
Note: [http://www.w3.org/Security/wiki/Strict_Transport_Security Strict Transport Security] will address this issue and will provide a server side control to instruct supporting browsers that the site should only be accessed over HTTPS&lt;br /&gt;
&lt;br /&gt;
=== Rule - Do Not Mix TLS and Non-TLS Content  ===&lt;br /&gt;
&lt;br /&gt;
A page that is available over TLS must be comprised completely of content which is transmitted over TLS. The page must not contain any content that is transmitted over unencrypted HTTP. This includes content from unrelated third party sites. &lt;br /&gt;
&lt;br /&gt;
An attacker could intercept any of the data transmitted over the unencrypted HTTP and inject malicious content into the user's page. This malicious content would be included in the page even if the overall page is served over TLS. In addition, an attacker could steal the user's session cookie that is transmitted with any non-TLS requests. This is possible if the cookie's 'secure' flag is not set. See the rule 'Use &amp;quot;Secure&amp;quot; Cookie Flag'&lt;br /&gt;
&lt;br /&gt;
=== Rule - Use &amp;quot;Secure&amp;quot; Cookie Flag  ===&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;Secure&amp;quot; flag must be set for all user cookies. Failure to use the &amp;quot;secure&amp;quot; flag enables an attacker to access the session cookie by tricking the user's browser into submitting a request to an unencrypted page on the site. This attack is possible even if the server is not configured to offer HTTP content since the attacker is monitoring the requests and does not care if the server responds with a 404 or doesn't respond at all.&lt;br /&gt;
&lt;br /&gt;
=== Rule - Keep Sensitive Data Out of the URL ===&lt;br /&gt;
&lt;br /&gt;
Sensitive data must not be transmitted via URL arguments. A more appropriate place is to store sensitive data in a server side repository or within the user's session.  When using TLS the URL arguments and values are encrypted during transit. However, there are two methods that the URL arguments and values could be exposed.&lt;br /&gt;
&lt;br /&gt;
1. The entire URL is cached within the local user's browser history. This may expose sensitive data to any other user of the workstation.&lt;br /&gt;
&lt;br /&gt;
2. The entire URL is exposed if the user clicks on a link to another HTTPS site. This may expose sensitive data within the referral field to the third party site. This exposure occurs in most browsers and will only occur on transitions between two TLS sites. &lt;br /&gt;
&lt;br /&gt;
For example, a user following a link on [http://owasp.org https://example.com] which leads to [http://owasp.org https://someOtherexample.com] would expose the full URL of [http://owasp.org https://example.com] (including URL arguments) in the referral header (within most browsers). This would not be the case if the user followed a link on [http://owasp.org https://example.com] to [http://owasp.org http://someHTTPexample.com]&lt;br /&gt;
&lt;br /&gt;
=== Rule - Prevent Caching of Sensitive Data ===&lt;br /&gt;
&lt;br /&gt;
The TLS protocol provides confidentiality only for data in transit but it does not help with potential data leakage issues at the client or intermediary proxies. As a result, it is frequently prudent to instruct these nodes not to cache or persist sensitive data. One option is to add anticaching headers to relevant HTTP responses, (for example, &amp;quot;Cache-Control: no-cache, no-store&amp;quot; and &amp;quot;Expires: 0&amp;quot; for coverage of many modern browsers as of 2013). For compatibility with HTTP/1.0 (i.e., when user agents are really old or the webserver works around quirks by forcing HTTP/1.0) the response should also include the header &amp;quot;Pragma: no-cache&amp;quot;. More information is available in [http://www.ietf.org/rfc/rfc2616.txt HTTP 1.1 RFC 2616], section 14.9.&lt;br /&gt;
&lt;br /&gt;
=== Rule - Use HTTP Strict Transport Security ===&lt;br /&gt;
&lt;br /&gt;
A new browser security setting called HTTP Strict Transport Security (HSTS) will significantly enhance the implementation of TLS for a domain. HSTS is enabled via a special response header and this instructs [https://www.owasp.org/index.php/HTTP_Strict_Transport_Security#Browser_Support compatible browsers] to enforce the following security controls:&lt;br /&gt;
&lt;br /&gt;
* All requests to the domain will be sent over HTTPS&lt;br /&gt;
* Any attempts to send an HTTP requests to the domain will be automatically upgraded by the browser to HTTPS before the request is sent&lt;br /&gt;
* If a user encounters a bad SSL certificate, the user will receive an error message and will not be allowed to override the warning message&lt;br /&gt;
&lt;br /&gt;
Additional information on HSTS can be found at [https://www.owasp.org/index.php/HTTP_Strict_Transport_Security https://www.owasp.org/index.php/HTTP_Strict_Transport_Security] and also on the OWASP [http://www.youtube.com/watch?v=zEV3HOuM_Vw&amp;amp;feature=youtube_gdata AppSecTutorial Series - Episode 4]&lt;br /&gt;
&lt;br /&gt;
=== Rule - Prefer Ephemeral Key Exchanges ===&lt;br /&gt;
&lt;br /&gt;
Ephemeral key exchanges are based on Diffie-Hellman and use per-session, temporary keys during the initial SSL/TLS handshake. They provide perfect forward secrecy (PFS), which means a compromise of the server's long term signing key does not compromise the confidentiality of past session. When the server uses an ephemeral key, the server will sign the temporary key with its long term key (the long term key is the customary key available in its certificate).&lt;br /&gt;
&lt;br /&gt;
Use cryptographic parameters (like DH-parameter) that use a secure length that match to the supported keylength of your certificate (&amp;gt;=2048 bits or equivalent Elliptic Curves). As some middleware had some issues with this, upgrade to the latest version.&lt;br /&gt;
&lt;br /&gt;
If you have a server farm and are providing forward secrecy, then you might have to disable session resumption. For example, Apache writes the session id's and master secrets to disk so all servers in the farm can participate in resuming a session (there is currently no in-memory mechanism to achieve the sharing). Writing the session id and master secret to disk undermines forward secrecy.&lt;br /&gt;
&lt;br /&gt;
== Server Certificate and Protocol Configuration  ==&lt;br /&gt;
&lt;br /&gt;
Note: If using a FIPS 140-2 cryptomodule disregard the following rules and defer to the recommended configuration for the particular cryptomodule.&lt;br /&gt;
&lt;br /&gt;
=== Rule - Be aware of and have a plan for the SHA-1 deprecation plan  ===&lt;br /&gt;
&lt;br /&gt;
In order to avoid presenting end users with progressive certificate warnings, organizations must proactively address the browser vendor's upcoming SHA-1 deprecation plans. The Google Chrome plan is probably the most specific and aggressive at this point: [http://googleonlinesecurity.blogspot.com/2014/09/gradually-sunsetting-sha-1.html Gradually sunsetting SHA-1]&lt;br /&gt;
&lt;br /&gt;
If your organization has no [https://support.globalsign.com/customer/portal/articles/1499561-sha-256-compatibility SHA256 compatibility issues] then it may be appropriate to move your site to a SHA256 signed certificate/chain.  If there are, or may be, issues - you should ensure that your SHA-1 certificates expire before 1/1/2017. &lt;br /&gt;
&lt;br /&gt;
=== Rule - Use an Appropriate Certification Authority for the Application's User Base  ===&lt;br /&gt;
&lt;br /&gt;
An application user must never be presented with a warning that the certificate was signed by an unknown or untrusted authority. The application's user population must have access to the public certificate of the certification authority which issued the server's certificate. For Internet accessible websites, the most effective method of achieving this goal is to purchase the TLS certificate from a recognize certification authority. Popular Internet browsers already contain the public certificates of these recognized certification authorities. &lt;br /&gt;
&lt;br /&gt;
Internal applications with a limited user population can use an internal certification authority provided its public certificate is securely distributed to all users. However, remember that all certificates issued by this certification authority will be trusted by the users. Therefore, utilize controls to protect the private key and ensure that only authorized individuals have the ability to sign certificates. &lt;br /&gt;
&lt;br /&gt;
The use of self signed certificates is never acceptable. Self signed certificates negate the benefit of end-point authentication and also significantly decrease the ability for an individual to detect a man-in-the-middle attack. &lt;br /&gt;
&lt;br /&gt;
=== Rule - Only Support Strong Protocols ===&lt;br /&gt;
&lt;br /&gt;
SSL/TLS is a collection of protocols. Weaknesses have been identified with earlier SSL protocols, including [http://www.schneier.com/paper-ssl-revised.pdf SSLv2] and [http://www.yaksman.org/~lweith/ssl.pdf SSLv3]. The best practice for transport layer protection is to only provide support for the TLS protocols - TLS1.0, TLS 1.1 and TLS 1.2. This configuration will provide maximum protection against skilled and determined attackers and is appropriate for applications handling sensitive data or performing critical operations.&lt;br /&gt;
&lt;br /&gt;
[http://en.wikipedia.org/wiki/Transport_Layer_Security#Web_browsers Nearly all modern browsers support at least TLS 1.0]. As of February 2013, contemporary browsers (Chrome v20+, IE v8+, Opera v10+, and Safari v5+) [http://en.wikipedia.org/wiki/Transport_Layer_Security#Web_browsers support TLS 1.1 and TLS 1.2]. You should provide support for TLS 1.1 and TLS 1.2 to accommodate clients which support the protocols. The client and server (usually) negotiate the best protocol, that is supported on both sides.&lt;br /&gt;
&lt;br /&gt;
TLS 1.0 is still widely used as 'best' protocol by a lot of browsers, that are not patched to the very latest version. It suffers [http://www.yassl.com/yaSSL/Blog/Entries/2010/10/7_Differences_between_SSL_and_TLS_Protocol_Versions.html CBC Chaining attacks and Padding Oracle attacks]. TLSv1.0 should only be used only after risk analysis and acceptance.&lt;br /&gt;
&lt;br /&gt;
Under no circumstances neither SSLv2 nor SSLv3 should be enabled as a protocol selection:&lt;br /&gt;
* The [http://www.schneier.com/paper-ssl-revised.pdf SSLv2 protocol is broken] and does not provide adequate transport layer protection.&lt;br /&gt;
* [http://www.yaksman.org/~lweith/ssl.pdf SSLv3 had been known for weaknesses] which severely compromise the channel's security long before the [https://www.openssl.org/~bodo/ssl-poodle.pdf 'POODLE'-Bug] finally stopped to tolerate this protocol by October 2014. Switching off SSLv3 terminates the support of legacy browsers like [https://www.ssllabs.com/ssltest/viewClient.html?name=IE&amp;amp;version=6&amp;amp;platform=XP IE6/XP] and elder.&lt;br /&gt;
&lt;br /&gt;
=== Rule - Only Support Strong Cryptographic Ciphers  ===&lt;br /&gt;
&lt;br /&gt;
Each protocol (SSLv3, TLSv1.0, etc) provides cipher suites. As of TLS 1.2, [http://www.iana.org/assignments/tls-parameters/tls-parameters.xml#tls-parameters-3 there is support for over 300 suites (320+ and counting)], including [http://www.mail-archive.com/cryptography@randombit.net/msg03785.html national vanity cipher suites]. The strength of the encryption used within a TLS session is determined by the encryption cipher negotiated between the server and the browser. In order to ensure that only strong cryptographic ciphers are selected the server must be modified to disable the use of weak ciphers and to configure the ciphers in an adequate order. It is recommended to configure the server to only support strong ciphers and to use sufficiently large key sizes. In general, the following should be observed when selecting CipherSuites:&lt;br /&gt;
* Use the very latest recommendations, they may be volantile these days&lt;br /&gt;
* Setup your Policy to get a Whitelist for recommended Ciphers, e.g.:&lt;br /&gt;
** Activate to set the Cipher Order by the Server&lt;br /&gt;
** Highest Priority for Ciphers that support 'Forward Secrecy' (-&amp;gt; Support ephemeral Diffie-Hellman key exchange) [http://vincent.bernat.im/en/blog/2011-ssl-perfect-forward-secrecy.html]&lt;br /&gt;
** Favor DHE over ECDHE (and monitor the CPU usage, see Notes below), ECDHE lacks now of really reliable Elliptic Curves, see discussion about secp{224,256,384,521}r1 and secp256k1, cf. [http://safecurves.cr.yp.to], [https://www.schneier.com/blog/archives/2013/09/the_nsa_is_brea.html#c1675929]. The solution might be to use [http://www.researchgate.net/profile/Johannes_Merkle/publication/260050106_Standardisierung_der_Brainpool-Kurven_fr_TLS_und_IPSec/file/60b7d52f36a0cc2fdd.pdf Brainpool Curves &amp;lt;nowiki&amp;gt;[German]&amp;lt;/nowiki&amp;gt;], defined for TLS in [http://tools.ietf.org/html/rfc7027 RFC 7027], or [http://eprint.iacr.org/2007/286 Edwards Curves]. The most promising candidate for the latter is [https://tools.ietf.org/html/draft-josefsson-tls-curve25519-05 'Curve25519'] (see [https://tools.ietf.org/html/draft-agl-cfrgcurve-00 DRAFT-agl-cfrgcurve-00]), that is not yet defined for TLS, cf. [http://www.iana.org/assignments/tls-parameters/tls-parameters.xhtml#tls-parameters-8 IANA] &amp;lt;!--- as at June 2014 ---&amp;gt;&lt;br /&gt;
** Use RSA-Keys (no DSA/DSS: they get very weak, if a bad entropy source is used during signing, cf. [https://projectbullrun.org/dual-ec/tls.html], [https://factorable.net/weakkeys12.conference.pdf]) &amp;lt;!--- as at June 2014 ---&amp;gt;&lt;br /&gt;
** Favor GCM over CBC regardless of the cipher size. In other words, use Authenticated Encryption with Associated Data (AEAD), e.g. AES-GCM, AES-CCM.&lt;br /&gt;
** Watch also for Stream Ciphers which XOR the key stream with plaintext (such as AES/CTR mode) &amp;lt;!--- Jim please check this ---&amp;gt;&lt;br /&gt;
** Priorize the ciphers by the sizes of the Cipher and the MAC&lt;br /&gt;
** Use SHA1 or above for digests, prefer SHA2 (or equivalent)&lt;br /&gt;
** Disable weak ciphers (which is implicitly done by this whitelist) without disabling legacy browsers and bots that have to be supported (find the best compromise), actually the cipher TLS_RSA_WITH_3DES_EDE_CBC_SHA (0xa) does this job.&lt;br /&gt;
*** Disable cipher suites that do not offer encryption (eNULL, NULL)&lt;br /&gt;
*** Disable cipher suites that do not offer authentication (aNULL). aNULL includes anonymous cipher suites ADH (Anonymous Diffie-Hellman) and AECDH (Anonymous Elliptic Curve Diffie Hellman).&lt;br /&gt;
*** Disable export level ciphers (EXP, eg. ciphers containing DES)&lt;br /&gt;
*** Disable key sizes smaller than 128 bits for encrypting payload traffic (see [https://www.bsi.bund.de/SharedDocs/Downloads/DE/BSI/Publikationen/TechnischeRichtlinien/TR02102/BSI-TR-02102-2_pdf.html BSI: TR-02102 Part 2 (German)])&lt;br /&gt;
*** Disable the use of MD5 as a hashing mechanism for payload traffic&lt;br /&gt;
*** Disable the use of IDEA Cipher Suites (see [http://tools.ietf.org/html/rfc5469])&lt;br /&gt;
*** Disable RC4 cipher suites (see [https://tools.ietf.org/html/rfc7465], [http://www.isg.rhul.ac.uk/tls/])&lt;br /&gt;
** Ciphers should be usable for DH-Pamameters &amp;gt;= 2048 bits, without blocking legacy browsers (The cipher ‘DHE-RSA-AES128-SHA’ is suppressed as some browsers like to use it but are not capable to cope with DH-Params &amp;gt; 1024 bits.)&lt;br /&gt;
* Define a Cipher String that works with different Versions of your encryption tool, like openssl&lt;br /&gt;
* Verify your cipher string&lt;br /&gt;
** with an audit-tool, like [[O-Saft|OWASP 'O-Saft' (OWASP SSL audit for testers / OWASP SSL advanced forensic tool)]]&lt;br /&gt;
** listing it manually with your encryption software, e.g. openssl ciphers -v &amp;lt;cipher-string&amp;gt; (the result may differ by version), e.g.:&lt;br /&gt;
{{Top_10_2010:ExampleBeginTemplate|year=2013}} &lt;br /&gt;
openssl ciphers -v &amp;quot;EDH+aRSA+AESGCM:EDH+aRSA+AES:DHE-RSA-AES256-SHA:EECDH+aRSA+AESGCM:EECDH+aRSA+AES:ECDHE-RSA-AES256-SHA:ECDHE-RSA-AES128-SHA:RSA+AESGCM:RSA+AES+SHA:DES-CBC3-SHA:-DHE-RSA-AES128-SHA&amp;quot; &amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;#&amp;lt;/nowiki&amp;gt;add optionally ':!aNULL:!eNULL:!LOW:!MD5:!EXP:!PSK:!DSS:!RC4:!SEED:!ECDSA:!ADH:!IDEA' to protect older Versions of OpenSSL&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;#&amp;lt;/nowiki&amp;gt;you may use openssl ciphers -V &amp;quot;...&amp;quot; for openssl &amp;gt;= 1.0.1:&lt;br /&gt;
&amp;lt;small&amp;gt;&lt;br /&gt;
 0x00,0x9F - DHE-RSA-AES256-GCM-SHA384   TLSv1.2 Kx=DH     Au=RSA  Enc=AESGCM(256) Mac=AEAD&lt;br /&gt;
 0x00,0x9E - DHE-RSA-AES128-GCM-SHA256   TLSv1.2 Kx=DH     Au=RSA  Enc=AESGCM(128) Mac=AEAD&lt;br /&gt;
 0x00,0x6B - DHE-RSA-AES256-SHA256       TLSv1.2 Kx=DH     Au=RSA  Enc=AES(256)    Mac=SHA256&lt;br /&gt;
 0x00,0x39 - DHE-RSA-AES256-SHA          SSLv3   Kx=DH     Au=RSA  Enc=AES(256)    Mac=SHA1&lt;br /&gt;
 0x00,0x67 - DHE-RSA-AES128-SHA256       TLSv1.2 Kx=DH     Au=RSA  Enc=AES(128)    Mac=SHA256&lt;br /&gt;
 0xC0,0x30 - ECDHE-RSA-AES256-GCM-SHA384 TLSv1.2 Kx=ECDH   Au=RSA  Enc=AESGCM(256) Mac=AEAD&lt;br /&gt;
 0xC0,0x2F - ECDHE-RSA-AES128-GCM-SHA256 TLSv1.2 Kx=ECDH   Au=RSA  Enc=AESGCM(128) Mac=AEAD&lt;br /&gt;
 0xC0,0x28 - ECDHE-RSA-AES256-SHA384     TLSv1.2 Kx=ECDH   Au=RSA  Enc=AES(256)    Mac=SHA384&lt;br /&gt;
 0xC0,0x14 - ECDHE-RSA-AES256-SHA        SSLv3   Kx=ECDH   Au=RSA  Enc=AES(256)    Mac=SHA1&lt;br /&gt;
 0xC0,0x27 - ECDHE-RSA-AES128-SHA256     TLSv1.2 Kx=ECDH   Au=RSA  Enc=AES(128)    Mac=SHA256&lt;br /&gt;
 0xC0,0x13 - ECDHE-RSA-AES128-SHA        SSLv3   Kx=ECDH   Au=RSA  Enc=AES(128)    Mac=SHA1&lt;br /&gt;
 0x00,0x9D - AES256-GCM-SHA384           TLSv1.2 Kx=RSA    Au=RSA  Enc=AESGCM(256) Mac=AEAD&lt;br /&gt;
 0x00,0x9C - AES128-GCM-SHA256           TLSv1.2 Kx=RSA    Au=RSA  Enc=AESGCM(128) Mac=AEAD&lt;br /&gt;
 0x00,0x35 - AES256-SHA                  SSLv3   Kx=RSA    Au=RSA  Enc=AES(256)    Mac=SHA1&lt;br /&gt;
 0x00,0x2F - AES128-SHA                  SSLv3   Kx=RSA    Au=RSA  Enc=AES(128)    Mac=SHA1&lt;br /&gt;
 0x00,0x0A - DES-CBC3-SHA                SSLv3   Kx=RSA    Au=RSA  Enc=3DES(168)   Mac=SHA1&lt;br /&gt;
&amp;lt;/small&amp;gt;&lt;br /&gt;
{{Top_10_2010:ExampleEndTemplate}}&lt;br /&gt;
&lt;br /&gt;
* Inform yourself how to securely configure the settings for your used services or hardware, e.g. [https://bettercrypto.org BetterCrypto.org: Applied Crypto Hardening (DRAFT)]&lt;br /&gt;
* Check new software and hardware versions for new security settings.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Notes:&amp;lt;/b&amp;gt;&lt;br /&gt;
* According to my researches the most common browsers should be supported with this setting, too (see also [https://www.ssllabs.com/ssltest/index.html SSL Labs: SSL Server Test -&amp;gt; SSL Report -&amp;gt; Handshake Simulation]).&lt;br /&gt;
* Monitor the performance of your server, e.g. the TLS handshake with DHE hinders the CPU abt 2.4 times more than ECDHE, cf. [http://vincent.bernat.im/en/blog/2011-ssl-perfect-forward-secrecy.html#some-benchmarks Vincent Bernat, 2011], [http://nmav.gnutls.org/2011/12/price-to-pay-for-perfect-forward.html nmav's Blog, 2011].&lt;br /&gt;
* Use of Ephemeral Diffie-Hellman key exchange will protect confidentiality of the transmitted plaintext data even if the corresponding RSA or DSS server private key got compromised. An attacker would have to perform active man-in-the-middle attack at the time of the key exchange to be able to extract the transmitted plaintext. All modern browsers support this key exchange with the notable exception of Internet Explorer prior to Windows Vista.&lt;br /&gt;
&lt;br /&gt;
Additional information can be obtained within the [http://www.ietf.org/rfc/rfc5246.txt TLS 1.2 RFC 5246], [https://www.ssllabs.com/projects/best-practices/index.html SSL Labs: 'SSL/TLS Deployment Best Practices'], [https://www.bsi.bund.de/SharedDocs/Downloads/DE/BSI/Publikationen/TechnischeRichtlinien/TR02102/BSI-TR-02102-2_pdf.html BSI: 'TR-02102 Part 2 (German)'], [http://www.enisa.europa.eu/activities/identity-and-trust/library/deliverables/algorithms-key-sizes-and-parameters-report ENISA: 'Algorithms, Key Sizes and Parameters Report'] and [http://csrc.nist.gov/groups/STM/cmvp/documents/fips140-2/FIPS1402IG.pdf FIPS 140-2 IG]. &lt;br /&gt;
&lt;br /&gt;
=== Rule - Support TLS-PSK and TLS-SRP for Mutual Authentication ===&lt;br /&gt;
&lt;br /&gt;
When using a shared secret or password offer TLS-PSK (Pre-Shared Key) or TLS-SRP (Secure Remote Password), which are known as Password Authenticated Key Exchange (PAKEs). TLS-PSK and TLS-SRP properly bind the channel, which refers to the cryptographic binding between the outer tunnel and the inner authentication protocol. IANA currently reserves [http://www.iana.org/assignments/tls-parameters/tls-parameters.xml#tls-parameters-3 79 PSK cipehr suites] and [http://www.iana.org/assignments/tls-parameters/tls-parameters.xml#tls-parameters-3 9 SRP cipher suites].&lt;br /&gt;
&lt;br /&gt;
Basic authentication places the user's password on the wire in the plain text after a server authenticates itself. Basic authentication only provides unilateral authentication. In contrast, both TLS-PSK and TLS-SRP provide mutual authentication, meaning each party proves it knows the password without placing the password on the wire in the plain text.&lt;br /&gt;
&lt;br /&gt;
Finally, using a PAKE removes the need to trust an outside party, such as a Certification Authority (CA).&lt;br /&gt;
&lt;br /&gt;
=== Rule - Only Support Secure Renegotiations  ===&lt;br /&gt;
&lt;br /&gt;
A design weakness in TLS, identified as [http://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2009-3555 CVE-2009-3555], allows an attacker to inject a plaintext of his choice into a TLS session of a victim. In the HTTPS context the attacker might be able to inject his own HTTP requests on behalf of the victim. The issue can be mitigated either by disabling support for TLS renegotiations or by supporting only renegotiations compliant with [http://www.ietf.org/rfc/rfc5746.txt RFC 5746]. All modern browsers have been updated to comply with this RFC.&lt;br /&gt;
&lt;br /&gt;
=== Rule - Disable Compression ===&lt;br /&gt;
&lt;br /&gt;
Compression Ratio Info-leak Made Easy (CRIME) is an exploit against the data compression scheme used by the TLS and SPDY protocols. The exploit allows an adversary to recover user authentication cookies from HTTPS. The recovered cookie can be subsequently used for session hijacking attacks.&lt;br /&gt;
&lt;br /&gt;
=== Rule - Use Strong Keys &amp;amp; Protect Them ===&lt;br /&gt;
&lt;br /&gt;
The private key used to generate the cipher key must be sufficiently strong for the anticipated lifetime of the private key and corresponding certificate. The current best practice is to select a key size of at least 2048 bits. Additional information on key lifetimes and comparable key strengths can be found in [http://www.keylength.com/en/compare/], [http://csrc.nist.gov/publications/nistpubs/800-57/sp800-57_part1_rev3_general.pdf NIST SP 800-57]. In addition, the private key must be stored in a location that is protected from unauthorized access.&lt;br /&gt;
&lt;br /&gt;
=== Rule - Use a Certificate That Supports Required Domain Names ===&lt;br /&gt;
&lt;br /&gt;
A user should never be presented with a certificate error, including prompts to reconcile domain or hostname mismatches, or expired certificates. If the application is available at both [https://owasp.org https://www.example.com] and [https://owasp.org https://example.com] then an appropriate certificate, or certificates, must be presented to accommodate the situation. The presence of certificate errors desensitizes users to TLS error messages and increases the possibility an attacker could launch a convincing phishing or man-in-the-middle attack.&lt;br /&gt;
&lt;br /&gt;
For example, consider a web application accessible at [https://owasp.org https://abc.example.com] and [https://owasp.org https://xyz.example.com]. One certificate should be acquired for the host or server ''abc.example.com''; and a second certificate for host or server ''xyz.example.com''. In both cases, the hostname would be present in the Subject's Common Name (CN).&lt;br /&gt;
&lt;br /&gt;
Alternatively, the Subject Alternate Names (SANs) can be used to provide a specific listing of multiple names where the certificate is valid. In the example above, the certificate could list the Subject's CN as ''example.com'', and list two SANs: ''abc.example.com'' and ''xyz.example.com''. These certificates are sometimes referred to as &amp;quot;multiple domain certificates&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
=== Rule - Use Fully Qualified Names in Certificates ===&lt;br /&gt;
&lt;br /&gt;
Use fully qualified names in the DNS name field, and do not use unqualifed names (e.g., 'www'), local names (e.g., 'localhost'), or private IP addresses (e.g., 192.168.1.1) in the DNS name field. Unqualifed names, local names, or private IP addresses violate the certificate specification.&lt;br /&gt;
 &lt;br /&gt;
=== Rule - Do Not Use Wildcard Certificates ===&lt;br /&gt;
&lt;br /&gt;
You should refrain from using wildcard certificates. Though they are expedient at circumventing annoying user prompts, they also [[Least_privilege|violate the principal of least privilege]] and asks the user to trust all machines, including developer's machines, the secretary's machine in the lobby and the sign-in kiosk. Obtaining access to the private key is left as an exercise for the attacker, but its made much easier when stored on the file system unprotected.&lt;br /&gt;
&lt;br /&gt;
Statistics gathered by Qualys for [http://media.blackhat.com/bh-us-10/presentations/Ristic/BlackHat-USA-2010-Ristic-Qualys-SSL-Survey-HTTP-Rating-Guide-slides.pdf Internet SSL Survey 2010] indicate wildcard certificates have a 4.4% share, so the practice is not standard for public facing hosts. Finally, wildcard certificates violate [https://www.cabforum.org/EV_Certificate_Guidelines.pdf EV Certificate Guidelines].&lt;br /&gt;
&lt;br /&gt;
=== Rule - Do Not Use RFC 1918 Addresses in Certificates ===&lt;br /&gt;
&lt;br /&gt;
Certificates should not use private addresses. RFC 1918 is [http://tools.ietf.org/rfc/rfc1918.txt Address Allocation for Private Internets]. Private addresses are Internet Assigned Numbers Authority (IANA) reserved and include 192.168/16, 172.16/12, and 10/8.&lt;br /&gt;
&lt;br /&gt;
Certificates issued with private addresses violate [https://www.cabforum.org/EV_Certificate_Guidelines.pdf EV Certificate Guidelines]. In addition, Peter Gutmann writes in in [http://www.cs.auckland.ac.nz/~pgut001/pubs/book.pdf Engineering Security]: &amp;quot;This one is particularly troublesome because, in combination with the router-compromise attacks... and ...OSCP-defeating measures, it allows an attacker to spoof any EV-certificate site.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
=== Rule - Always Provide All Needed Certificates ===&lt;br /&gt;
&lt;br /&gt;
Clients attempt to solve the problem of identifying a server or host using PKI and X509 certificate. When a user receives a server or host's certificate, the certificate must be validated back to a trusted root certification authority. This is known as path validation.&lt;br /&gt;
&lt;br /&gt;
There can be one or more intermediate certificates in between the end-entity (server or host) certificate and root certificate. In addition to validating both endpoints, the user will also have to validate all intermediate certificates. Validating all intermediate certificates can be tricky because the user may not have them locally. This is a well-known PKI issue called the “Which Directory?&amp;quot; problem.&lt;br /&gt;
&lt;br /&gt;
To avoid the “Which Directory?&amp;quot; problem, a server should provide the user with all required certificates used in a path validation.&lt;br /&gt;
&lt;br /&gt;
== Test your overall TLS/SSL setup and your Certificate ==&lt;br /&gt;
&lt;br /&gt;
* [[Testing_for_SSL-TLS_%28OWASP-CM-001%29 | OWASP Testing Guide: Chapter on SSL/TLS Testing]]&lt;br /&gt;
* [[O-Saft|OWASP 'O-Saft' (OWASP SSL audit for testers / OWASP SSL advanced forensic tool)]]&lt;br /&gt;
* [https://www.ssllabs.com/ssltest SSL LABS Server Test]&lt;br /&gt;
* other Tools: [[Testing_for_Weak_SSL/TSL_Ciphers,_Insufficient_Transport_Layer_Protection_%28OWASP-EN-002%29#References| Testing for Weak SSL/TSL Ciphers, Insufficient Transport Layer Protection (OWASP-EN-002) (DRAFT)]] - References - Tools&lt;br /&gt;
&lt;br /&gt;
== Client (Browser) Configuration  ==&lt;br /&gt;
&lt;br /&gt;
The validation procedures to ensure that a certificate is valid are complex and difficult to correctly perform.  In a typical web application model, these checks will be performed by the client's web browser in accordance with local browser settings and are out of the control of the application. However, these items do need to be addressed in the following scenarios:&lt;br /&gt;
&lt;br /&gt;
* The application server establishes connections to other applications over TLS for purposes such as web services or any exchange of data&lt;br /&gt;
* A thick client application is connecting to a server via TLS&lt;br /&gt;
&lt;br /&gt;
In these situations extensive certificate validation checks must occur in order to establish the validity of the certificate. Consult the following resources to assist in the design and testing of this functionality. The NIST PKI testing site includes a full test suite of certificates and expected outcomes of the test cases.&lt;br /&gt;
* [http://csrc.nist.gov/groups/ST/crypto_apps_infra/pki/pkitesting.html NIST PKI Testing]&lt;br /&gt;
* [http://www.ietf.org/rfc/rfc5280.txt IETF RFC 5280]&lt;br /&gt;
&lt;br /&gt;
As specified in the above guidance, if the certificate can not be validated for any reason then the connection between the client and server must be dropped. Any data exchanged over a connection where the certificate has not properly been validated could be exposed to unauthorized access or modification.&lt;br /&gt;
&lt;br /&gt;
== Additional Controls  ==&lt;br /&gt;
&lt;br /&gt;
=== Extended Validation Certificates  ===&lt;br /&gt;
&lt;br /&gt;
Extended validation certificates (EV Certificates) proffer an enhanced investigation by the issuer into the requesting party due to the industry's race to the bottom. The purpose of EV certificates is to provide the user with greater assurance that the owner of the certificate is a verified legal entity for the site. Browsers with support for EV certificates distinguish an EV certificate in a variety of ways. Internet Explorer will color a portion of the URL in green, while Mozilla will add a green portion to the left of the URL indicating the company name. &lt;br /&gt;
&lt;br /&gt;
High value websites should consider the use of EV certificates to enhance customer confidence in the certificate. It should also be noted that EV certificates do not provide any greater technical security for the TLS. The purpose of the EV certificate is to increase user confidence that the target site is indeed who it claims to be.&lt;br /&gt;
&lt;br /&gt;
=== Client-Side Certificates  ===&lt;br /&gt;
&lt;br /&gt;
Client side certificates can be used with TLS to prove the identity of the client to the server. Referred to as &amp;quot;two-way TLS&amp;quot;, this configuration requires the client to provide their certificate to the server, in addition to the server providing their's to the client. If client certificates are used, ensure that the same validation of the client certificate is performed by the server, as indicated for the validation of server certificates above. In addition, the server should be configured to drop the TLS connection if the client certificate cannot be verified or is not provided. &lt;br /&gt;
&lt;br /&gt;
The use of client side certificates is relatively rare currently due to the complexities of certificate generation, safe distribution, client side configuration, certificate revocation and reissuance, and the fact that clients can only authenticate on machines where their client side certificate is installed. Such certificates are typically used for very high value connections that have small user populations.&lt;br /&gt;
&lt;br /&gt;
=== Certificate and Public Key Pinning ===&lt;br /&gt;
&lt;br /&gt;
Hybrid and native applications can take advantage of [[Certificate_and_Public_Key_Pinning|certificate and public key pinning]]. Pinning associates a host (for example, server) with an identity (for example, certificate or public key), and allows an application to leverage knowledge of the pre-existing relationship. At runtime, the application would inspect the certificate or public key received after connecting to the server. If the certificate or public key is expected, then the application would proceed as normal. If unexpected, the application would stop using the channel and close the connection since an adversary could control the channel or server.&lt;br /&gt;
&lt;br /&gt;
Pinning still requires customary X509 checks, such as revocation, since CRLs and OCSP provides real time status information. Otherwise, an application could possibly (1) accept a known bad certificate; or (2) require an out-of-band update, which could result in a lengthy App Store approval.&lt;br /&gt;
&lt;br /&gt;
Browser based applications are at a disadvantage since most browsers do not allow the user to leverage pre-existing relationships and ''a priori'' knowledge. In addition, Javascript and Websockets do not expose methods to for a web app to query the underlying secure connection information (such as the certificate or public key). It is noteworthy that Chromium based browsers perform pinning on selected sites, but the list is currently maintained by the vendor.&lt;br /&gt;
&lt;br /&gt;
For more information, please see the [[Pinning Cheat Sheet]].&lt;br /&gt;
&lt;br /&gt;
= Providing Transport Layer Protection for Back End and Other Connections  =&lt;br /&gt;
&lt;br /&gt;
Although not the focus of this cheat sheet, it should be stressed that transport layer protection is necessary for back-end connections and any other connection where sensitive data is exchanged or where user identity is established. Failure to implement an effective and robust transport layer security will expose sensitive data and undermine the effectiveness of any authentication or access control mechanism. &lt;br /&gt;
&lt;br /&gt;
== Secure Internal Network Fallacy  ==&lt;br /&gt;
&lt;br /&gt;
The internal network of a corporation is not immune to attacks. Many recent high profile intrusions, where thousands of sensitive customer records were compromised, have been perpetrated by attackers that have gained internal network access and then used sniffers to capture unencrypted data as it traversed the internal network.&lt;br /&gt;
&lt;br /&gt;
= Related Articles  =&lt;br /&gt;
&lt;br /&gt;
* Mozilla – [https://wiki.mozilla.org/Security/Server_Side_TLS#Recommended_configurations Mozilla Recommended Configurations]&lt;br /&gt;
* OWASP – [[Testing for SSL-TLS (OWASP-CM-001)|Testing for SSL-TLS]], and OWASP [[Guide to Cryptography]] &lt;br /&gt;
* OWASP – [http://www.owasp.org/index.php/ASVS Application Security Verification Standard (ASVS) – Communication Security Verification Requirements (V10)]&lt;br /&gt;
* OWASP – ASVS Article on [[Why you need to use a FIPS 140-2 validated cryptomodule]]&lt;br /&gt;
* SSL Labs – [https://www.ssllabs.com/projects/best-practices/index.html SSL/TLS Deployment Best Practices]&lt;br /&gt;
* SSL Labs – [http://www.ssllabs.com/projects/rating-guide/index.html SSL Server Rating Guide]&lt;br /&gt;
* ENISA – [http://www.enisa.europa.eu/activities/identity-and-trust/library/deliverables/algorithms-key-sizes-and-parameters-report Algorithms, Key Sizes and Parameters Report]&lt;br /&gt;
* BSI   – [https://www.bsi.bund.de/SharedDocs/Downloads/DE/BSI/Publikationen/TechnischeRichtlinien/TR02102/BSI-TR-02102-2_pdf.html BSI TR-02102 Part 2 (German)]&lt;br /&gt;
* yaSSL – [http://www.yassl.com/yaSSL/Blog/Entries/2010/10/7_Differences_between_SSL_and_TLS_Protocol_Versions.html Differences between SSL and TLS Protocol Versions]&lt;br /&gt;
* NIST – [http://csrc.nist.gov/publications/PubsSPs.html#800-52 SP 800-52 Rev. 1 Guidelines for the Selection, Configuration, and Use of Transport Layer Security (TLS) Implementations]&lt;br /&gt;
* NIST – [http://csrc.nist.gov/publications/fips/fips140-2/fips1402.pdf FIPS 140-2 Security Requirements for Cryptographic Modules]&lt;br /&gt;
* NIST – [http://csrc.nist.gov/groups/STM/cmvp/documents/fips140-2/FIPS1402IG.pdf Implementation Guidance for FIPS PUB 140-2 and the Cryptographic Module Validation Program]&lt;br /&gt;
* NIST - [http://csrc.nist.gov/publications/nistpubs/800-57/sp800-57_part1_rev3_general.pdf NIST SP 800-57 Recommendation for Key Management, Revision 3], [http://csrc.nist.gov/publications/PubsDrafts.html#SP-800-57-Part%203-Rev.1 Public DRAFT]&lt;br /&gt;
* NIST – [http://csrc.nist.gov/publications/drafts.html#sp800-95 SP 800-95 Guide to Secure Web Services] &lt;br /&gt;
* IETF – [http://www.ietf.org/rfc/rfc5280.txt RFC 5280 Internet X.509 Public Key Infrastructure Certificate and Certificate Revocation List (CRL) Profile]&lt;br /&gt;
* IETF – [http://www.ietf.org/rfc/rfc2246.txt RFC 2246 The Transport Layer Security (TLS) Protocol Version 1.0 (JAN 1999)]&lt;br /&gt;
* IETF – [http://www.ietf.org/rfc/rfc4346.txt RFC 4346 The Transport Layer Security (TLS) Protocol Version 1.1 (APR 2006)]&lt;br /&gt;
* IETF – [http://www.ietf.org/rfc/rfc5246.txt RFC 5246 The Transport Layer Security (TLS) Protocol Version 1.2 (AUG 2008)]&lt;br /&gt;
* bettercrypto - [https://bettercrypto.org Applied Crypto Hardening: HOWTO for secure crypto settings of the most common services (DRAFT)]&lt;br /&gt;
&lt;br /&gt;
= Authors and Primary Editors  =&lt;br /&gt;
&lt;br /&gt;
Michael Coates - michael.coates[at]owasp.org &amp;lt;br/&amp;gt;&lt;br /&gt;
Dave Wichers - dave.wichers[at]owasp.org &amp;lt;br/&amp;gt;&lt;br /&gt;
Michael Boberski - boberski_michael[at]bah.com&amp;lt;br/&amp;gt;&lt;br /&gt;
Tyler Reguly -treguly[at]sslfail.com&lt;br /&gt;
| valign=&amp;quot;top&amp;quot;  style=&amp;quot;padding-left:25px;width:300px;border-right: 1px dotted gray;padding-right:25px;&amp;quot; |&lt;br /&gt;
&lt;br /&gt;
== Other Cheatsheets ==&lt;br /&gt;
&lt;br /&gt;
{{Cheatsheet_Navigation_Body}}&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[Category:Cheatsheets]]&lt;br /&gt;
[[Category:OWASP Best Practices]]&lt;/div&gt;</summary>
		<author><name>Crashedmind</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Transport_Layer_Protection_Cheat_Sheet&amp;diff=190506</id>
		<title>Transport Layer Protection Cheat Sheet</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Transport_Layer_Protection_Cheat_Sheet&amp;diff=190506"/>
				<updated>2015-03-01T18:00:33Z</updated>
		
		<summary type="html">&lt;p&gt;Crashedmind: replaced &amp;quot;Related Artticles&amp;quot; withdrawn 800-52 with 800-52 rev 1 (published April 2014). 'used... &amp;quot;PubsSPs.html#800-52&amp;quot; URL so link does not break when new version of file added&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt; __NOTOC__&lt;br /&gt;
&amp;lt;div style=&amp;quot;width:100%;height:160px;border:0,margin:0;overflow: hidden;&amp;quot;&amp;gt;[[File:Cheatsheets-header.jpg|link=]]&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;padding: 0;margin:0;margin-top:10px;text-align:left;&amp;quot; |-&lt;br /&gt;
| valign=&amp;quot;top&amp;quot;  style=&amp;quot;border-right: 1px dotted gray;padding-right:25px;&amp;quot; |&lt;br /&gt;
Last revision (mm/dd/yy): '''{{REVISIONMONTH}}/{{REVISIONDAY}}/{{REVISIONYEAR}}''' &lt;br /&gt;
= Introduction  =&lt;br /&gt;
 __TOC__{{TOC hidden}}&lt;br /&gt;
&lt;br /&gt;
This cheat sheet provides a simple model to follow when implementing transport layer protection for an application. Although the concept of SSL is known to many, the actual details and security specific decisions of implementation are often poorly understood and frequently result in insecure deployments. This article establishes clear rules which provide guidance on securely designing and configuring transport layer security for an application. This article is focused on the use of SSL/TLS between a web application and a web browser, but we also encourage the use of SSL/TLS or other network encryption technologies, such as VPN, on back end and other non-browser based connections.&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
== Architectural Decision  ==&lt;br /&gt;
&lt;br /&gt;
An architectural decision must be made to determine the appropriate method to protect data when it is being transmitted.  The most common options available to corporations are Virtual Private Networks (VPN) or a SSL/TLS model commonly used by web applications. The selected model is determined by the business needs of the particular organization. For example, a VPN connection may be the best design for a partnership between two companies that includes mutual access to a shared server over a variety of protocols. Conversely, an Internet facing enterprise web application would likely be best served by a SSL/TLS model. &lt;br /&gt;
&lt;br /&gt;
This cheat sheet will focus on security considerations when the SSL/TLS model is selected. This is a frequently used model for publicly accessible web applications.&lt;br /&gt;
&lt;br /&gt;
= Providing Transport Layer Protection with SSL/TLS  =&lt;br /&gt;
&lt;br /&gt;
== Benefits  ==&lt;br /&gt;
&lt;br /&gt;
The primary benefit of transport layer security is the protection of web application data from unauthorized disclosure and modification when it is transmitted between clients (web browsers) and the web application server, and between the web application server and back end and other non-browser based enterprise components. &lt;br /&gt;
&lt;br /&gt;
The server validation component of TLS provides authentication of the server to the client.  If configured to require client side certificates, TLS can also play a role in client authentication to the server. However, in practice client side certificates are not often used in lieu of username and password based authentication models for clients.&lt;br /&gt;
&lt;br /&gt;
TLS also provides two additional benefits that are commonly overlooked; integrity guarantees and replay prevention. A TLS stream of communication contains built-in controls to prevent tampering with any portion of the encrypted data. In addition, controls are also built-in to prevent a captured stream of TLS data from being replayed at a later time.&lt;br /&gt;
&lt;br /&gt;
It should be noted that TLS provides the above guarantees to data during transmission. TLS does not offer any of these security benefits to data that is at rest. Therefore appropriate security controls must be added to protect data while at rest within the application or within data stores.&lt;br /&gt;
&lt;br /&gt;
== Basic Requirements ==&lt;br /&gt;
&lt;br /&gt;
The basic requirements for using TLS are: access to a Public Key Infrastructure (PKI) in order to obtain certificates, access to a directory or an Online Certificate Status Protocol (OCSP) responder in order to check certificate revocation status, and agreement/ability to support a minimum configuration of protocol versions and protocol options for each version.&lt;br /&gt;
&lt;br /&gt;
== SSL vs. TLS  ==&lt;br /&gt;
&lt;br /&gt;
The terms, Secure Socket Layer (SSL) and Transport Layer Security (TLS) are often used interchangeably. In fact, SSL v3.1 is equivalent to TLS v1.0. However, different versions of SSL and TLS are supported by modern web browsers and by most modern web frameworks and platforms. For the purposes of this cheat sheet we will refer to the technology generically as TLS. Recommendations regarding the use of SSL and TLS protocols, as well as browser support for TLS, can be found in the rule below titled [[Transport_Layer_Protection_Cheat_Sheet#Rule_-_Only_Support_Strong_Protocols| &amp;quot;Only Support Strong Protocols&amp;quot;]].&lt;br /&gt;
&lt;br /&gt;
[[Image:Asvs_cryptomodule.gif|thumb|350px|right|Cryptomodule Parts and Operation]]&lt;br /&gt;
&lt;br /&gt;
== When to Use a FIPS 140-2 Validated Cryptomodule ==&lt;br /&gt;
&lt;br /&gt;
If the web application may be the target of determined attackers (a common threat model for Internet accessible applications handling sensitive data), it is strongly advised to use TLS services that are provided by [http://csrc.nist.gov/groups/STM/cmvp/validation.html FIPS 140-2 validated cryptomodules]. &lt;br /&gt;
&lt;br /&gt;
A cryptomodule, whether it is a software library or a hardware device, basically consists of three parts:&lt;br /&gt;
&lt;br /&gt;
* Components that implement cryptographic algorithms (symmetric and asymmetric algorithms, hash algorithms, random number generator algorithms, and message authentication code algorithms) &lt;br /&gt;
* Components that call and manage cryptographic functions (inputs and outputs include cryptographic keys and so-called critical security parameters) &lt;br /&gt;
* A physical container around the components that implement cryptographic algorithms and the components that call and manage cryptographic functions&lt;br /&gt;
&lt;br /&gt;
The security of a cryptomodule and its services (and the web applications that call the cryptomodule) depend on the correct implementation and integration of each of these three parts. In addition, the cryptomodule must be used and accessed securely. The includes consideration for:&lt;br /&gt;
&lt;br /&gt;
* Calling and managing cryptographic functions&lt;br /&gt;
* Securely Handling inputs and output&lt;br /&gt;
* Ensuring the secure construction of the physical container around the components&lt;br /&gt;
&lt;br /&gt;
In order to leverage the benefits of TLS it is important to use a TLS service (e.g. library, web framework, web application server) which has been FIPS 140-2 validated. In addition, the cryptomodule must be installed, configured and operated in either an approved or an allowed mode to provide a high degree of certainty that the FIPS 140-2 validated cryptomodule is providing the expected security services in the expected manner.&lt;br /&gt;
&lt;br /&gt;
If the system is legally required to use FIPS 140-2 encryption (e.g., owned or operated by or on behalf of the U.S. Government) then TLS must be used and SSL disabled. Details on why SSL is unacceptable are described in Section 7.1 of [http://csrc.nist.gov/groups/STM/cmvp/documents/fips140-2/FIPS1402IG.pdf Implementation Guidance for FIPS PUB 140-2 and the Cryptographic Module Validation Program].&lt;br /&gt;
&lt;br /&gt;
Further reading on the use of TLS to protect highly sensitive data against determined attackers can be viewed in [http://csrc.nist.gov/publications/nistpubs/800-52/SP800-52.pdf SP800-52 Guidelines for the Selection and Use of Transport Layer Security (TLS) Implementations]&lt;br /&gt;
&lt;br /&gt;
== Secure Server Design  ==&lt;br /&gt;
&lt;br /&gt;
=== Rule - Use TLS for All Login Pages and All Authenticated Pages  ===&lt;br /&gt;
&lt;br /&gt;
The login page and all subsequent authenticated pages must be exclusively accessed over TLS. The initial login page, referred to as the &amp;quot;login landing page&amp;quot;, must be served over TLS. Failure to utilize TLS for the login landing page allows an attacker to modify the login form action, causing the user's credentials to be posted to an arbitrary location. Failure to utilize TLS for authenticated pages after the login enables an attacker to view the unencrypted session ID and compromise the user's authenticated session. &lt;br /&gt;
&lt;br /&gt;
=== Rule - Use TLS on Any Networks (External and Internal) Transmitting Sensitive Data  ===&lt;br /&gt;
&lt;br /&gt;
All networks, both external and internal, which transmit sensitive data must utilize TLS or an equivalent transport layer security mechanism. It is not sufficient to claim that access to the internal network is &amp;quot;restricted to employees&amp;quot;. Numerous recent data compromises have shown that the internal network can be breached by attackers. In these attacks, sniffers have been installed to access unencrypted sensitive data sent on the internal network. &lt;br /&gt;
&lt;br /&gt;
=== Rule - Do Not Provide Non-TLS Pages for Secure Content  ===&lt;br /&gt;
&lt;br /&gt;
All pages which are available over TLS must not be available over a non-TLS connection. A user may inadvertently bookmark or manually type a URL to a HTTP page (e.g. http://example.com/myaccount) within the authenticated portion of the application. If this request is processed by the application then the response, and any sensitive data, would be returned to the user over the clear text HTTP.&lt;br /&gt;
&lt;br /&gt;
=== Rule - REMOVED - Do Not Perform Redirects from Non-TLS Page to TLS Login Page  ===&lt;br /&gt;
&lt;br /&gt;
This recommendation has been removed. Ultimately, the below guidance will only provide user education and cannot provide any technical controls to protect the user against a man-in-the-middle attack.  &lt;br /&gt;
&lt;br /&gt;
--&lt;br /&gt;
&lt;br /&gt;
A common practice is to redirect users that have requested a non-TLS version of the login page to the TLS version (e.g. http://example.com/login redirects to https://example.com/login). This practice creates an additional attack vector for a man in the middle attack. In addition, redirecting from non-TLS versions to the TLS version reinforces to the user that the practice of requesting the non-TLS page is acceptable and secure.&lt;br /&gt;
&lt;br /&gt;
In this scenario, the man-in-the-middle attack is used by the attacker to intercept the non-TLS to TLS redirect message. The attacker then injects the HTML of the actual login page and changes the form to post over unencrypted HTTP. This allows the attacker to view the user's credentials as they are transmitted in the clear.&lt;br /&gt;
&lt;br /&gt;
It is recommended to display a security warning message to the user whenever the non-TLS login page is requested. This security warning should urge the user to always type &amp;quot;HTTPS&amp;quot; into the browser or bookmark the secure login page.  This approach will help educate users on the correct and most secure method of accessing the application.&lt;br /&gt;
&lt;br /&gt;
Currently there are no controls that an application can enforce to entirely mitigate this risk. Ultimately, this issue is the responsibility of the user since the application cannot prevent the user from initially typing [http://owasp.org http://example.com/login] (versus HTTPS). &lt;br /&gt;
&lt;br /&gt;
Note: [http://www.w3.org/Security/wiki/Strict_Transport_Security Strict Transport Security] will address this issue and will provide a server side control to instruct supporting browsers that the site should only be accessed over HTTPS&lt;br /&gt;
&lt;br /&gt;
=== Rule - Do Not Mix TLS and Non-TLS Content  ===&lt;br /&gt;
&lt;br /&gt;
A page that is available over TLS must be comprised completely of content which is transmitted over TLS. The page must not contain any content that is transmitted over unencrypted HTTP. This includes content from unrelated third party sites. &lt;br /&gt;
&lt;br /&gt;
An attacker could intercept any of the data transmitted over the unencrypted HTTP and inject malicious content into the user's page. This malicious content would be included in the page even if the overall page is served over TLS. In addition, an attacker could steal the user's session cookie that is transmitted with any non-TLS requests. This is possible if the cookie's 'secure' flag is not set. See the rule 'Use &amp;quot;Secure&amp;quot; Cookie Flag'&lt;br /&gt;
&lt;br /&gt;
=== Rule - Use &amp;quot;Secure&amp;quot; Cookie Flag  ===&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;Secure&amp;quot; flag must be set for all user cookies. Failure to use the &amp;quot;secure&amp;quot; flag enables an attacker to access the session cookie by tricking the user's browser into submitting a request to an unencrypted page on the site. This attack is possible even if the server is not configured to offer HTTP content since the attacker is monitoring the requests and does not care if the server responds with a 404 or doesn't respond at all.&lt;br /&gt;
&lt;br /&gt;
=== Rule - Keep Sensitive Data Out of the URL ===&lt;br /&gt;
&lt;br /&gt;
Sensitive data must not be transmitted via URL arguments. A more appropriate place is to store sensitive data in a server side repository or within the user's session.  When using TLS the URL arguments and values are encrypted during transit. However, there are two methods that the URL arguments and values could be exposed.&lt;br /&gt;
&lt;br /&gt;
1. The entire URL is cached within the local user's browser history. This may expose sensitive data to any other user of the workstation.&lt;br /&gt;
&lt;br /&gt;
2. The entire URL is exposed if the user clicks on a link to another HTTPS site. This may expose sensitive data within the referral field to the third party site. This exposure occurs in most browsers and will only occur on transitions between two TLS sites. &lt;br /&gt;
&lt;br /&gt;
For example, a user following a link on [http://owasp.org https://example.com] which leads to [http://owasp.org https://someOtherexample.com] would expose the full URL of [http://owasp.org https://example.com] (including URL arguments) in the referral header (within most browsers). This would not be the case if the user followed a link on [http://owasp.org https://example.com] to [http://owasp.org http://someHTTPexample.com]&lt;br /&gt;
&lt;br /&gt;
=== Rule - Prevent Caching of Sensitive Data ===&lt;br /&gt;
&lt;br /&gt;
The TLS protocol provides confidentiality only for data in transit but it does not help with potential data leakage issues at the client or intermediary proxies. As a result, it is frequently prudent to instruct these nodes not to cache or persist sensitive data. One option is to add anticaching headers to relevant HTTP responses, (for example, &amp;quot;Cache-Control: no-cache, no-store&amp;quot; and &amp;quot;Expires: 0&amp;quot; for coverage of many modern browsers as of 2013). For compatibility with HTTP/1.0 (i.e., when user agents are really old or the webserver works around quirks by forcing HTTP/1.0) the response should also include the header &amp;quot;Pragma: no-cache&amp;quot;. More information is available in [http://www.ietf.org/rfc/rfc2616.txt HTTP 1.1 RFC 2616], section 14.9.&lt;br /&gt;
&lt;br /&gt;
=== Rule - Use HTTP Strict Transport Security ===&lt;br /&gt;
&lt;br /&gt;
A new browser security setting called HTTP Strict Transport Security (HSTS) will significantly enhance the implementation of TLS for a domain. HSTS is enabled via a special response header and this instructs [https://www.owasp.org/index.php/HTTP_Strict_Transport_Security#Browser_Support compatible browsers] to enforce the following security controls:&lt;br /&gt;
&lt;br /&gt;
* All requests to the domain will be sent over HTTPS&lt;br /&gt;
* Any attempts to send an HTTP requests to the domain will be automatically upgraded by the browser to HTTPS before the request is sent&lt;br /&gt;
* If a user encounters a bad SSL certificate, the user will receive an error message and will not be allowed to override the warning message&lt;br /&gt;
&lt;br /&gt;
Additional information on HSTS can be found at [https://www.owasp.org/index.php/HTTP_Strict_Transport_Security https://www.owasp.org/index.php/HTTP_Strict_Transport_Security] and also on the OWASP [http://www.youtube.com/watch?v=zEV3HOuM_Vw&amp;amp;feature=youtube_gdata AppSecTutorial Series - Episode 4]&lt;br /&gt;
&lt;br /&gt;
=== Rule - Prefer Ephemeral Key Exchanges ===&lt;br /&gt;
&lt;br /&gt;
Ephemeral key exchanges are based on Diffie-Hellman and use per-session, temporary keys during the initial SSL/TLS handshake. They provide perfect forward secrecy (PFS), which means a compromise of the server's long term signing key does not compromise the confidentiality of past session. When the server uses an ephemeral key, the server will sign the temporary key with its long term key (the long term key is the customary key available in its certificate).&lt;br /&gt;
&lt;br /&gt;
Use cryptographic parameters (like DH-parameter) that use a secure length that match to the supported keylength of your certificate (&amp;gt;=2048 bits or equivalent Elliptic Curves). As some middleware had some issues with this, upgrade to the latest version.&lt;br /&gt;
&lt;br /&gt;
If you have a server farm and are providing forward secrecy, then you might have to disable session resumption. For example, Apache writes the session id's and master secrets to disk so all servers in the farm can participate in resuming a session (there is currently no in-memory mechanism to achieve the sharing). Writing the session id and master secret to disk undermines forward secrecy.&lt;br /&gt;
&lt;br /&gt;
== Server Certificate and Protocol Configuration  ==&lt;br /&gt;
&lt;br /&gt;
Note: If using a FIPS 140-2 cryptomodule disregard the following rules and defer to the recommended configuration for the particular cryptomodule.&lt;br /&gt;
&lt;br /&gt;
=== Rule - Be aware of and have a plan for the SHA-1 deprecation plan  ===&lt;br /&gt;
&lt;br /&gt;
In order to avoid presenting end users with progressive certificate warnings, organizations must proactively address the browser vendor's upcoming SHA-1 deprecation plans. The Google Chrome plan is probably the most specific and aggressive at this point: [http://googleonlinesecurity.blogspot.com/2014/09/gradually-sunsetting-sha-1.html Gradually sunsetting SHA-1]&lt;br /&gt;
&lt;br /&gt;
If your organization has no [https://support.globalsign.com/customer/portal/articles/1499561-sha-256-compatibility SHA256 compatibility issues] then it may be appropriate to move your site to a SHA256 signed certificate/chain.  If there are, or may be, issues - you should ensure that your SHA-1 certificates expire before 1/1/2017. &lt;br /&gt;
&lt;br /&gt;
=== Rule - Use an Appropriate Certification Authority for the Application's User Base  ===&lt;br /&gt;
&lt;br /&gt;
An application user must never be presented with a warning that the certificate was signed by an unknown or untrusted authority. The application's user population must have access to the public certificate of the certification authority which issued the server's certificate. For Internet accessible websites, the most effective method of achieving this goal is to purchase the TLS certificate from a recognize certification authority. Popular Internet browsers already contain the public certificates of these recognized certification authorities. &lt;br /&gt;
&lt;br /&gt;
Internal applications with a limited user population can use an internal certification authority provided its public certificate is securely distributed to all users. However, remember that all certificates issued by this certification authority will be trusted by the users. Therefore, utilize controls to protect the private key and ensure that only authorized individuals have the ability to sign certificates. &lt;br /&gt;
&lt;br /&gt;
The use of self signed certificates is never acceptable. Self signed certificates negate the benefit of end-point authentication and also significantly decrease the ability for an individual to detect a man-in-the-middle attack. &lt;br /&gt;
&lt;br /&gt;
=== Rule - Only Support Strong Protocols ===&lt;br /&gt;
&lt;br /&gt;
SSL/TLS is a collection of protocols. Weaknesses have been identified with earlier SSL protocols, including [http://www.schneier.com/paper-ssl-revised.pdf SSLv2] and [http://www.yaksman.org/~lweith/ssl.pdf SSLv3]. The best practice for transport layer protection is to only provide support for the TLS protocols - TLS1.0, TLS 1.1 and TLS 1.2. This configuration will provide maximum protection against skilled and determined attackers and is appropriate for applications handling sensitive data or performing critical operations.&lt;br /&gt;
&lt;br /&gt;
[http://en.wikipedia.org/wiki/Transport_Layer_Security#Web_browsers Nearly all modern browsers support at least TLS 1.0]. As of February 2013, contemporary browsers (Chrome v20+, IE v8+, Opera v10+, and Safari v5+) [http://en.wikipedia.org/wiki/Transport_Layer_Security#Web_browsers support TLS 1.1 and TLS 1.2]. You should provide support for TLS 1.1 and TLS 1.2 to accommodate clients which support the protocols. The client and server (usually) negotiate the best protocol, that is supported on both sides.&lt;br /&gt;
&lt;br /&gt;
TLS 1.0 is still widely used as 'best' protocol by a lot of browsers, that are not patched to the very latest version. It suffers [http://www.yassl.com/yaSSL/Blog/Entries/2010/10/7_Differences_between_SSL_and_TLS_Protocol_Versions.html CBC Chaining attacks and Padding Oracle attacks]. TLSv1.0 should only be used only after risk analysis and acceptance.&lt;br /&gt;
&lt;br /&gt;
Under no circumstances neither SSLv2 nor SSLv3 should be enabled as a protocol selection:&lt;br /&gt;
* The [http://www.schneier.com/paper-ssl-revised.pdf SSLv2 protocol is broken] and does not provide adequate transport layer protection.&lt;br /&gt;
* [http://www.yaksman.org/~lweith/ssl.pdf SSLv3 had been known for weaknesses] which severely compromise the channel's security long before the [https://www.openssl.org/~bodo/ssl-poodle.pdf 'POODLE'-Bug] finally stopped to tolerate this protocol by October 2014. Switching off SSLv3 terminates the support of legacy browsers like [https://www.ssllabs.com/ssltest/viewClient.html?name=IE&amp;amp;version=6&amp;amp;platform=XP IE6/XP] and elder.&lt;br /&gt;
&lt;br /&gt;
=== Rule - Only Support Strong Cryptographic Ciphers  ===&lt;br /&gt;
&lt;br /&gt;
Each protocol (SSLv3, TLSv1.0, etc) provides cipher suites. As of TLS 1.2, [http://www.iana.org/assignments/tls-parameters/tls-parameters.xml#tls-parameters-3 there is support for over 300 suites (320+ and counting)], including [http://www.mail-archive.com/cryptography@randombit.net/msg03785.html national vanity cipher suites]. The strength of the encryption used within a TLS session is determined by the encryption cipher negotiated between the server and the browser. In order to ensure that only strong cryptographic ciphers are selected the server must be modified to disable the use of weak ciphers and to configure the ciphers in an adequate order. It is recommended to configure the server to only support strong ciphers and to use sufficiently large key sizes. In general, the following should be observed when selecting CipherSuites:&lt;br /&gt;
* Use the very latest recommendations, they may be volantile these days&lt;br /&gt;
* Setup your Policy to get a Whitelist for recommended Ciphers, e.g.:&lt;br /&gt;
** Activate to set the Cipher Order by the Server&lt;br /&gt;
** Highest Priority for Ciphers that support 'Forward Secrecy' (-&amp;gt; Support ephemeral Diffie-Hellman key exchange) [http://vincent.bernat.im/en/blog/2011-ssl-perfect-forward-secrecy.html]&lt;br /&gt;
** Favor DHE over ECDHE (and monitor the CPU usage, see Notes below), ECDHE lacks now of really reliable Elliptic Curves, see discussion about secp{224,256,384,521}r1 and secp256k1, cf. [http://safecurves.cr.yp.to], [https://www.schneier.com/blog/archives/2013/09/the_nsa_is_brea.html#c1675929]. The solution might be to use [http://www.researchgate.net/profile/Johannes_Merkle/publication/260050106_Standardisierung_der_Brainpool-Kurven_fr_TLS_und_IPSec/file/60b7d52f36a0cc2fdd.pdf Brainpool Curves &amp;lt;nowiki&amp;gt;[German]&amp;lt;/nowiki&amp;gt;], defined for TLS in [http://tools.ietf.org/html/rfc7027 RFC 7027], or [http://eprint.iacr.org/2007/286 Edwards Curves]. The most promising candidate for the latter is [https://tools.ietf.org/html/draft-josefsson-tls-curve25519-05 'Curve25519'] (see [https://tools.ietf.org/html/draft-agl-cfrgcurve-00 DRAFT-agl-cfrgcurve-00]), that is not yet defined for TLS, cf. [http://www.iana.org/assignments/tls-parameters/tls-parameters.xhtml#tls-parameters-8 IANA] &amp;lt;!--- as at June 2014 ---&amp;gt;&lt;br /&gt;
** Use RSA-Keys (no DSA/DSS: they get very weak, if a bad entropy source is used during signing, cf. [https://projectbullrun.org/dual-ec/tls.html], [https://factorable.net/weakkeys12.conference.pdf]) &amp;lt;!--- as at June 2014 ---&amp;gt;&lt;br /&gt;
** Favor GCM over CBC regardless of the cipher size&lt;br /&gt;
** Watch also for Stream Ciphers which XOR the key stream with plaintext (such as AES/CTR mode) &amp;lt;!--- Jim please check this ---&amp;gt;&lt;br /&gt;
** Priorize the ciphers by the sizes of the Cipher and the MAC&lt;br /&gt;
** Use SHA1 or above for digests, prefer SHA2 (or equivalent)&lt;br /&gt;
** Disable weak ciphers (which is implicitly done by this whitelist) without disabling legacy browsers and bots that have to be supported (find the best compromise), actually the cipher TLS_RSA_WITH_3DES_EDE_CBC_SHA (0xa) does this job.&lt;br /&gt;
*** Disable cipher suites that do not offer encryption (eNULL, NULL)&lt;br /&gt;
*** Disable cipher suites that do not offer authentication (aNULL). aNULL includes anonymous cipher suites ADH (Anonymous Diffie-Hellman) and AECDH (Anonymous Elliptic Curve Diffie Hellman).&lt;br /&gt;
*** Disable export level ciphers (EXP, eg. ciphers containing DES)&lt;br /&gt;
*** Disable key sizes smaller than 128 bits for encrypting payload traffic (see [https://www.bsi.bund.de/SharedDocs/Downloads/DE/BSI/Publikationen/TechnischeRichtlinien/TR02102/BSI-TR-02102-2_pdf.html BSI: TR-02102 Part 2 (German)])&lt;br /&gt;
*** Disable the use of MD5 as a hashing mechanism for payload traffic&lt;br /&gt;
*** Disable the use of IDEA Cipher Suites (see [http://tools.ietf.org/html/rfc5469])&lt;br /&gt;
*** Disable RC4 cipher suites (see [https://tools.ietf.org/html/rfc7465], [http://www.isg.rhul.ac.uk/tls/])&lt;br /&gt;
** Ciphers should be usable for DH-Pamameters &amp;gt;= 2048 bits, without blocking legacy browsers (The cipher ‘DHE-RSA-AES128-SHA’ is suppressed as some browsers like to use it but are not capable to cope with DH-Params &amp;gt; 1024 bits.)&lt;br /&gt;
* Define a Cipher String that works with different Versions of your encryption tool, like openssl&lt;br /&gt;
* Verify your cipher string&lt;br /&gt;
** with an audit-tool, like [[O-Saft|OWASP 'O-Saft' (OWASP SSL audit for testers / OWASP SSL advanced forensic tool)]]&lt;br /&gt;
** listing it manually with your encryption software, e.g. openssl ciphers -v &amp;lt;cipher-string&amp;gt; (the result may differ by version), e.g.:&lt;br /&gt;
{{Top_10_2010:ExampleBeginTemplate|year=2013}} &lt;br /&gt;
openssl ciphers -v &amp;quot;EDH+aRSA+AESGCM:EDH+aRSA+AES:DHE-RSA-AES256-SHA:EECDH+aRSA+AESGCM:EECDH+aRSA+AES:ECDHE-RSA-AES256-SHA:ECDHE-RSA-AES128-SHA:RSA+AESGCM:RSA+AES+SHA:DES-CBC3-SHA:-DHE-RSA-AES128-SHA&amp;quot; &amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;#&amp;lt;/nowiki&amp;gt;add optionally ':!aNULL:!eNULL:!LOW:!MD5:!EXP:!PSK:!DSS:!RC4:!SEED:!ECDSA:!ADH:!IDEA' to protect older Versions of OpenSSL&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;#&amp;lt;/nowiki&amp;gt;you may use openssl ciphers -V &amp;quot;...&amp;quot; for openssl &amp;gt;= 1.0.1:&lt;br /&gt;
&amp;lt;small&amp;gt;&lt;br /&gt;
 0x00,0x9F - DHE-RSA-AES256-GCM-SHA384   TLSv1.2 Kx=DH     Au=RSA  Enc=AESGCM(256) Mac=AEAD&lt;br /&gt;
 0x00,0x9E - DHE-RSA-AES128-GCM-SHA256   TLSv1.2 Kx=DH     Au=RSA  Enc=AESGCM(128) Mac=AEAD&lt;br /&gt;
 0x00,0x6B - DHE-RSA-AES256-SHA256       TLSv1.2 Kx=DH     Au=RSA  Enc=AES(256)    Mac=SHA256&lt;br /&gt;
 0x00,0x39 - DHE-RSA-AES256-SHA          SSLv3   Kx=DH     Au=RSA  Enc=AES(256)    Mac=SHA1&lt;br /&gt;
 0x00,0x67 - DHE-RSA-AES128-SHA256       TLSv1.2 Kx=DH     Au=RSA  Enc=AES(128)    Mac=SHA256&lt;br /&gt;
 0xC0,0x30 - ECDHE-RSA-AES256-GCM-SHA384 TLSv1.2 Kx=ECDH   Au=RSA  Enc=AESGCM(256) Mac=AEAD&lt;br /&gt;
 0xC0,0x2F - ECDHE-RSA-AES128-GCM-SHA256 TLSv1.2 Kx=ECDH   Au=RSA  Enc=AESGCM(128) Mac=AEAD&lt;br /&gt;
 0xC0,0x28 - ECDHE-RSA-AES256-SHA384     TLSv1.2 Kx=ECDH   Au=RSA  Enc=AES(256)    Mac=SHA384&lt;br /&gt;
 0xC0,0x14 - ECDHE-RSA-AES256-SHA        SSLv3   Kx=ECDH   Au=RSA  Enc=AES(256)    Mac=SHA1&lt;br /&gt;
 0xC0,0x27 - ECDHE-RSA-AES128-SHA256     TLSv1.2 Kx=ECDH   Au=RSA  Enc=AES(128)    Mac=SHA256&lt;br /&gt;
 0xC0,0x13 - ECDHE-RSA-AES128-SHA        SSLv3   Kx=ECDH   Au=RSA  Enc=AES(128)    Mac=SHA1&lt;br /&gt;
 0x00,0x9D - AES256-GCM-SHA384           TLSv1.2 Kx=RSA    Au=RSA  Enc=AESGCM(256) Mac=AEAD&lt;br /&gt;
 0x00,0x9C - AES128-GCM-SHA256           TLSv1.2 Kx=RSA    Au=RSA  Enc=AESGCM(128) Mac=AEAD&lt;br /&gt;
 0x00,0x35 - AES256-SHA                  SSLv3   Kx=RSA    Au=RSA  Enc=AES(256)    Mac=SHA1&lt;br /&gt;
 0x00,0x2F - AES128-SHA                  SSLv3   Kx=RSA    Au=RSA  Enc=AES(128)    Mac=SHA1&lt;br /&gt;
 0x00,0x0A - DES-CBC3-SHA                SSLv3   Kx=RSA    Au=RSA  Enc=3DES(168)   Mac=SHA1&lt;br /&gt;
&amp;lt;/small&amp;gt;&lt;br /&gt;
{{Top_10_2010:ExampleEndTemplate}}&lt;br /&gt;
&lt;br /&gt;
* Inform yourself how to securely configure the settings for your used services or hardware, e.g. [https://bettercrypto.org BetterCrypto.org: Applied Crypto Hardening (DRAFT)]&lt;br /&gt;
* Check new software and hardware versions for new security settings.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Notes:&amp;lt;/b&amp;gt;&lt;br /&gt;
* According to my researches the most common browsers should be supported with this setting, too (see also [https://www.ssllabs.com/ssltest/index.html SSL Labs: SSL Server Test -&amp;gt; SSL Report -&amp;gt; Handshake Simulation]).&lt;br /&gt;
* Monitor the performance of your server, e.g. the TLS handshake with DHE hinders the CPU abt 2.4 times more than ECDHE, cf. [http://vincent.bernat.im/en/blog/2011-ssl-perfect-forward-secrecy.html#some-benchmarks Vincent Bernat, 2011], [http://nmav.gnutls.org/2011/12/price-to-pay-for-perfect-forward.html nmav's Blog, 2011].&lt;br /&gt;
* Use of Ephemeral Diffie-Hellman key exchange will protect confidentiality of the transmitted plaintext data even if the corresponding RSA or DSS server private key got compromised. An attacker would have to perform active man-in-the-middle attack at the time of the key exchange to be able to extract the transmitted plaintext. All modern browsers support this key exchange with the notable exception of Internet Explorer prior to Windows Vista.&lt;br /&gt;
&lt;br /&gt;
Additional information can be obtained within the [http://www.ietf.org/rfc/rfc5246.txt TLS 1.2 RFC 5246], [https://www.ssllabs.com/projects/best-practices/index.html SSL Labs: 'SSL/TLS Deployment Best Practices'], [https://www.bsi.bund.de/SharedDocs/Downloads/DE/BSI/Publikationen/TechnischeRichtlinien/TR02102/BSI-TR-02102-2_pdf.html BSI: 'TR-02102 Part 2 (German)'], [http://www.enisa.europa.eu/activities/identity-and-trust/library/deliverables/algorithms-key-sizes-and-parameters-report ENISA: 'Algorithms, Key Sizes and Parameters Report'] and [http://csrc.nist.gov/groups/STM/cmvp/documents/fips140-2/FIPS1402IG.pdf FIPS 140-2 IG]. &lt;br /&gt;
&lt;br /&gt;
=== Rule - Support TLS-PSK and TLS-SRP for Mutual Authentication ===&lt;br /&gt;
&lt;br /&gt;
When using a shared secret or password offer TLS-PSK (Pre-Shared Key) or TLS-SRP (Secure Remote Password), which are known as Password Authenticated Key Exchange (PAKEs). TLS-PSK and TLS-SRP properly bind the channel, which refers to the cryptographic binding between the outer tunnel and the inner authentication protocol. IANA currently reserves [http://www.iana.org/assignments/tls-parameters/tls-parameters.xml#tls-parameters-3 79 PSK cipehr suites] and [http://www.iana.org/assignments/tls-parameters/tls-parameters.xml#tls-parameters-3 9 SRP cipher suites].&lt;br /&gt;
&lt;br /&gt;
Basic authentication places the user's password on the wire in the plain text after a server authenticates itself. Basic authentication only provides unilateral authentication. In contrast, both TLS-PSK and TLS-SRP provide mutual authentication, meaning each party proves it knows the password without placing the password on the wire in the plain text.&lt;br /&gt;
&lt;br /&gt;
Finally, using a PAKE removes the need to trust an outside party, such as a Certification Authority (CA).&lt;br /&gt;
&lt;br /&gt;
=== Rule - Only Support Secure Renegotiations  ===&lt;br /&gt;
&lt;br /&gt;
A design weakness in TLS, identified as [http://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2009-3555 CVE-2009-3555], allows an attacker to inject a plaintext of his choice into a TLS session of a victim. In the HTTPS context the attacker might be able to inject his own HTTP requests on behalf of the victim. The issue can be mitigated either by disabling support for TLS renegotiations or by supporting only renegotiations compliant with [http://www.ietf.org/rfc/rfc5746.txt RFC 5746]. All modern browsers have been updated to comply with this RFC.&lt;br /&gt;
&lt;br /&gt;
=== Rule - Disable Compression ===&lt;br /&gt;
&lt;br /&gt;
Compression Ratio Info-leak Made Easy (CRIME) is an exploit against the data compression scheme used by the TLS and SPDY protocols. The exploit allows an adversary to recover user authentication cookies from HTTPS. The recovered cookie can be subsequently used for session hijacking attacks.&lt;br /&gt;
&lt;br /&gt;
=== Rule - Use Strong Keys &amp;amp; Protect Them ===&lt;br /&gt;
&lt;br /&gt;
The private key used to generate the cipher key must be sufficiently strong for the anticipated lifetime of the private key and corresponding certificate. The current best practice is to select a key size of at least 2048 bits. Additional information on key lifetimes and comparable key strengths can be found in [http://www.keylength.com/en/compare/], [http://csrc.nist.gov/publications/nistpubs/800-57/sp800-57_part1_rev3_general.pdf NIST SP 800-57]. In addition, the private key must be stored in a location that is protected from unauthorized access.&lt;br /&gt;
&lt;br /&gt;
=== Rule - Use a Certificate That Supports Required Domain Names ===&lt;br /&gt;
&lt;br /&gt;
A user should never be presented with a certificate error, including prompts to reconcile domain or hostname mismatches, or expired certificates. If the application is available at both [https://owasp.org https://www.example.com] and [https://owasp.org https://example.com] then an appropriate certificate, or certificates, must be presented to accommodate the situation. The presence of certificate errors desensitizes users to TLS error messages and increases the possibility an attacker could launch a convincing phishing or man-in-the-middle attack.&lt;br /&gt;
&lt;br /&gt;
For example, consider a web application accessible at [https://owasp.org https://abc.example.com] and [https://owasp.org https://xyz.example.com]. One certificate should be acquired for the host or server ''abc.example.com''; and a second certificate for host or server ''xyz.example.com''. In both cases, the hostname would be present in the Subject's Common Name (CN).&lt;br /&gt;
&lt;br /&gt;
Alternatively, the Subject Alternate Names (SANs) can be used to provide a specific listing of multiple names where the certificate is valid. In the example above, the certificate could list the Subject's CN as ''example.com'', and list two SANs: ''abc.example.com'' and ''xyz.example.com''. These certificates are sometimes referred to as &amp;quot;multiple domain certificates&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
=== Rule - Use Fully Qualified Names in Certificates ===&lt;br /&gt;
&lt;br /&gt;
Use fully qualified names in the DNS name field, and do not use unqualifed names (e.g., 'www'), local names (e.g., 'localhost'), or private IP addresses (e.g., 192.168.1.1) in the DNS name field. Unqualifed names, local names, or private IP addresses violate the certificate specification.&lt;br /&gt;
 &lt;br /&gt;
=== Rule - Do Not Use Wildcard Certificates ===&lt;br /&gt;
&lt;br /&gt;
You should refrain from using wildcard certificates. Though they are expedient at circumventing annoying user prompts, they also [[Least_privilege|violate the principal of least privilege]] and asks the user to trust all machines, including developer's machines, the secretary's machine in the lobby and the sign-in kiosk. Obtaining access to the private key is left as an exercise for the attacker, but its made much easier when stored on the file system unprotected.&lt;br /&gt;
&lt;br /&gt;
Statistics gathered by Qualys for [http://media.blackhat.com/bh-us-10/presentations/Ristic/BlackHat-USA-2010-Ristic-Qualys-SSL-Survey-HTTP-Rating-Guide-slides.pdf Internet SSL Survey 2010] indicate wildcard certificates have a 4.4% share, so the practice is not standard for public facing hosts. Finally, wildcard certificates violate [https://www.cabforum.org/EV_Certificate_Guidelines.pdf EV Certificate Guidelines].&lt;br /&gt;
&lt;br /&gt;
=== Rule - Do Not Use RFC 1918 Addresses in Certificates ===&lt;br /&gt;
&lt;br /&gt;
Certificates should not use private addresses. RFC 1918 is [http://tools.ietf.org/rfc/rfc1918.txt Address Allocation for Private Internets]. Private addresses are Internet Assigned Numbers Authority (IANA) reserved and include 192.168/16, 172.16/12, and 10/8.&lt;br /&gt;
&lt;br /&gt;
Certificates issued with private addresses violate [https://www.cabforum.org/EV_Certificate_Guidelines.pdf EV Certificate Guidelines]. In addition, Peter Gutmann writes in in [http://www.cs.auckland.ac.nz/~pgut001/pubs/book.pdf Engineering Security]: &amp;quot;This one is particularly troublesome because, in combination with the router-compromise attacks... and ...OSCP-defeating measures, it allows an attacker to spoof any EV-certificate site.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
=== Rule - Always Provide All Needed Certificates ===&lt;br /&gt;
&lt;br /&gt;
Clients attempt to solve the problem of identifying a server or host using PKI and X509 certificate. When a user receives a server or host's certificate, the certificate must be validated back to a trusted root certification authority. This is known as path validation.&lt;br /&gt;
&lt;br /&gt;
There can be one or more intermediate certificates in between the end-entity (server or host) certificate and root certificate. In addition to validating both endpoints, the user will also have to validate all intermediate certificates. Validating all intermediate certificates can be tricky because the user may not have them locally. This is a well-known PKI issue called the “Which Directory?&amp;quot; problem.&lt;br /&gt;
&lt;br /&gt;
To avoid the “Which Directory?&amp;quot; problem, a server should provide the user with all required certificates used in a path validation.&lt;br /&gt;
&lt;br /&gt;
== Test your overall TLS/SSL setup and your Certificate ==&lt;br /&gt;
&lt;br /&gt;
* [[Testing_for_SSL-TLS_%28OWASP-CM-001%29 | OWASP Testing Guide: Chapter on SSL/TLS Testing]]&lt;br /&gt;
* [[O-Saft|OWASP 'O-Saft' (OWASP SSL audit for testers / OWASP SSL advanced forensic tool)]]&lt;br /&gt;
* [https://www.ssllabs.com/ssltest SSL LABS Server Test]&lt;br /&gt;
* other Tools: [[Testing_for_Weak_SSL/TSL_Ciphers,_Insufficient_Transport_Layer_Protection_%28OWASP-EN-002%29#References| Testing for Weak SSL/TSL Ciphers, Insufficient Transport Layer Protection (OWASP-EN-002) (DRAFT)]] - References - Tools&lt;br /&gt;
&lt;br /&gt;
== Client (Browser) Configuration  ==&lt;br /&gt;
&lt;br /&gt;
The validation procedures to ensure that a certificate is valid are complex and difficult to correctly perform.  In a typical web application model, these checks will be performed by the client's web browser in accordance with local browser settings and are out of the control of the application. However, these items do need to be addressed in the following scenarios:&lt;br /&gt;
&lt;br /&gt;
* The application server establishes connections to other applications over TLS for purposes such as web services or any exchange of data&lt;br /&gt;
* A thick client application is connecting to a server via TLS&lt;br /&gt;
&lt;br /&gt;
In these situations extensive certificate validation checks must occur in order to establish the validity of the certificate. Consult the following resources to assist in the design and testing of this functionality. The NIST PKI testing site includes a full test suite of certificates and expected outcomes of the test cases.&lt;br /&gt;
* [http://csrc.nist.gov/groups/ST/crypto_apps_infra/pki/pkitesting.html NIST PKI Testing]&lt;br /&gt;
* [http://www.ietf.org/rfc/rfc5280.txt IETF RFC 5280]&lt;br /&gt;
&lt;br /&gt;
As specified in the above guidance, if the certificate can not be validated for any reason then the connection between the client and server must be dropped. Any data exchanged over a connection where the certificate has not properly been validated could be exposed to unauthorized access or modification.&lt;br /&gt;
&lt;br /&gt;
== Additional Controls  ==&lt;br /&gt;
&lt;br /&gt;
=== Extended Validation Certificates  ===&lt;br /&gt;
&lt;br /&gt;
Extended validation certificates (EV Certificates) proffer an enhanced investigation by the issuer into the requesting party due to the industry's race to the bottom. The purpose of EV certificates is to provide the user with greater assurance that the owner of the certificate is a verified legal entity for the site. Browsers with support for EV certificates distinguish an EV certificate in a variety of ways. Internet Explorer will color a portion of the URL in green, while Mozilla will add a green portion to the left of the URL indicating the company name. &lt;br /&gt;
&lt;br /&gt;
High value websites should consider the use of EV certificates to enhance customer confidence in the certificate. It should also be noted that EV certificates do not provide any greater technical security for the TLS. The purpose of the EV certificate is to increase user confidence that the target site is indeed who it claims to be.&lt;br /&gt;
&lt;br /&gt;
=== Client-Side Certificates  ===&lt;br /&gt;
&lt;br /&gt;
Client side certificates can be used with TLS to prove the identity of the client to the server. Referred to as &amp;quot;two-way TLS&amp;quot;, this configuration requires the client to provide their certificate to the server, in addition to the server providing their's to the client. If client certificates are used, ensure that the same validation of the client certificate is performed by the server, as indicated for the validation of server certificates above. In addition, the server should be configured to drop the TLS connection if the client certificate cannot be verified or is not provided. &lt;br /&gt;
&lt;br /&gt;
The use of client side certificates is relatively rare currently due to the complexities of certificate generation, safe distribution, client side configuration, certificate revocation and reissuance, and the fact that clients can only authenticate on machines where their client side certificate is installed. Such certificates are typically used for very high value connections that have small user populations.&lt;br /&gt;
&lt;br /&gt;
=== Certificate and Public Key Pinning ===&lt;br /&gt;
&lt;br /&gt;
Hybrid and native applications can take advantage of [[Certificate_and_Public_Key_Pinning|certificate and public key pinning]]. Pinning associates a host (for example, server) with an identity (for example, certificate or public key), and allows an application to leverage knowledge of the pre-existing relationship. At runtime, the application would inspect the certificate or public key received after connecting to the server. If the certificate or public key is expected, then the application would proceed as normal. If unexpected, the application would stop using the channel and close the connection since an adversary could control the channel or server.&lt;br /&gt;
&lt;br /&gt;
Pinning still requires customary X509 checks, such as revocation, since CRLs and OCSP provides real time status information. Otherwise, an application could possibly (1) accept a known bad certificate; or (2) require an out-of-band update, which could result in a lengthy App Store approval.&lt;br /&gt;
&lt;br /&gt;
Browser based applications are at a disadvantage since most browsers do not allow the user to leverage pre-existing relationships and ''a priori'' knowledge. In addition, Javascript and Websockets do not expose methods to for a web app to query the underlying secure connection information (such as the certificate or public key). It is noteworthy that Chromium based browsers perform pinning on selected sites, but the list is currently maintained by the vendor.&lt;br /&gt;
&lt;br /&gt;
For more information, please see the [[Pinning Cheat Sheet]].&lt;br /&gt;
&lt;br /&gt;
= Providing Transport Layer Protection for Back End and Other Connections  =&lt;br /&gt;
&lt;br /&gt;
Although not the focus of this cheat sheet, it should be stressed that transport layer protection is necessary for back-end connections and any other connection where sensitive data is exchanged or where user identity is established. Failure to implement an effective and robust transport layer security will expose sensitive data and undermine the effectiveness of any authentication or access control mechanism. &lt;br /&gt;
&lt;br /&gt;
== Secure Internal Network Fallacy  ==&lt;br /&gt;
&lt;br /&gt;
The internal network of a corporation is not immune to attacks. Many recent high profile intrusions, where thousands of sensitive customer records were compromised, have been perpetrated by attackers that have gained internal network access and then used sniffers to capture unencrypted data as it traversed the internal network.&lt;br /&gt;
&lt;br /&gt;
= Related Articles  =&lt;br /&gt;
&lt;br /&gt;
* Mozilla – [https://wiki.mozilla.org/Security/Server_Side_TLS#Recommended_configurations Mozilla Recommended Configurations]&lt;br /&gt;
* OWASP – [[Testing for SSL-TLS (OWASP-CM-001)|Testing for SSL-TLS]], and OWASP [[Guide to Cryptography]] &lt;br /&gt;
* OWASP – [http://www.owasp.org/index.php/ASVS Application Security Verification Standard (ASVS) – Communication Security Verification Requirements (V10)]&lt;br /&gt;
* OWASP – ASVS Article on [[Why you need to use a FIPS 140-2 validated cryptomodule]]&lt;br /&gt;
* SSL Labs – [https://www.ssllabs.com/projects/best-practices/index.html SSL/TLS Deployment Best Practices]&lt;br /&gt;
* SSL Labs – [http://www.ssllabs.com/projects/rating-guide/index.html SSL Server Rating Guide]&lt;br /&gt;
* ENISA – [http://www.enisa.europa.eu/activities/identity-and-trust/library/deliverables/algorithms-key-sizes-and-parameters-report Algorithms, Key Sizes and Parameters Report]&lt;br /&gt;
* BSI   – [https://www.bsi.bund.de/SharedDocs/Downloads/DE/BSI/Publikationen/TechnischeRichtlinien/TR02102/BSI-TR-02102-2_pdf.html BSI TR-02102 Part 2 (German)]&lt;br /&gt;
* yaSSL – [http://www.yassl.com/yaSSL/Blog/Entries/2010/10/7_Differences_between_SSL_and_TLS_Protocol_Versions.html Differences between SSL and TLS Protocol Versions]&lt;br /&gt;
* NIST – [http://csrc.nist.gov/publications/PubsSPs.html#800-52 SP 800-52 Rev. 1 Guidelines for the Selection, Configuration, and Use of Transport Layer Security (TLS) Implementations]&lt;br /&gt;
* NIST – [http://csrc.nist.gov/publications/fips/fips140-2/fips1402.pdf FIPS 140-2 Security Requirements for Cryptographic Modules]&lt;br /&gt;
* NIST – [http://csrc.nist.gov/groups/STM/cmvp/documents/fips140-2/FIPS1402IG.pdf Implementation Guidance for FIPS PUB 140-2 and the Cryptographic Module Validation Program]&lt;br /&gt;
* NIST - [http://csrc.nist.gov/publications/nistpubs/800-57/sp800-57_part1_rev3_general.pdf NIST SP 800-57 Recommendation for Key Management, Revision 3], [http://csrc.nist.gov/publications/PubsDrafts.html#SP-800-57-Part%203-Rev.1 Public DRAFT]&lt;br /&gt;
* NIST – [http://csrc.nist.gov/publications/drafts.html#sp800-95 SP 800-95 Guide to Secure Web Services] &lt;br /&gt;
* IETF – [http://www.ietf.org/rfc/rfc5280.txt RFC 5280 Internet X.509 Public Key Infrastructure Certificate and Certificate Revocation List (CRL) Profile]&lt;br /&gt;
* IETF – [http://www.ietf.org/rfc/rfc2246.txt RFC 2246 The Transport Layer Security (TLS) Protocol Version 1.0 (JAN 1999)]&lt;br /&gt;
* IETF – [http://www.ietf.org/rfc/rfc4346.txt RFC 4346 The Transport Layer Security (TLS) Protocol Version 1.1 (APR 2006)]&lt;br /&gt;
* IETF – [http://www.ietf.org/rfc/rfc5246.txt RFC 5246 The Transport Layer Security (TLS) Protocol Version 1.2 (AUG 2008)]&lt;br /&gt;
* bettercrypto - [https://bettercrypto.org Applied Crypto Hardening: HOWTO for secure crypto settings of the most common services (DRAFT)]&lt;br /&gt;
&lt;br /&gt;
= Authors and Primary Editors  =&lt;br /&gt;
&lt;br /&gt;
Michael Coates - michael.coates[at]owasp.org &amp;lt;br/&amp;gt;&lt;br /&gt;
Dave Wichers - dave.wichers[at]owasp.org &amp;lt;br/&amp;gt;&lt;br /&gt;
Michael Boberski - boberski_michael[at]bah.com&amp;lt;br/&amp;gt;&lt;br /&gt;
Tyler Reguly -treguly[at]sslfail.com&lt;br /&gt;
| valign=&amp;quot;top&amp;quot;  style=&amp;quot;padding-left:25px;width:300px;border-right: 1px dotted gray;padding-right:25px;&amp;quot; |&lt;br /&gt;
&lt;br /&gt;
== Other Cheatsheets ==&lt;br /&gt;
&lt;br /&gt;
{{Cheatsheet_Navigation_Body}}&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[Category:Cheatsheets]]&lt;br /&gt;
[[Category:OWASP Best Practices]]&lt;/div&gt;</summary>
		<author><name>Crashedmind</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Cryptographic_Storage_Cheat_Sheet&amp;diff=186104</id>
		<title>Cryptographic Storage Cheat Sheet</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Cryptographic_Storage_Cheat_Sheet&amp;diff=186104"/>
				<updated>2014-11-27T16:12:39Z</updated>
		
		<summary type="html">&lt;p&gt;Crashedmind: added ref to Nov 2014 report from EUNISA on &amp;quot;Algorithms, key size and parameters&amp;quot; that provides crypto recommendations for &amp;quot;specialists designing and implementing cryptographic solutions, within commercial organisations&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt; __NOTOC__&lt;br /&gt;
&amp;lt;div style=&amp;quot;width:100%;height:160px;border:0,margin:0;overflow: hidden;&amp;quot;&amp;gt;[[File:Cheatsheets-header.jpg|link=]]&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;padding: 0;margin:0;margin-top:10px;text-align:left;&amp;quot; |-&lt;br /&gt;
| valign=&amp;quot;top&amp;quot;  style=&amp;quot;border-right: 1px dotted gray;padding-right:25px;&amp;quot; |&lt;br /&gt;
Last revision (mm/dd/yy): '''{{REVISIONMONTH}}/{{REVISIONDAY}}/{{REVISIONYEAR}}''' &lt;br /&gt;
= Introduction  =&lt;br /&gt;
 __TOC__{{TOC hidden}}&lt;br /&gt;
&lt;br /&gt;
This article provides a simple model to follow when implementing solutions for data at rest.&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
== Architectural Decision  ==&lt;br /&gt;
&lt;br /&gt;
An architectural decision must be made to determine the appropriate method to protect data at rest.  There are such wide varieties of products, methods and mechanisms for cryptographic storage. This cheat sheet will only focus on low-level guidelines for developers and architects who are implementing cryptographic solutions. We will not address specific vendor solutions, nor will we address the design of cryptographic algorithms.&lt;br /&gt;
&lt;br /&gt;
= Providing Cryptographic Functionality  =&lt;br /&gt;
&lt;br /&gt;
== Secure Cryptographic Storage Design  ==&lt;br /&gt;
&lt;br /&gt;
=== Rule - Only store sensitive data that you need ===&lt;br /&gt;
&lt;br /&gt;
Many eCommerce businesses utilize third party payment providers to store credit card information for recurring billing. This offloads the burden of keeping credit card numbers safe.&lt;br /&gt;
&lt;br /&gt;
=== Rule - Use strong approved Authenticated Encryption  ===&lt;br /&gt;
E.g. [http://en.wikipedia.org/wiki/CCM_mode CCM] or [http://en.wikipedia.org/wiki/GCM_mode GCM] are approved [http://en.wikipedia.org/wiki/Authenticated_encryption Authenticated Encryption] modes based on [http://en.wikipedia.org/wiki/Advanced_Encryption_Standard AES] algorithm.&lt;br /&gt;
&lt;br /&gt;
==== Rule - Use strong approved cryptographic algorithms ====&lt;br /&gt;
Do not implement an existing cryptographic algorithm on your own, no matter how easy it appears. Instead, use widely accepted algorithms and widely accepted implementations. &lt;br /&gt;
&lt;br /&gt;
Only use approved public algorithms such as AES, RSA public key cryptography, and SHA-256 or better for hashing. Do not use weak algorithms, such as MD5 or SHA1. Note that the classification of a &amp;quot;strong&amp;quot; cryptographic algorithm can change over time. See [http://csrc.nist.gov/publications/nistpubs/800-57/sp800-57_part1_rev3_general.pdf NIST approved algorithms] or ISO TR 14742 “Recommendations on Cryptographic Algorithms and their use” or [http://www.enisa.europa.eu/activities/identity-and-trust/library/deliverables/algorithms-key-size-and-parameters-report-2014/at_download/fullReport Algorithms, key size and parameters report – 2014] from European Union Agency for Network and Information Security. &lt;br /&gt;
E.g. [http://en.wikipedia.org/wiki/Advanced_Encryption_Standard AES] 128, [http://en.wikipedia.org/wiki/RSA_(cryptosystem) RSA] 3072, [http://en.wikipedia.org/wiki/Secure_Hash_Algorithm SHA] 256. &lt;br /&gt;
&lt;br /&gt;
Ensure that the implementation has (at minimum) had some cryptography experts involved in its creation. If possible, use an implementation that is FIPS 140-2 certified. &lt;br /&gt;
&lt;br /&gt;
See [http://csrc.nist.gov/publications/nistpubs/800-57/sp800-57_part1_rev3_general.pdf NIST approved algorithms] Table 2 “Comparable strengths” for the strength (“security bits”) of different algorithms and key lengths, and how they compare to each other. &lt;br /&gt;
&lt;br /&gt;
* In general, where different algorithms are used, they should have comparable strengths e.g. if an AES-128 key is to be encrypted, an AES-128 key or greater, or RSA-3072 or greater could be used to encrypt it. &lt;br /&gt;
* In general, hash lengths are twice as long as the security bits offered by the symmetric/asymmetric algorithm&amp;amp;nbsp; e.g. SHA-224 for 3TDEA (112 security bits) (due to the [http://en.wikipedia.org/wiki/Birthday_attack Birthday Attack])&lt;br /&gt;
&lt;br /&gt;
If a password is being used to protect keys then the [http://en.wikipedia.org/wiki/Password_strength password strength]should be sufficient for the strength of the keys it is protecting.&lt;br /&gt;
&lt;br /&gt;
==== Rule – Use approved cryptographic modes  ====&lt;br /&gt;
In general, you should not use AES, DES or other symmetric cipher primitives directly. [http://csrc.nist.gov/groups/ST/toolkit/BCM/current_modes.html NIST approved modes] should be used instead. &lt;br /&gt;
&lt;br /&gt;
NOTE: Do not use [http://en.wikipedia.org/wiki/Block_cipher_modes_of_operation#Electronic_codebook_.28ECB.29 ECB mode] for encrypting lots of data (the other modes are better because they chain the blocks of data together to improve the data security).&lt;br /&gt;
&lt;br /&gt;
==== Rule – Use strong random numbers  ====&lt;br /&gt;
Ensure that all random numbers, especially those used for cryptographic parameters (keys, IV’s, MAC tags), random file names, random GUIDs, and random strings are generated in a cryptographically strong fashion. &lt;br /&gt;
&lt;br /&gt;
Ensure that random algorithms are seeded with sufficient entropy.&lt;br /&gt;
&lt;br /&gt;
Tools like [http://csrc.nist.gov/groups/ST/toolkit/rng/documentation_software.html NIST RNG Test tool] (as used in PCI PTS Derived Test Requirements) can be used to comprehensively assess the quality of a Random Number Generator by reading e.g. 128MB of data from the RNG source and then assessing its randomness properties with the tool. &lt;br /&gt;
&lt;br /&gt;
==== Rule - Use Authenticated Encryption of data ====&lt;br /&gt;
Use ([http://en.wikipedia.org/wiki/Authenticated_encryption AE]) modes under a uniform API. Recommended modes include [http://en.wikipedia.org/wiki/CCM_mode CCM], and [http://en.wikipedia.org/wiki/Galois/Counter_Mode GCM] as these, and only these as of November 2014, are specified in [http://csrc.nist.gov/groups/ST/toolkit/BCM/current_modes.html NIST approved modes], ISO IEC 19772 (2009) &amp;quot;Information technology — Security techniques — Authenticated encryption&amp;quot;, and [http://en.wikipedia.org/wiki/IEEE_P1619 IEEE P1619 Standard for Cryptographic Protection of Data on Block-Oriented Storage Devices] &lt;br /&gt;
&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Authenticated_encryption Authenticated Encryption] gives [http://en.wikipedia.org/wiki/Confidentiality confidentiality],&amp;amp;nbsp;[http://en.wikipedia.org/wiki/Data_integrity integrity], and&amp;amp;nbsp;[http://en.wikipedia.org/wiki/Authentication authenticity] (CIA); encryption alone just gives confidentiality. Encryption must always be combined with message integrity and authenticity protection. Otherwise the ciphertext may be vulnerable to manipulation causing changes to the underlying plaintext data, especially if it's being passed over untrusted channels (e.g. in an URL or cookie). &lt;br /&gt;
* These modes require only one key. In general, the tag sizes and the IV sizes should be set to maximum values.&lt;br /&gt;
&lt;br /&gt;
If these recommended [http://en.wikipedia.org/wiki/Authenticated_encryption AE] modes are not available&lt;br /&gt;
&lt;br /&gt;
* combine encryption in [http://en.wikipedia.org/wiki/Block_cipher_modes_of_operation#Cipher-block_chaining_.28CBC.29 cipher-block chaining (CBC) mode] with post-encryption message authentication code, such as [http://en.wikipedia.org/wiki/HMAC HMAC] or [http://en.wikipedia.org/wiki/CMAC CMAC] i.e. Encrypt-then-MAC. &lt;br /&gt;
** Note that Integrity and Authenticity are preferable to Integrity alone i.e. a MAC such as HMAC-SHA256 or HMAC-SHA512 is a better choice than SHA-256 or SHA-512.&lt;br /&gt;
* Use 2 independent keys for these 2 independent operations. &lt;br /&gt;
* Do not use [http://en.wikipedia.org/wiki/CBC-MAC#Security_with_fixed_and_variable-length_messages CBC MAC for variable length data] &lt;br /&gt;
* The [http://csrc.nist.gov/groups/STM/cavp/index.html CAVP program] is a good default place to go for validation of cryptographic algorithms when one does not have AES or one of the authenticated encryption modes that provide confidentiality and authenticity (i.e., data origin authentication) such as CCM, EAX, CMAC, etc. For Java, if you are using SunJCE that will be the case. The cipher modes supported in JDK 1.5 and later are CBC, CFB, CFBx, CTR, CTS, ECB, OFB, OFBx, PCBC. None of these cipher modes are authenticated encryption modes. (That's why it is added explicitly.) If you are using an alternate JCE provider such as Bouncy Castle, RSA JSafe, IAIK, etc., then these authenticated encryption modes should be used.&lt;br /&gt;
&lt;br /&gt;
Note: [http://en.wikipedia.org/wiki/Disk_encryption_theory Disk encryption]&amp;amp;nbsp;is a special case of&amp;amp;nbsp;[http://en.wikipedia.org/wiki/Data_at_Rest data at rest]&amp;amp;nbsp;e.g. Encrypted File System on a Hard Disk Drive. [http://csrc.nist.gov/publications/nistpubs/800-38E/nist-sp-800-38E.pdf XTS-AES mode] is optimized for Disk encryption and is one of the [http://csrc.nist.gov/groups/ST/toolkit/BCM/current_modes.html NIST approved modes]&amp;lt;nowiki&amp;gt;; it provides confidentiality and some protection against data manipulation (but not as strong as the &amp;lt;/nowiki&amp;gt;[http://en.wikipedia.org/wiki/Authenticated_encryption AE] [http://csrc.nist.gov/groups/ST/toolkit/BCM/current_modes.html NIST approved modes]). It is also specified in [http://en.wikipedia.org/wiki/IEEE_P1619 IEEE P1619 Standard for Cryptographic Protection of Data on Block-Oriented Storage Devices]&lt;br /&gt;
&lt;br /&gt;
=== Rule - Store the hashed and salted value of passwords ===&lt;br /&gt;
&lt;br /&gt;
For more information on password storage, please see the [[Password Storage Cheat Sheet]].&lt;br /&gt;
&lt;br /&gt;
=== Rule - Ensure that the cryptographic protection remains secure even if access controls fail ===&lt;br /&gt;
&lt;br /&gt;
This rule supports the principle of defense in depth. Access controls (usernames, passwords, privileges, etc.) are one layer of protection. Storage encryption should add an additional layer of protection that will continue protecting the data even if an attacker subverts the database access control layer.&lt;br /&gt;
&lt;br /&gt;
=== Rule - Ensure that any secret key is protected from unauthorized access ===&lt;br /&gt;
&lt;br /&gt;
==== Rule - Define a key lifecycle ====&lt;br /&gt;
&lt;br /&gt;
The key lifecycle details the various states that a key will move through during its life. The lifecycle will specify when a key should no longer be used for encryption, when a key should no longer be used for decryption (these are not necessarily coincident), whether data must be rekeyed when a new key is introduced, and when a key should be removed from use all together.&lt;br /&gt;
&lt;br /&gt;
==== Rule - Store unencrypted keys away from the encrypted data ====&lt;br /&gt;
&lt;br /&gt;
If the keys are stored with the data then any compromise of the data will easily compromise the keys as well. Unencrypted keys should never reside on the same machine or cluster as the data.&lt;br /&gt;
&lt;br /&gt;
==== Rule - Use independent keys when multiple keys are required ====&lt;br /&gt;
&lt;br /&gt;
Ensure that key material is independent. That is, do not choose a second key which is easily related to the first (or any preceeding) keys.&lt;br /&gt;
&lt;br /&gt;
==== Rule - Protect keys in a key vault ====&lt;br /&gt;
&lt;br /&gt;
Keys should remain in a protected key vault at all times. In particular, ensure that there is a gap between the threat vectors that have direct access to the data and the threat vectors that have direct access to the keys. This implies that keys should not be stored on the application or web server (assuming that application attackers are part of the relevant threat model).&lt;br /&gt;
&lt;br /&gt;
==== Rule - Document concrete procedures for managing keys through the lifecycle ====&lt;br /&gt;
&lt;br /&gt;
These procedures must be written down and the key custodians must be adequately trained.&lt;br /&gt;
&lt;br /&gt;
==== Rule - Build support for changing keys periodically ====&lt;br /&gt;
&lt;br /&gt;
Key rotation is a must as all good keys do come to an end either through expiration or revocation.  So a developer will have to deal with rotating keys at some point -- better to have a system in place now rather than scrambling later. (From Bil Cory as a starting point). &lt;br /&gt;
&lt;br /&gt;
==== Rule - Document concrete procedures to handle a key compromise ====&lt;br /&gt;
&lt;br /&gt;
==== Rule - Rekey data at least every one to three years ====&lt;br /&gt;
&lt;br /&gt;
Rekeying refers to the process of decrypting data and then re-encrypting it with a new key. Periodically rekeying data helps protect it from undetected compromises of older keys. The appropriate rekeying period depends on the security of the keys. Data protected by keys secured in dedicated hardware security modules might only need rekeying every three years. Data protected by keys that are split and stored on two application servers might need rekeying every year.&lt;br /&gt;
&lt;br /&gt;
=== Rule - Follow applicable regulations on use of cryptography ===&lt;br /&gt;
&lt;br /&gt;
==== Rule - Under PCI DSS requirement 3, you must protect cardholder data  ====&lt;br /&gt;
&lt;br /&gt;
The Payment Card Industry (PCI) Data Security Standard (DSS) was developed to encourage and enhance cardholder data security and facilitate the broad adoption of consistent data security measures globally. The standard was introduced in 2005 and replaced individual compliance standards from Visa, Mastercard, Amex, JCB and Diners. The current version of the standard is 2.0 and was initialized on January 1, 2011. &lt;br /&gt;
&lt;br /&gt;
PCI DSS requirement 3 covers secure storage of credit card data. This requirement covers several aspects of secure storage including the data you must never store but we are covering Cryptographic Storage which is covered in requirements 3.4, 3.5 and 3.6 as you can see below: &lt;br /&gt;
&lt;br /&gt;
'''3.4 Render PAN (Primary Account Number), at minimum, unreadable anywhere it is stored''' &lt;br /&gt;
&lt;br /&gt;
Compliance with requirement 3.4 can be met by implementing any of the four types of secure storage described in the standard which includes encrypting and hashing data. These two approaches will often be the most popular choices from the list of options. The standard doesn't refer to any specific algorithms but it mandates the use of '''Strong Cryptography'''. The glossary document from the PCI council defines '''Strong Cryptography''' as: &lt;br /&gt;
&lt;br /&gt;
''Cryptography based on industry-tested and accepted algorithms, along with strong key lengths and proper key-management practices. Cryptography is a method to protect data and includes both encryption (which is reversible) and hashing (which is not reversible, or “one way”). SHA-1 is an example of an industry-tested and accepted hashing algorithm. Examples of industry-tested and accepted standards and algorithms for encryption include AES (128 bits and higher), TDES (minimum double-length keys), RSA (1024 bits and higher), ECC (160 bits and higher), and ElGamal (1024 bits and higher).'' &lt;br /&gt;
&lt;br /&gt;
If you have implemented the second rule in this cheat sheet you will have implemented a strong cryptographic algorithm which is compliant with or stronger than the requirements of PCI DSS requirement 3.4. You need to ensure that you identify all locations that card data could be stored including logs and apply the appropriate level of protection. This could range from encrypting the data to replacing the card number in logs. &lt;br /&gt;
&lt;br /&gt;
This requirement can also be met by implementing disk encryption rather than file or column level encryption. The requirements for '''Strong Cryptography''' are the same for disk encryption and backup media. The card data should never be stored in the clear and by following the guidance in this cheat sheet you will be able to securely store your data in a manner which is compliant with PCI DSS requirement 3.4 &lt;br /&gt;
&lt;br /&gt;
'''3.5  Protect any keys used to secure cardholder data against disclosure and misuse''' &lt;br /&gt;
&lt;br /&gt;
As the requirement name above indicates, we are required to securely store the encryption keys themselves. This will mean implementing strong access control, auditing and logging for your keys. The keys must be stored in a location which is both secure and &amp;quot;away&amp;quot; from the encrypted data. This means key data shouldn't be stored on web servers, database servers etc &lt;br /&gt;
&lt;br /&gt;
Access to the keys must be restricted to the smallest amount of users possible. This group of users will ideally be users who are highly trusted and trained to perform Key Custodian duties. There will obviously be a requirement for system/service accounts to access the key data to perform encryption/decryption of data. &lt;br /&gt;
&lt;br /&gt;
The keys themselves shouldn't be stored in the clear but encrypted with a KEK (Key Encrypting Key). The KEK must not be stored in the same location as the encryption keys it is encrypting. &lt;br /&gt;
&lt;br /&gt;
'''3.6 Fully document and implement all key-management processes and procedures for cryptographic keys used for encryption of cardholder data''' &lt;br /&gt;
&lt;br /&gt;
Requirement 3.6 mandates that key management processes within a PCI compliant company cover 8 specific key lifecycle steps: &lt;br /&gt;
&lt;br /&gt;
'''3.6.1 Generation of strong cryptographic keys''' &lt;br /&gt;
&lt;br /&gt;
As we have previously described in this cheat sheet we need to use algorithms which offer high levels of data security. We must also generate strong keys so that the security of the data isn't undermined by weak cryptographic keys. A strong key is generated by using a key length which is sufficient for your data security requirements and compliant with the PCI DSS. The key size alone isn't a measure of the strength of a key. The data used to generate the key must be sufficiently random (&amp;quot;sufficient&amp;quot; often being determined by your data security requirements) and the entropy of the key data itself must be high.&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
'''3.6.2 Secure cryptographic key distribution''' &lt;br /&gt;
&lt;br /&gt;
The method used to distribute keys must be secure to prevent the theft of keys in transit. The use of a protocol such as Diffie Hellman can help secure the distribution of keys, the use of secure transport such as SSLv3, TLS and SSHv2 can also secure the keys in transit.&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
'''3.6.3 Secure cryptographic key storage'''&lt;br /&gt;
&lt;br /&gt;
The secure storage of encryption keys including KEK's has been touched on in our description of requirement 3.5 (see above).&lt;br /&gt;
&lt;br /&gt;
'''3.6.4 Periodic cryptographic key changes'''&lt;br /&gt;
&lt;br /&gt;
The PCI DSS standard mandates that keys used for encryption must be rotated at least annually. The key rotation process must remove an old key from the encryption/decryption process and replace it with a new key. All new data entering the system must encrypted with the new key. While it is recommended that existing data be rekeyed with the new key, as per the Rekey data at least every one to three years rule above, it is not clear that the PCI DSS requires this.&lt;br /&gt;
&lt;br /&gt;
'''3.6.5 Retirement or replacement of keys as deemed necessary when the integrity of the key has been weakened or keys are suspected of being compromised'''&lt;br /&gt;
&lt;br /&gt;
The key management processes must cater for archived, retired or compromised keys. The process of securely storing and replacing these keys will more than likely be covered by your processes for requirements 3.6.2, 3.6.3 and 3.6.4&lt;br /&gt;
&lt;br /&gt;
'''3.6.6 Split knowledge and establishment of dual control of cryptographic keys'''&lt;br /&gt;
&lt;br /&gt;
The requirement for split knowledge and/or dual control for key management prevents an individual user performing key management tasks such as key rotation or deletion. The system should require two individual users to perform an action (i.e. entering a value from their own OTP) which creates to separate values which are concatenated to create the final key data.&lt;br /&gt;
&lt;br /&gt;
'''3.6.7 Prevention of unauthorized substitution of cryptographic keys'''&lt;br /&gt;
&lt;br /&gt;
The system put in place to comply with requirement 3.6.6 can go a long way to preventing unauthorised substitution of key data. In addition to the dual control process you should implement strong access control, auditing and logging for key data so that unauthorised access attempts are prevented and logged.&lt;br /&gt;
&lt;br /&gt;
'''3.6.8 Requirement for cryptographic key custodians to sign a form stating that they understand and accept their key-custodian responsibilities '''&lt;br /&gt;
&lt;br /&gt;
To perform the strong key management functions we have seen in requirement 3.6 we must have highly trusted and trained key custodians who understand how to perform key management duties. The key custodians must also sign a form stating they understand the responsibilities that come with this role.&lt;br /&gt;
&lt;br /&gt;
= Related Articles  =&lt;br /&gt;
&lt;br /&gt;
OWASP - [[Testing for SSL-TLS (OWASP-CM-001)|Testing for SSL-TLS]], and OWASP [[Guide to Cryptography]] &lt;br /&gt;
&lt;br /&gt;
OWASP – [http://www.owasp.org/index.php/ASVS Application Security Verification Standard (ASVS) – Communication Security Verification Requirements (V10)]&lt;br /&gt;
&lt;br /&gt;
= Authors and Primary Editors  =&lt;br /&gt;
&lt;br /&gt;
Kevin Kenan - kevin[at]k2dd.com&amp;lt;br/&amp;gt;&lt;br /&gt;
David Rook - david.a.rook[at]gmail.com&amp;lt;br/&amp;gt;&lt;br /&gt;
Kevin Wall - kevin.w.wall[at]gmail.com&amp;lt;br/&amp;gt;&lt;br /&gt;
Jim Manico - jim[at]owasp.org&amp;lt;br/&amp;gt;&lt;br /&gt;
Fred Donovan - fred.donovan(at)owasp.org&lt;br /&gt;
| valign=&amp;quot;top&amp;quot;  style=&amp;quot;padding-left:25px;width:300px;border-right: 1px dotted gray;padding-right:25px;&amp;quot; |&lt;br /&gt;
&lt;br /&gt;
== Other Cheatsheets ==&lt;br /&gt;
&lt;br /&gt;
{{Cheatsheet_Navigation_Body}}&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[Category:Cheatsheets]]&lt;/div&gt;</summary>
		<author><name>Crashedmind</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Cryptographic_Storage_Cheat_Sheet&amp;diff=185893</id>
		<title>Cryptographic Storage Cheat Sheet</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Cryptographic_Storage_Cheat_Sheet&amp;diff=185893"/>
				<updated>2014-11-24T23:01:39Z</updated>
		
		<summary type="html">&lt;p&gt;Crashedmind: Made rules more prescriptive with known-good examples. Changed rule headings. Added NIST/ISO/IEEE refs. Removed ref to padding oracle attack as this is as likely to be caused if there is I+A ala cbc mac padding oracle attack.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt; __NOTOC__&lt;br /&gt;
&amp;lt;div style=&amp;quot;width:100%;height:160px;border:0,margin:0;overflow: hidden;&amp;quot;&amp;gt;[[File:Cheatsheets-header.jpg|link=]]&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;padding: 0;margin:0;margin-top:10px;text-align:left;&amp;quot; |-&lt;br /&gt;
| valign=&amp;quot;top&amp;quot;  style=&amp;quot;border-right: 1px dotted gray;padding-right:25px;&amp;quot; |&lt;br /&gt;
Last revision (mm/dd/yy): '''{{REVISIONMONTH}}/{{REVISIONDAY}}/{{REVISIONYEAR}}''' &lt;br /&gt;
= Introduction  =&lt;br /&gt;
 __TOC__{{TOC hidden}}&lt;br /&gt;
&lt;br /&gt;
This article provides a simple model to follow when implementing solutions for data at rest.&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
== Architectural Decision  ==&lt;br /&gt;
&lt;br /&gt;
An architectural decision must be made to determine the appropriate method to protect data at rest.  There are such wide varieties of products, methods and mechanisms for cryptographic storage. This cheat sheet will only focus on low-level guidelines for developers and architects who are implementing cryptographic solutions. We will not address specific vendor solutions, nor will we address the design of cryptographic algorithms.&lt;br /&gt;
&lt;br /&gt;
= Providing Cryptographic Functionality  =&lt;br /&gt;
&lt;br /&gt;
== Secure Cryptographic Storage Design  ==&lt;br /&gt;
&lt;br /&gt;
=== Rule - Only store sensitive data that you need ===&lt;br /&gt;
&lt;br /&gt;
Many eCommerce businesses utilize third party payment providers to store credit card information for recurring billing. This offloads the burden of keeping credit card numbers safe.&lt;br /&gt;
&lt;br /&gt;
=== Rule - Use strong approved Authenticated Encryption  ===&lt;br /&gt;
E.g. [http://en.wikipedia.org/wiki/CCM_mode CCM] or [http://en.wikipedia.org/wiki/GCM_mode GCM] are approved [http://en.wikipedia.org/wiki/Authenticated_encryption Authenticated Encryption] modes based on [http://en.wikipedia.org/wiki/Advanced_Encryption_Standard AES] algorithm.&lt;br /&gt;
&lt;br /&gt;
==== Rule - Use strong approved cryptographic algorithms ====&lt;br /&gt;
Do not implement an existing cryptographic algorithm on your own, no matter how easy it appears. Instead, use widely accepted algorithms and widely accepted implementations. &lt;br /&gt;
&lt;br /&gt;
Only use approved public algorithms such as AES, RSA public key cryptography, and SHA-256 or better for hashing. Do not use weak algorithms, such as MD5 or SHA1. Note that the classification of a &amp;quot;strong&amp;quot; cryptographic algorithm can change over time. See [http://csrc.nist.gov/publications/nistpubs/800-57/sp800-57_part1_rev3_general.pdf NIST approved algorithms] or ISO TR 14742 “Recommendations on Cryptographic Algorithms and their use”. E.g. [http://en.wikipedia.org/wiki/Advanced_Encryption_Standard AES] 128, [http://en.wikipedia.org/wiki/RSA_(cryptosystem) RSA] 3072, [http://en.wikipedia.org/wiki/Secure_Hash_Algorithm SHA] 256.&lt;br /&gt;
&lt;br /&gt;
Ensure that the implementation has (at minimum) had some cryptography experts involved in its creation. If possible, use an implementation that is FIPS 140-2 certified. &lt;br /&gt;
&lt;br /&gt;
See [http://csrc.nist.gov/publications/nistpubs/800-57/sp800-57_part1_rev3_general.pdf NIST approved algorithms] Table 2 “Comparable strengths” for the strength (“security bits”) of different algorithms and key lengths, and how they compare to each other. &lt;br /&gt;
&lt;br /&gt;
* In general, where different algorithms are used, they should have comparable strengths e.g. if an AES-128 key is to be encrypted, an AES-128 key or greater, or RSA-3072 or greater could be used to encrypt it. &lt;br /&gt;
* In general, hash lengths are twice as long as the security bits offered by the symmetric/asymmetric algorithm&amp;amp;nbsp; e.g. SHA-224 for 3TDEA (112 security bits) (due to the [http://en.wikipedia.org/wiki/Birthday_attack Birthday Attack])&lt;br /&gt;
&lt;br /&gt;
If a password is being used to protect keys then the [http://en.wikipedia.org/wiki/Password_strength password strength]should be sufficient for the strength of the keys it is protecting. &lt;br /&gt;
&lt;br /&gt;
==== Rule – Use approved cryptographic modes  ====&lt;br /&gt;
In general, you should not use AES, DES or other symmetric cipher primitives directly. [http://csrc.nist.gov/groups/ST/toolkit/BCM/current_modes.html NIST approved modes] should be used instead. &lt;br /&gt;
&lt;br /&gt;
NOTE: Do not use [http://en.wikipedia.org/wiki/Block_cipher_modes_of_operation#Electronic_codebook_.28ECB.29 ECB mode] for encrypting lots of data (the other modes are better because they chain the blocks of data together to improve the data security).&lt;br /&gt;
&lt;br /&gt;
==== Rule – Use strong random numbers  ====&lt;br /&gt;
Ensure that all random numbers, especially those used for cryptographic parameters (keys, IV’s, MAC tags), random file names, random GUIDs, and random strings are generated in a cryptographically strong fashion. &lt;br /&gt;
&lt;br /&gt;
Ensure that random algorithms are seeded with sufficient entropy.&lt;br /&gt;
&lt;br /&gt;
Tools like [http://csrc.nist.gov/groups/ST/toolkit/rng/documentation_software.html NIST RNG Test tool] (as used in PCI PTS Derived Test Requirements) can be used to comprehensively assess the quality of a Random Number Generator by reading e.g. 128MB of data from the RNG source and then assessing its randomness properties with the tool. &lt;br /&gt;
&lt;br /&gt;
==== Rule - Use Authenticated Encryption of data ====&lt;br /&gt;
Use ([http://en.wikipedia.org/wiki/Authenticated_encryption AE]) modes under a uniform API. Recommended modes include [http://en.wikipedia.org/wiki/CCM_mode CCM], and [http://en.wikipedia.org/wiki/Galois/Counter_Mode GCM] as these, and only these as of November 2014, are specified in [http://csrc.nist.gov/groups/ST/toolkit/BCM/current_modes.html NIST approved modes], ISO IEC 19772 (2009) &amp;quot;Information technology — Security techniques — Authenticated encryption&amp;quot;, and [http://en.wikipedia.org/wiki/IEEE_P1619 IEEE P1619 Standard for Cryptographic Protection of Data on Block-Oriented Storage Devices] &lt;br /&gt;
&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Authenticated_encryption Authenticated Encryption] gives [http://en.wikipedia.org/wiki/Confidentiality confidentiality],&amp;amp;nbsp;[http://en.wikipedia.org/wiki/Data_integrity integrity], and&amp;amp;nbsp;[http://en.wikipedia.org/wiki/Authentication authenticity] (CIA); encryption alone just gives confidentiality. Encryption must always be combined with message integrity and authenticity protection. Otherwise the ciphertext may be vulnerable to manipulation causing changes to the underlying plaintext data, especially if it's being passed over untrusted channels (e.g. in an URL or cookie). &lt;br /&gt;
* These modes require only one key. In general, the tag sizes and the IV sizes should be set to maximum values.&lt;br /&gt;
&lt;br /&gt;
If these recommended [http://en.wikipedia.org/wiki/Authenticated_encryption AE] modes are not available&lt;br /&gt;
&lt;br /&gt;
* combine encryption in [http://en.wikipedia.org/wiki/Block_cipher_modes_of_operation#Cipher-block_chaining_.28CBC.29 cipher-block chaining (CBC) mode] with post-encryption message authentication code, such as [http://en.wikipedia.org/wiki/HMAC HMAC] or [http://en.wikipedia.org/wiki/CMAC CMAC] i.e. Encrypt-then-MAC. &lt;br /&gt;
** Note that Integrity and Authenticity are preferable to Integrity alone i.e. a MAC such as HMAC-SHA256 or HMAC-SHA512 is a better choice than SHA-256 or SHA-512.&lt;br /&gt;
* Use 2 independent keys for these 2 independent operations. &lt;br /&gt;
* Do not use [http://en.wikipedia.org/wiki/CBC-MAC#Security_with_fixed_and_variable-length_messages CBC MAC for variable length data] &lt;br /&gt;
* The [http://csrc.nist.gov/groups/STM/cavp/index.html CAVP program] is a good default place to go for validation of cryptographic algorithms when one does not have AES or one of the authenticated encryption modes that provide confidentiality and authenticity (i.e., data origin authentication) such as CCM, EAX, CMAC, etc. For Java, if you are using SunJCE that will be the case. The cipher modes supported in JDK 1.5 and later are CBC, CFB, CFBx, CTR, CTS, ECB, OFB, OFBx, PCBC. None of these cipher modes are authenticated encryption modes. (That's why it is added explicitly.) If you are using an alternate JCE provider such as Bouncy Castle, RSA JSafe, IAIK, etc., then these authenticated encryption modes should be used.&lt;br /&gt;
&lt;br /&gt;
Note: [http://en.wikipedia.org/wiki/Disk_encryption_theory Disk encryption]&amp;amp;nbsp;is a special case of&amp;amp;nbsp;[http://en.wikipedia.org/wiki/Data_at_Rest data at rest]&amp;amp;nbsp;e.g. Encrypted File System on a Hard Disk Drive. [http://csrc.nist.gov/publications/nistpubs/800-38E/nist-sp-800-38E.pdf XTS-AES mode] is optimized for Disk encryption and is one of the [http://csrc.nist.gov/groups/ST/toolkit/BCM/current_modes.html NIST approved modes]&amp;lt;nowiki&amp;gt;; it provides confidentiality and some protection against data manipulation (but not as strong as the &amp;lt;/nowiki&amp;gt;[http://en.wikipedia.org/wiki/Authenticated_encryption AE] [http://csrc.nist.gov/groups/ST/toolkit/BCM/current_modes.html NIST approved modes]). It is also specified in [http://en.wikipedia.org/wiki/IEEE_P1619 IEEE P1619 Standard for Cryptographic Protection of Data on Block-Oriented Storage Devices]&lt;br /&gt;
&lt;br /&gt;
=== Rule - Store the hashed and salted value of passwords ===&lt;br /&gt;
&lt;br /&gt;
For more information on password storage, please see the [[Password Storage Cheat Sheet]].&lt;br /&gt;
&lt;br /&gt;
=== Rule - Ensure that the cryptographic protection remains secure even if access controls fail ===&lt;br /&gt;
&lt;br /&gt;
This rule supports the principle of defense in depth. Access controls (usernames, passwords, privileges, etc.) are one layer of protection. Storage encryption should add an additional layer of protection that will continue protecting the data even if an attacker subverts the database access control layer.&lt;br /&gt;
&lt;br /&gt;
=== Rule - Ensure that any secret key is protected from unauthorized access ===&lt;br /&gt;
&lt;br /&gt;
==== Rule - Define a key lifecycle ====&lt;br /&gt;
&lt;br /&gt;
The key lifecycle details the various states that a key will move through during its life. The lifecycle will specify when a key should no longer be used for encryption, when a key should no longer be used for decryption (these are not necessarily coincident), whether data must be rekeyed when a new key is introduced, and when a key should be removed from use all together.&lt;br /&gt;
&lt;br /&gt;
==== Rule - Store unencrypted keys away from the encrypted data ====&lt;br /&gt;
&lt;br /&gt;
If the keys are stored with the data then any compromise of the data will easily compromise the keys as well. Unencrypted keys should never reside on the same machine or cluster as the data.&lt;br /&gt;
&lt;br /&gt;
==== Rule - Use independent keys when multiple keys are required ====&lt;br /&gt;
&lt;br /&gt;
Ensure that key material is independent. That is, do not choose a second key which is easily related to the first (or any preceeding) keys.&lt;br /&gt;
&lt;br /&gt;
==== Rule - Protect keys in a key vault ====&lt;br /&gt;
&lt;br /&gt;
Keys should remain in a protected key vault at all times. In particular, ensure that there is a gap between the threat vectors that have direct access to the data and the threat vectors that have direct access to the keys. This implies that keys should not be stored on the application or web server (assuming that application attackers are part of the relevant threat model).&lt;br /&gt;
&lt;br /&gt;
==== Rule - Document concrete procedures for managing keys through the lifecycle ====&lt;br /&gt;
&lt;br /&gt;
These procedures must be written down and the key custodians must be adequately trained.&lt;br /&gt;
&lt;br /&gt;
==== Rule - Build support for changing keys periodically ====&lt;br /&gt;
&lt;br /&gt;
Key rotation is a must as all good keys do come to an end either through expiration or revocation.  So a developer will have to deal with rotating keys at some point -- better to have a system in place now rather than scrambling later. (From Bil Cory as a starting point). &lt;br /&gt;
&lt;br /&gt;
==== Rule - Document concrete procedures to handle a key compromise ====&lt;br /&gt;
&lt;br /&gt;
==== Rule - Rekey data at least every one to three years ====&lt;br /&gt;
&lt;br /&gt;
Rekeying refers to the process of decrypting data and then re-encrypting it with a new key. Periodically rekeying data helps protect it from undetected compromises of older keys. The appropriate rekeying period depends on the security of the keys. Data protected by keys secured in dedicated hardware security modules might only need rekeying every three years. Data protected by keys that are split and stored on two application servers might need rekeying every year.&lt;br /&gt;
&lt;br /&gt;
=== Rule - Follow applicable regulations on use of cryptography ===&lt;br /&gt;
&lt;br /&gt;
==== Rule - Under PCI DSS requirement 3, you must protect cardholder data  ====&lt;br /&gt;
&lt;br /&gt;
The Payment Card Industry (PCI) Data Security Standard (DSS) was developed to encourage and enhance cardholder data security and facilitate the broad adoption of consistent data security measures globally. The standard was introduced in 2005 and replaced individual compliance standards from Visa, Mastercard, Amex, JCB and Diners. The current version of the standard is 2.0 and was initialized on January 1, 2011. &lt;br /&gt;
&lt;br /&gt;
PCI DSS requirement 3 covers secure storage of credit card data. This requirement covers several aspects of secure storage including the data you must never store but we are covering Cryptographic Storage which is covered in requirements 3.4, 3.5 and 3.6 as you can see below: &lt;br /&gt;
&lt;br /&gt;
'''3.4 Render PAN (Primary Account Number), at minimum, unreadable anywhere it is stored''' &lt;br /&gt;
&lt;br /&gt;
Compliance with requirement 3.4 can be met by implementing any of the four types of secure storage described in the standard which includes encrypting and hashing data. These two approaches will often be the most popular choices from the list of options. The standard doesn't refer to any specific algorithms but it mandates the use of '''Strong Cryptography'''. The glossary document from the PCI council defines '''Strong Cryptography''' as: &lt;br /&gt;
&lt;br /&gt;
''Cryptography based on industry-tested and accepted algorithms, along with strong key lengths and proper key-management practices. Cryptography is a method to protect data and includes both encryption (which is reversible) and hashing (which is not reversible, or “one way”). SHA-1 is an example of an industry-tested and accepted hashing algorithm. Examples of industry-tested and accepted standards and algorithms for encryption include AES (128 bits and higher), TDES (minimum double-length keys), RSA (1024 bits and higher), ECC (160 bits and higher), and ElGamal (1024 bits and higher).'' &lt;br /&gt;
&lt;br /&gt;
If you have implemented the second rule in this cheat sheet you will have implemented a strong cryptographic algorithm which is compliant with or stronger than the requirements of PCI DSS requirement 3.4. You need to ensure that you identify all locations that card data could be stored including logs and apply the appropriate level of protection. This could range from encrypting the data to replacing the card number in logs. &lt;br /&gt;
&lt;br /&gt;
This requirement can also be met by implementing disk encryption rather than file or column level encryption. The requirements for '''Strong Cryptography''' are the same for disk encryption and backup media. The card data should never be stored in the clear and by following the guidance in this cheat sheet you will be able to securely store your data in a manner which is compliant with PCI DSS requirement 3.4 &lt;br /&gt;
&lt;br /&gt;
'''3.5  Protect any keys used to secure cardholder data against disclosure and misuse''' &lt;br /&gt;
&lt;br /&gt;
As the requirement name above indicates, we are required to securely store the encryption keys themselves. This will mean implementing strong access control, auditing and logging for your keys. The keys must be stored in a location which is both secure and &amp;quot;away&amp;quot; from the encrypted data. This means key data shouldn't be stored on web servers, database servers etc &lt;br /&gt;
&lt;br /&gt;
Access to the keys must be restricted to the smallest amount of users possible. This group of users will ideally be users who are highly trusted and trained to perform Key Custodian duties. There will obviously be a requirement for system/service accounts to access the key data to perform encryption/decryption of data. &lt;br /&gt;
&lt;br /&gt;
The keys themselves shouldn't be stored in the clear but encrypted with a KEK (Key Encrypting Key). The KEK must not be stored in the same location as the encryption keys it is encrypting. &lt;br /&gt;
&lt;br /&gt;
'''3.6 Fully document and implement all key-management processes and procedures for cryptographic keys used for encryption of cardholder data''' &lt;br /&gt;
&lt;br /&gt;
Requirement 3.6 mandates that key management processes within a PCI compliant company cover 8 specific key lifecycle steps: &lt;br /&gt;
&lt;br /&gt;
'''3.6.1 Generation of strong cryptographic keys''' &lt;br /&gt;
&lt;br /&gt;
As we have previously described in this cheat sheet we need to use algorithms which offer high levels of data security. We must also generate strong keys so that the security of the data isn't undermined by weak cryptographic keys. A strong key is generated by using a key length which is sufficient for your data security requirements and compliant with the PCI DSS. The key size alone isn't a measure of the strength of a key. The data used to generate the key must be sufficiently random (&amp;quot;sufficient&amp;quot; often being determined by your data security requirements) and the entropy of the key data itself must be high.&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
'''3.6.2 Secure cryptographic key distribution''' &lt;br /&gt;
&lt;br /&gt;
The method used to distribute keys must be secure to prevent the theft of keys in transit. The use of a protocol such as Diffie Hellman can help secure the distribution of keys, the use of secure transport such as SSLv3, TLS and SSHv2 can also secure the keys in transit.&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
'''3.6.3 Secure cryptographic key storage'''&lt;br /&gt;
&lt;br /&gt;
The secure storage of encryption keys including KEK's has been touched on in our description of requirement 3.5 (see above).&lt;br /&gt;
&lt;br /&gt;
'''3.6.4 Periodic cryptographic key changes'''&lt;br /&gt;
&lt;br /&gt;
The PCI DSS standard mandates that keys used for encryption must be rotated at least annually. The key rotation process must remove an old key from the encryption/decryption process and replace it with a new key. All new data entering the system must encrypted with the new key. While it is recommended that existing data be rekeyed with the new key, as per the Rekey data at least every one to three years rule above, it is not clear that the PCI DSS requires this.&lt;br /&gt;
&lt;br /&gt;
'''3.6.5 Retirement or replacement of keys as deemed necessary when the integrity of the key has been weakened or keys are suspected of being compromised'''&lt;br /&gt;
&lt;br /&gt;
The key management processes must cater for archived, retired or compromised keys. The process of securely storing and replacing these keys will more than likely be covered by your processes for requirements 3.6.2, 3.6.3 and 3.6.4&lt;br /&gt;
&lt;br /&gt;
'''3.6.6 Split knowledge and establishment of dual control of cryptographic keys'''&lt;br /&gt;
&lt;br /&gt;
The requirement for split knowledge and/or dual control for key management prevents an individual user performing key management tasks such as key rotation or deletion. The system should require two individual users to perform an action (i.e. entering a value from their own OTP) which creates to separate values which are concatenated to create the final key data.&lt;br /&gt;
&lt;br /&gt;
'''3.6.7 Prevention of unauthorized substitution of cryptographic keys'''&lt;br /&gt;
&lt;br /&gt;
The system put in place to comply with requirement 3.6.6 can go a long way to preventing unauthorised substitution of key data. In addition to the dual control process you should implement strong access control, auditing and logging for key data so that unauthorised access attempts are prevented and logged.&lt;br /&gt;
&lt;br /&gt;
'''3.6.8 Requirement for cryptographic key custodians to sign a form stating that they understand and accept their key-custodian responsibilities '''&lt;br /&gt;
&lt;br /&gt;
To perform the strong key management functions we have seen in requirement 3.6 we must have highly trusted and trained key custodians who understand how to perform key management duties. The key custodians must also sign a form stating they understand the responsibilities that come with this role.&lt;br /&gt;
&lt;br /&gt;
= Related Articles  =&lt;br /&gt;
&lt;br /&gt;
OWASP - [[Testing for SSL-TLS (OWASP-CM-001)|Testing for SSL-TLS]], and OWASP [[Guide to Cryptography]] &lt;br /&gt;
&lt;br /&gt;
OWASP – [http://www.owasp.org/index.php/ASVS Application Security Verification Standard (ASVS) – Communication Security Verification Requirements (V10)]&lt;br /&gt;
&lt;br /&gt;
= Authors and Primary Editors  =&lt;br /&gt;
&lt;br /&gt;
Kevin Kenan - kevin[at]k2dd.com&amp;lt;br/&amp;gt;&lt;br /&gt;
David Rook - david.a.rook[at]gmail.com&amp;lt;br/&amp;gt;&lt;br /&gt;
Kevin Wall - kevin.w.wall[at]gmail.com&amp;lt;br/&amp;gt;&lt;br /&gt;
Jim Manico - jim[at]owasp.org&amp;lt;br/&amp;gt;&lt;br /&gt;
Fred Donovan - fred.donovan(at)owasp.org&lt;br /&gt;
| valign=&amp;quot;top&amp;quot;  style=&amp;quot;padding-left:25px;width:300px;border-right: 1px dotted gray;padding-right:25px;&amp;quot; |&lt;br /&gt;
&lt;br /&gt;
== Other Cheatsheets ==&lt;br /&gt;
&lt;br /&gt;
{{Cheatsheet_Navigation_Body}}&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[Category:Cheatsheets]]&lt;/div&gt;</summary>
		<author><name>Crashedmind</name></author>	</entry>

	</feed>