WEBVTT

00:00:03.552 --> 00:00:07.213
Requirements 3.5 and 3.6 are all about how keys used to

00:00:07.213 --> 00:00:09.750
encrypt and decrypt cardholder data are managed,

00:00:09.750 --> 00:00:11.907
and before we get into these,

00:00:11.907 --> 00:00:15.278
I'm going to say what I advise to anyone who asks me about

00:00:15.278 --> 00:00:17.459
encrypting cardholder data in key management,

00:00:17.459 --> 00:00:22.414
which is this: If you do not store cardholder data,

00:00:22.414 --> 00:00:23.949
you will not need to do this,

00:00:23.949 --> 00:00:27.430
because doing cryptography properly is hard and

00:00:27.430 --> 00:00:30.015
protecting the keys is harder still.

00:00:30.015 --> 00:00:33.997
There have been so many data breaches where the criminals stole the

00:00:33.997 --> 00:00:38.700
keys at the same times they stole encrypted card data.

00:00:38.700 --> 00:00:41.048
So this is my second piece of advice for people who

00:00:41.048 --> 00:00:44.472
ignore the first piece of advice, and it's this.

00:00:44.472 --> 00:00:47.174
If you are going to manage encryption keys,

00:00:47.174 --> 00:00:52.985
then my advice to organizations is to buy a hardware security module or HSM.

00:00:52.985 --> 00:00:58.603
This is a secure hardware device that contains encryption and decryption keys.

00:00:58.603 --> 00:00:59.340
Very simply,

00:00:59.340 --> 00:01:02.989
you send the data that needs to be encrypted or decrypted to the HSM,

00:01:02.989 --> 00:01:04.304
and it does what you ask.

00:01:04.304 --> 00:01:07.981
The cryptographic keys never leave the HSM.

00:01:07.981 --> 00:01:13.388
So if a criminal steals your encrypted data, they can never steal your keys.

00:01:13.388 --> 00:01:16.016
Now remember, this is my personal experience and my advice to you.

00:01:16.016 --> 00:01:19.519
The standard doesn't go this far.

00:01:19.519 --> 00:01:22.309
What the standard does ask for is initially that you've

00:01:22.309 --> 00:01:25.221
documented all your key management procedures,

00:01:25.221 --> 00:01:29.743
and unsurprisingly, the QSA is going to review these.

00:01:29.743 --> 00:01:33.303
There's an additional requirement in 3.5 that is just

00:01:33.303 --> 00:01:35.096
for service providers; however,

00:01:35.096 --> 00:01:37.683
I actually encourage everyone to also meet this requirement,

00:01:37.683 --> 00:01:42.376
which is to document the entire cryptographic architecture that's in use.

00:01:42.376 --> 00:01:46.125
What this means is that there's a single point of reference that

00:01:46.125 --> 00:01:49.733
describes everything cryptographic in the organization.

00:01:49.733 --> 00:01:51.164
This is a great document to produce,

00:01:51.164 --> 00:01:54.404
because it really makes sure that the organization has a proper

00:01:54.404 --> 00:01:59.931
understanding of the way it both encrypts data and manages keys.

00:01:59.931 --> 00:02:03.735
It also massively helps any QSA assessment of the environment.

00:02:03.735 --> 00:02:04.252
Remember,

00:02:04.252 --> 00:02:09.806
this requirement just applies to service providers and not to merchants.

00:02:09.806 --> 00:02:11.043
So if you're a service provider,

00:02:11.043 --> 00:02:15.715
your QSA is going to review the documentation and speak to key personnel to

00:02:15.715 --> 00:02:19.611
both verify that it's correct and that it's followed.

00:02:19.611 --> 00:02:24.424
The rest of the sub requirements in 3.5 apply to all entities; that's merchants,

00:02:24.424 --> 00:02:26.618
service providers, and banks.

00:02:26.618 --> 00:02:31.885
Requirement 3.5 .2 aims to make sure that just the minimum number of

00:02:31.885 --> 00:02:35.194
people necessary have access to cryptographic keys.

00:02:35.194 --> 00:02:39.613
Now people with access to keys are known as key custodians,

00:02:39.613 --> 00:02:42.537
and the exact requirement is to restrict the number

00:02:42.537 --> 00:02:45.103
of people who fulfill this role.

00:02:45.103 --> 00:02:48.723
This isn't just because of the risk of a key custodian turning into

00:02:48.723 --> 00:02:51.630
a criminal and using the keys to decrypt data,

00:02:51.630 --> 00:02:55.578
but it mainly minimizes the number of accounts that could be targeted by a

00:02:55.578 --> 00:02:58.635
criminal to gain access to cryptographic key material.

00:02:58.635 --> 00:03:02.242
The QSA is just going to look at the list of key custodians and

00:03:02.242 --> 00:03:07.241
verify that the organization has minimized these.

00:03:07.241 --> 00:03:12.103
Requirement 3.5 .3 is where encryption starts to get hard,

00:03:12.103 --> 00:03:17.025
because the requirement is to protect the keys used to encrypt and decrypt data.

00:03:17.025 --> 00:03:20.957
It's actually a strangely worded requirement,

00:03:20.957 --> 00:03:25.202
because it talks about access to the keys that can be

00:03:25.202 --> 00:03:26.981
used to encrypt and decrypt data,

00:03:26.981 --> 00:03:29.555
but actually the real risk is just access to keys

00:03:29.555 --> 00:03:32.752
that can be used to decrypt data.

00:03:32.752 --> 00:03:36.175
And so in symmetric encryption such as AES,

00:03:36.175 --> 00:03:38.094
the data encrypting key and the decrypting key are the same,

00:03:38.094 --> 00:03:40.770
which is why the standard talks about the data encrypting key.

00:03:40.770 --> 00:03:45.036
You might often hear that referred to as a D-E-K or a DEK.

00:03:45.036 --> 00:03:49.331
In asymmetric encryption like RSA where you've got a public/private key pair,

00:03:49.331 --> 00:03:51.305
the key that is to be protected is the private key,

00:03:51.305 --> 00:03:52.878
which is the one that usually decrypts data.

00:03:52.878 --> 00:03:57.676
So that's why it says things like store secret and private keys in the standard,

00:03:57.676 --> 00:03:59.914
but it's not always consistent when it says this.

00:03:59.914 --> 00:04:02.263
So whenever we're talking about keys, think about,

00:04:02.263 --> 00:04:05.417
is this the key that's used to decrypt data.

00:04:05.417 --> 00:04:05.834
Anyway,

00:04:05.834 --> 00:04:09.748
there are three ways that PCI DSS allows these secret

00:04:09.748 --> 00:04:11.739
and private keys to be protected.

00:04:11.739 --> 00:04:15.401
Firstly, you can encrypt this data decrypting key with another key,

00:04:15.401 --> 00:04:18.464
which is called the key-encrypting key or a KEK.

00:04:18.464 --> 00:04:22.717
This key needs to be strong cryptographically as the

00:04:22.717 --> 00:04:24.176
data-encrypting key it encrypts,

00:04:24.176 --> 00:04:26.512
and that's actually quite a hard thing to do if you're mixing

00:04:26.512 --> 00:04:29.197
symmetric and asymmetric encryption and again,

00:04:29.197 --> 00:04:32.066
asking a QSA for help on that.

00:04:32.066 --> 00:04:32.442
Secondly,

00:04:32.442 --> 00:04:35.503
you can take my preferred option which is to get yourself

00:04:35.503 --> 00:04:37.623
a hardware security module or an HSM,

00:04:37.623 --> 00:04:41.843
and actually the normal practical implementation of an HSM means

00:04:41.843 --> 00:04:44.765
that you use it to protect key-encrypting keys,

00:04:44.765 --> 00:04:46.940
not data-encrypting keys.

00:04:46.940 --> 00:04:50.157
Thirdly, you can use key shares, which must be the same length as the key,

00:04:50.157 --> 00:04:56.097
which when combined together using some mathematical function like Excel,

00:04:56.097 --> 00:04:59.492
produces the actual key, and we'll look at how to do this in a few minutes.

00:04:59.492 --> 00:05:03.266
The QSA is going to look at the documentation that says how you're protecting

00:05:03.266 --> 00:05:06.536
secret keys and determine whether that meets the requirement.

00:05:06.536 --> 00:05:10.011
We'll then see if what you implemented matches the documentation.

00:05:10.011 --> 00:05:13.539
If all this cryptography is like a foreign language to you,

00:05:13.539 --> 00:05:17.251
there's some great courses at Pluralsight that you can use to get up to speed.

00:05:17.251 --> 00:05:18.844
Just search for cryptography.

00:05:18.844 --> 00:05:23.376
The two I'd recommend for beginners are Matt Glass' Big Picture

00:05:23.376 --> 00:05:25.766
course and Dale Meredith's Cryptography course,

00:05:25.766 --> 00:05:29.385
which is part of this Ethical Hacking series.

00:05:29.385 --> 00:05:32.339
And if you really want to get to grips with the crypto,

00:05:32.339 --> 00:05:37.370
Michael Perry's Cryptography Fundamentals is really brilliant.

00:05:37.370 --> 00:05:40.588
The last requirement in 3.5 is pretty simple.

00:05:40.588 --> 00:05:45.330
It wants to make sure you're careful about where you store the secret keys,

00:05:45.330 --> 00:05:49.053
and the wording of the requirement is also pretty simple; just those

00:05:49.053 --> 00:05:52.077
secret keys are stored in the fewest possible locations.

00:05:52.077 --> 00:05:55.439
Now remember, we've already said we're going to protect the secret keys,

00:05:55.439 --> 00:05:57.357
so we've agreed we're protecting them and now we're

00:05:57.357 --> 00:05:59.647
protecting them in as few places as possible,

00:05:59.647 --> 00:06:02.316
because look, everywhere a key is stored,

00:06:02.316 --> 00:06:04.460
it's somewhere an attacker can get hold of the key.

00:06:04.460 --> 00:06:10.603
So just as with any valuable asset, minimizing the number of storage locations,

00:06:10.603 --> 00:06:13.420
and knowing where they are, is just basic simple security.

00:06:13.420 --> 00:06:15.714
As with the previous requirement,

00:06:15.714 --> 00:06:19.377
the QSA is going to check your key management documentation and also then

00:06:19.377 --> 00:06:29.790
look at the systems to see where the keys are stored.
