CompTIA Security+ Full Course: Public Key Infrastructure (PKI)

Certify Breakfast
22 Jan 202343:47

Summary

TLDRThis video script delves into the intricacies of Public Key Infrastructure (PKI), digital certificates, and the validation of online identities. It explains the importance of asymmetric cryptography, the role of private and public keys in encryption and digital signatures, and how PKI ensures the authenticity of public keys. The script also covers certificate authorities, the process of certificate validation, and the various types of certificates, highlighting the significance of trust and security in digital communications.

Takeaways

  • πŸ”’ Public Key Infrastructure (PKI) is essential for validating digital identities and ensuring the trustworthiness of digital certificates.
  • πŸ”‘ Asymmetric cryptography, using a private and public key pair, is the foundation of PKI, allowing secure communication and identity verification.
  • 🌐 Digital certificates are more than just public keys; they include identity information and are validated by trusted certification authorities (CAs).
  • πŸ€” Trust in a CA is crucial; if a CA's private key is compromised, all certificates signed by that CA may be considered invalid.
  • πŸ“œ Certificates contain several key pieces of information, including the public key, identity information, and usage purposes, which are all digitally signed by the issuing CA.
  • β›“ Certificates are often part of a hierarchy, with root, intermediate, and leaf CAs, to distribute trust and minimize the risk of a single point of failure.
  • πŸ“ Certificate Signing Requests (CSRs) are used to request a CA to issue a certificate, containing identity information and a public key that the CA must verify.
  • πŸ”„ Certificates have a lifecycle that includes creation, storage, usage, and eventual revocation or renewal, with expiration dates being a key aspect of certificate management.
  • πŸ›‘οΈ Certificate pinning (HBKP) is a security measure to prevent man-in-the-middle attacks by embedding expected certificate information within an application.
  • πŸ“ Certificates can be stored in various formats, including PEM (ASCII), DER (binary), and PFX/P12 (which may include both public and private keys), each with its own use cases and security considerations.
  • πŸ› οΈ Tools like OpenSSL are vital for generating, managing, and validating certificates, offering a command-line approach to certificate creation and inspection.

Q & A

  • What is Public Key Infrastructure (PKI) and why is it important?

    -Public Key Infrastructure (PKI) is the infrastructure that enables the validation of identities within digital certificates. It's crucial because it ensures that when a digital certificate is presented, there's a reliable method to verify the information it contains, thus confirming the identity of the certificate holder.

  • How does asymmetric cryptography play a role in PKI?

    -Asymmetric cryptography is foundational to PKI as it uses a pair of keys: a private key that should be kept secure and a public key that can be freely shared. The public key is used for encryption and verification of digital signatures, while the private key is used for decryption and signing, thus connecting the keys to the unique identities of individuals.

  • What is a digital certificate and how does it relate to a public key?

    -A digital certificate is a file that contains a user's public key and identity information, such as their name and organizational details. It's essentially a container for the public key and serves as a way to validate the identity of the key's owner, ensuring that the public key is associated with a legitimate and verified identity.

  • Why can't anyone trust a public key simply by downloading it from the internet?

    -Simply downloading a public key from the internet isn't trustworthy because an attacker could intercept the key exchange and replace the original key with their own. PKI helps prevent this by using certificates that are signed by trusted entities known as Certificate Authorities (CAs), which validate the authenticity of the public key.

  • What is a Certificate Authority (CA) and how does it sign a digital certificate?

    -A Certificate Authority (CA) is a trusted entity that issues digital certificates. It signs a digital certificate by calculating a hash of the certificate's content and then encrypting that hash with the CA's private key. This digital signature can be validated using the CA's public key, which, if trusted, confirms the certificate's authenticity.

  • What is the purpose of a digital signature in the context of PKI?

    -A digital signature serves to authenticate the identity of the signer and to ensure the integrity of the message or document being signed. It involves encrypting a hash of the message with the signer's private key. Anyone with the signer's public key can decrypt the hash and verify it against the original message, thus confirming the signer's identity and that the message has not been altered.

  • Why are there different levels of validation for issuing web server certificates?

    -Different levels of validation exist to ensure the security and authenticity of web server certificates. Domain validation checks ownership of the domain, while extended validation further verifies the legal identity of the entity requesting the certificate. This helps prevent the issuance of certificates for phishing or spoofed domains.

  • What is a self-signed certificate and why might it be used?

    -A self-signed certificate is a digital certificate that is signed by the same entity whose identity it certifies, rather than by a trusted CA. It might be used in internal networks, lab environments, or proof-of-concept scenarios where a trusted third-party CA is not required or available.

  • What is the process of certificate revocation and why is it necessary?

    -Certificate revocation is the process of declaring a valid certificate no longer valid before its scheduled expiration. It is necessary when a private key is compromised, a certificate is no longer needed, or in cases where a certificate must be immediately invalidated for security reasons.

  • How do clients know if a certificate has been revoked?

    -Clients can check if a certificate has been revoked by referring to a Certificate Revocation List (CRL) provided by the issuing CA or by using the Online Certificate Status Protocol (OCSP), which allows for real-time validation of a certificate's status.

  • What is the purpose of certificate pinning and how does it work?

    -Certificate pinning, also known as HPKP (HTTP Public Key Pinning), is a security technique used to prevent man-in-the-middle attacks by associating a certain public key with a certain web server. It involves embedding the public key or hash of the key in the application code, allowing the browser to verify if the presented certificate matches the expected key.

  • What are the different file formats for storing certificates and what are their uses?

    -Certificates can be stored in various file formats such as DER (binary format), PEM (ASCII format), CRT/CER (which can be either binary or ASCII but don't specify which), PFX/P12 (for bundling a private key with a certificate), and P7B (for storing the entire certificate chain). These formats serve different purposes, from ease of transportability and readability to security and comprehensiveness in certificate chain storage.

  • How can one generate a self-signed certificate using OpenSSL?

    -A self-signed certificate can be generated using OpenSSL with a command that specifies the key pair generation and the creation of a self-signed certificate with a specified expiration date. The certificate is then outputted in a chosen format, such as PEM, which is easily readable and transportable.

Outlines

00:00

πŸ” Public Key Infrastructure and Digital Certificates

The paragraph introduces the concept of Public Key Infrastructure (PKI) as a system for validating digital identities through certificates. It explains that while anyone can generate a digital certificate, PKI is essential for vouching for one's identity. The paragraph discusses asymmetric cryptography, the roles of private and public keys in encryption and digital signatures, and the importance of having a trusted authority to validate these keys. It also touches on the risks of public key interception by attackers and how PKI helps prevent such scenarios by ensuring the authenticity of public keys through certificates issued by trusted entities.

05:00

πŸ›‘οΈ Certificate Authorities and Trust Hierarchy

This paragraph delves into the role of Certificate Authorities (CAs) in the PKI ecosystem. It explains how CAs sign digital certificates to validate the identity of individuals or entities. The process involves CAs encrypting a hash of the certificate with their private key, allowing others to verify its authenticity using the CA's public key. The paragraph also discusses the importance of trusting CAs and the concept of a trust hierarchy, where operating systems and browsers maintain a list of trusted CAs. It further explains the potential risks if a CA's private key is compromised and the measures taken to mitigate these risks, such as the use of local CAs within enterprises.

10:02

πŸ”„ Certificate Lifecycle and Hierarchy of Trust

The paragraph discusses the lifecycle of digital certificates, from creation to revocation. It explains the process of generating a certificate signing request (CSR) and the validation process that CAs undertake before issuing a certificate. The concept of a hierarchy of trust is further explored, with the introduction of root, intermediate, and leaf CAs, which create a chain of trust. The benefits of this model, such as taking the root CA offline for security, are highlighted. The paragraph also touches on the registration process with CAs, which involves identity verification before certificates can be issued.

15:03

πŸ“„ Certificate Contents and Validation

This paragraph provides an in-depth look at the contents of a digital certificate, including the public key, identity information, and various fields that describe the certificate's purpose and constraints. It explains the importance of the subject and subject alternative names (SANs) in identifying the entity a certificate represents. The paragraph also discusses key usage fields and extended key usage fields, which define the permitted uses of a certificate. Additionally, it covers the concepts of critical and non-critical extensions within a certificate and their implications for validation.

20:03

🌐 Domain Validation and Certificate Types

The paragraph examines the process of domain validation, which is a security measure to ensure that a certificate applicant is the legitimate owner of the domain they claim. It contrasts domain validation with extended validation for higher-profile websites. The paragraph also outlines various types of certificates, such as those for users, servers, applications, and self-signed certificates, explaining their purposes and the contexts in which they are used. It also touches on the dual authentication process for both users and machines in network access scenarios.

25:04

πŸ”‘ Key Management and Storage

This paragraph focuses on the challenges and methods of secure key management. It discusses the importance of securely storing private keys, the risks associated with key backup and storage, and the strategies to mitigate these risks, such as key escrow and segmented storage. The paragraph also covers the process of certificate renewal and revocation, highlighting the procedures followed when a certificate expires or is compromised.

30:05

πŸ—‚οΈ Certificate Formats and Management

The paragraph provides an overview of different certificate file formats, such as DER, PEM, CRT, CER, PFX, P12, and P7B, explaining their purposes and how they store certificate data. It also discusses the tools and commands used to manage certificates, particularly focusing on OpenSSL utilities for tasks like generating key pairs, creating self-signed certificates, and validating certificates. The paragraph concludes with examples of OpenSSL commands that can be used for certificate management.

35:06

πŸ›‘οΈ Certificate Security and Revocation Methods

This paragraph discusses the importance of certificate security, the process of certificate expiration, and the methods for certificate revocation. It explains the use of Certificate Revocation Lists (CRLs) and the Online Certificate Status Protocol (OCSP) as two primary methods for managing and validating the status of certificates. The paragraph also introduces the concept of OCSP stapling, a process that allows web servers to respond to certificate validation queries on behalf of CAs. Additionally, it touches on the security measure of certificate pinning as a defense against man-in-the-middle attacks.

Mindmap

Keywords

πŸ’‘Public Key Infrastructure (PKI)

Public Key Infrastructure is a system that enables the secure communication and identification of entities across a network. It is central to the video's theme as it underpins the validation of digital certificates and identity verification. In the script, PKI is described as the infrastructure that allows for the validation of identity within a digital certificate, emphasizing its role in cybersecurity.

πŸ’‘Digital Certificate

A digital certificate is an electronic document used to establish the identity and credentials of an individual, organization, or server. It is a key concept in the video, illustrating how entities can be authenticated in a digital space. The script mentions that anyone can generate a digital certificate, but the validation of this certificate is what truly matters, highlighting the importance of PKI.

πŸ’‘Asymmetric Cryptography

Asymmetric cryptography refers to cryptographic systems that use two different keys: a public key for encryption and a private key for decryption. The video discusses this concept as the foundation for connecting keys to unique identities, with the script noting that the private key should be kept safe while the public key can be shared freely.

πŸ’‘Digital Signature

A digital signature is a cryptographic mechanism used to verify the authenticity and integrity of a digital message or document. The video explains how digital signatures are created by encrypting a hash of a message with a private key, and the script provides an example of how this process helps in proving one's identity to another party.

πŸ’‘Certificate Authority (CA)

A Certificate Authority is a trusted entity that issues digital certificates, validating the identity of the certificate holder. The script explains the role of CAs in the PKI hierarchy, emphasizing their importance in signing digital certificates and establishing trust among users.

πŸ’‘Private Key

A private key is a secret component in asymmetric cryptography, used for decryption or for signing digital data. The video script discusses the importance of keeping the private key secure and how it is used in conjunction with the public key for secure communication and identity verification.

πŸ’‘Public Key

The public key is the counterpart to the private key and can be freely distributed. It is used for encryption or to verify digital signatures. The script clarifies that while anyone can encrypt data with a public key, only the holder of the corresponding private key can decrypt it.

πŸ’‘Certificate Revocation List (CRL)

A Certificate Revocation List is a record maintained by a CA that contains serial numbers of certificates that have been revoked before their scheduled expiration date. The video script describes CRL as a method used by CAs to inform users about certificates that are no longer valid.

πŸ’‘Online Certificate Status Protocol (OCSP)

The Online Certificate Status Protocol is a protocol used to obtain the revocation status of a certificate. The script explains OCSP as a dynamic method for providing certificate status information, offering a more immediate response compared to CRLs.

πŸ’‘Self-Signed Certificate

A self-signed certificate is a digital certificate that is signed by the same entity whose identity it certifies. The script mentions self-signed certificates as being typically used in internal networks or lab environments, where they are trusted by configuration but not inherently by clients outside the issuing domain.

πŸ’‘Certificate Pinning

Certificate pinning, also known as HTTP Public Key Pinning (HPKP), is a security mechanism that helps prevent man-in-the-middle attacks by associating a certain public key with a certain web server. The script discusses this as a method to ensure that the certificate presented by a server matches a pre-agreed key, enhancing security.

Highlights

Public Key Infrastructure (PKI) is essential for validating digital identities through certificates.

Anyone can generate a digital certificate, but PKI verifies the identity behind the public key.

Asymmetric cryptography with private and public keys is the foundation of connecting keys to identities.

Public keys can be freely shared, while private keys must remain secure for digital signatures and encryption.

Digital signatures authenticate identity by encrypting hashes with the private key.

PKI protects against man-in-the-middle attacks by ensuring the validity of public keys.

Digital certificates contain more than just the public key; they include identity information and are signed by a trusted authority.

Certificate Authorities (CAs) validate and sign digital certificates, establishing trust.

Trust in CAs is hierarchical, with root, intermediate, and leaf CAs creating a chain of trust.

Operating systems and browsers have built-in lists of trusted CAs for validating certificates.

Local CAs can be used within enterprises for an internal trust network.

Certificates have a lifecycle, including creation, storage, and eventual revocation or renewal.

Secure storage of private keys is critical to prevent exposure and ensure data access.

Certificate revocation lists (CRLs) and the Online Certificate Status Protocol (OCSP) are methods for checking certificate validity.

HTTP Public Key Pinning (HPKP) prevents man-in-the-middle attacks by pinning certificates in application code.

Certificates are stored in various formats such as PEM, DER, CRT, CER, PFX, P12, and P7B for different uses.

OpenSSL is a utility used in Linux for generating and managing certificates.

The video provides a comprehensive overview of digital certificates, essential for understanding cybersecurity and preparing for exams.

Transcripts

play00:00

[Music]

play00:00

foreign

play00:02

[Music]

play00:15

now I did talk about a lot of stuff in

play00:18

the previous video and there's no way

play00:20

you can talk about certificates and

play00:22

public keys and signatures and so on

play00:25

without mentioning public key

play00:27

infrastructure because that's the actual

play00:28

infrastructure that allows us to

play00:30

validate the identity within a digital

play00:33

certificate because anyone can generate

play00:35

a digital certificate at the end of the

play00:37

day is just a public key and in a file

play00:40

anyone can generate that content but

play00:42

it's all about who is able to vouch for

play00:44

us for our identity so that when we use

play00:47

that digital certificate when we present

play00:49

it to somebody else they can be sure and

play00:51

they have a valid method of verifying

play00:54

the information in that certificate so

play00:56

pki or public key infrastructure is the

play00:59

the network and all the elements that

play01:01

come into play whenever we want to

play01:03

validate somebody's identity okay so to

play01:06

have an actual working public

play01:08

infrastructure this infrastructure that

play01:10

helps us validate identities we need to

play01:13

find a way to to connect the keys that

play01:16

we're using for all this encryption and

play01:18

signing business in a way to connect

play01:20

these keys to our unique identities to

play01:22

us as as people in the end so in order

play01:25

to do this we're going to rely on the

play01:28

concept of asymmetric cryptography based

play01:30

on a private key and a public key so you

play01:33

already know that you should keep the

play01:34

private key safe only for you you should

play01:36

already know that you can freely share

play01:38

the public key with anyone out there and

play01:40

you know that whatever one key encrypts

play01:42

the other one can decrypt the same goes

play01:44

for digital signatures as well because

play01:46

even with digital signatures we're

play01:48

encrypting hashes of our messages

play01:50

so we know that these keys can be used

play01:52

in encryption for example if I want to

play01:55

send some encrypted information to you I

play01:57

can request your public key through a

play01:59

certificate for example and I can use

play02:01

that public key to encrypt data that I

play02:03

know that only you can decrypt with your

play02:05

private key all right that's one use

play02:07

case the Second Use case is when I want

play02:10

to prove my identity to someone so I

play02:11

need to do something with my private key

play02:14

that I can then later on show that

play02:16

something to another person and they

play02:19

would be able to determine that indeed I

play02:22

was the one that performed that

play02:23

operation using my private key so it has

play02:25

to be some piece of information that was

play02:27

digitally encrypted or signed by me so

play02:30

I'm going to authenticate myself using a

play02:33

digital signature how do we do this well

play02:35

we can watch the previous video about

play02:36

this but long story short we're going to

play02:38

take a message we're going to Hash that

play02:40

message and we're going to encrypt it

play02:42

with our private key now whoever

play02:45

receives that message along with the

play02:46

encrypted hash is able to decrypt the

play02:48

hash validate the fact that the hash

play02:50

matches with the content that they

play02:52

receive and they can determine this way

play02:54

that that piece of data actually came

play02:56

from me because I'm the only person who

play02:59

is able to sign it in such a way so that

play03:01

my public key can be used to validate

play03:03

its identity I am the only holder and

play03:05

owner of my private key and another

play03:07

benefit fit of this is that absolutely

play03:09

anyone up there can use the same process

play03:11

to validate your identity you don't need

play03:13

to set up a secure Channel you don't

play03:15

need to communicate any secure

play03:16

information you just really give up

play03:18

anyone your public key and if they are

play03:21

able to decrypt your digital signature

play03:22

or any kind of content encrypted by your

play03:25

private key that's how your identity is

play03:28

being proven now the problem we have

play03:30

here is that well we keep saying that

play03:34

you're sharing that public key with

play03:35

anyone but but simply getting a hold of

play03:38

somebody's public key or downloading the

play03:41

public key from a website that says that

play03:43

this is Andrew's public key that's not a

play03:45

guarantee of an actual identity an

play03:48

attacker could potentially intercept

play03:49

those public keys while Alice sends her

play03:51

key to blob and intercept that public

play03:53

key and injects the attacker's key

play03:55

instead of it so how do we protect

play03:57

against this type of scenario well pki

play03:59

addresses this exact problem the problem

play04:02

of validating the information that we're

play04:04

receiving related to a public key I'm

play04:07

basically validating whatever comes

play04:09

inside of a certificate so you can say

play04:10

that pki is a way of validating the

play04:13

ownership of a public key because a

play04:16

public key can be freely distributed and

play04:18

downloaded

play04:19

but we need to know it's the right

play04:20

public key and the way apki is

play04:23

implemented is by using digital

play04:24

certificates which is just a wrapper

play04:26

just a container for a public key now

play04:29

that container actually includes a lot

play04:31

more Fields than just the public key it

play04:33

includes some information that uniquely

play04:34

identifies you as a person your your

play04:37

name your country maybe the scenarios in

play04:40

which that certificate can be used for

play04:42

like for digital signatures or for

play04:44

encrypting files and so on and the most

play04:46

important part about the certificate is

play04:48

that it has to be vowed by somebody else

play04:51

it has to be

play04:52

confirmed by an higher level Authority a

play04:55

certification Authority that the

play04:57

contents of that digital certificate are

play05:00

real valid and true so what we do in

play05:03

order to validate this well we ask a

play05:05

certificate Authority that everybody

play05:06

trusts to sign our own digital

play05:08

certificate and how does the ca actually

play05:10

sign our certificate well the the same

play05:13

way we sign anything with a digital

play05:15

signature right the ca calculates a hash

play05:18

of our certificate and then encrypts it

play05:20

with the ca's private key now everyone

play05:23

else on the internet whoever receives

play05:25

our certificate sees the digital

play05:27

signature in it can freely download or

play05:29

they most likely already have the public

play05:31

key of the well-known Cas out there they

play05:34

use the public key to decrypted Hash

play05:35

they validate the hash they validate the

play05:37

signature and they know that the

play05:38

contents in that certificate that state

play05:40

that this is Andrew and this is his

play05:42

public key are to be trusted and of

play05:45

course the cas must be trusted by anyone

play05:48

because if you don't trust the ca then

play05:50

you're back to square one how do I trust

play05:52

that I am Andrew or how do I trust that

play05:54

the this is very sign the ca that I'm

play05:56

supposed to trust it's the same problem

play05:58

I mean you have to trust at some point

play06:00

in order to create this hierarchy of

play06:03

trust from that point on and if the ca

play06:05

is trusted then we can use this

play06:07

probability to validate the certificate

play06:09

and then trust the identity of the one

play06:11

person that is actually mentioned in

play06:13

that certificate as well so that proves

play06:15

that my certificate is a valid one

play06:18

now as you mentioned in a previous video

play06:20

most operating systems and browsers out

play06:22

there have a built-in list of trusted

play06:24

Cas so everything that comes signed by

play06:27

those trusted Cas you know even in a

play06:30

deeper level hierarchy I mean you could

play06:32

have a certificate that is uh signed by

play06:34

one CA and then that's the a certificate

play06:37

is signed by another CA and so on and so

play06:38

forth well at the end of that hierarchy

play06:40

there has to be a CA that you trust in

play06:43

your browser in your operating system so

play06:45

this is a screenshot right here shows

play06:47

the list of trusted root certification

play06:50

authorities as you can see here on the

play06:51

left hand side which are built into in

play06:54

my installation of windows in the

play06:55

previous video we saw that there's a

play06:57

separate list maintained for example for

play06:59

each and every browser out there for

play07:01

example Firefox Chrome Opera and so on

play07:03

now a CA is responsible for generating

play07:06

digital signatures which actually end up

play07:08

as being valid certificates but again

play07:11

anyone can do this right it's basically

play07:14

just a piece of software that generates

play07:15

digital signatures you can install a

play07:18

certificate Authority locally on your

play07:19

own laptop if you wish in fact in many

play07:22

companies we do have local certification

play07:24

authorities which are local to the

play07:27

Enterprise to the network inside of that

play07:30

company only which means that we can

play07:33

actually have our own little island of

play07:35

trust so that everything that is signed

play07:37

by a local CA inside of our network is

play07:40

automatically trusted now of course if

play07:42

we try to sign any resources that need

play07:44

to be checked or validated outside of

play07:46

our local network like over the Internet

play07:48

that signature that digital signature is

play07:51

not going to pass validation but within

play07:53

a company if everybody is configured to

play07:56

trust the the ca that is local to that

play07:59

company that is locally installed in in

play08:01

the company's data center than any other

play08:03

certificates that we're generating using

play08:05

that CA in any certificates that we're

play08:07

we're signing using that CA are going to

play08:10

be automatically trusted but if you go

play08:11

outside in the wild wild internet you

play08:14

want to communicate from one company to

play08:16

the next then you have to rely on some

play08:18

public CA out there the one that is

play08:21

trusted and recognized by everyone else

play08:23

now the ca actually does a bit more than

play08:25

just generating digital signatures

play08:27

normally in the process of generating a

play08:29

certificate that has to be some sort of

play08:31

a validation process because I I could

play08:33

be submitting a certificate for for it

play08:36

to be signed to to very sign and they

play08:40

should probably ask me for some proof

play08:42

like providing some sort of ID that

play08:44

proves that I'm actually Andrew then

play08:46

that is actually my name or that I

play08:48

really own the website for which I'm

play08:50

trying to get my certificate signed so

play08:52

there has to be some sort of a

play08:54

registration process where you have to

play08:56

pass some checks in order for your

play08:58

certificate to be generated now the CEO

play09:00

isn't by themselves are not just

play09:02

isolated Islands out there on the

play09:04

internet we usually have a hierarchy of

play09:06

CAS in which all these Cas are related

play09:08

to one another in a hierarchy of trust

play09:12

so to start with the simplest example

play09:14

out there from a single CA just one

play09:16

single CA now you could have one single

play09:19

CA generating all your certificates and

play09:21

that's it now the problem is that the ca

play09:23

of course is going to be exposed

play09:25

vulnerable because everyone interacts

play09:27

with it and potentially open to exploit

play09:30

and compromise and if a CA gets

play09:32

compromised if the private key of A CA

play09:34

gets compromised the rule says that

play09:37

every certificate ever generated by that

play09:40

CA becomes invalid that's because if the

play09:43

private key has been compromised then

play09:44

the private key now could be in the

play09:46

hands of somebody else who is using that

play09:49

private key to generate

play09:51

fake certificates or certificates that

play09:54

don't include real information so we

play09:57

lose that trust that we should have had

play09:59

from the very beginning in that CA

play10:02

we don't know which certificates are now

play10:04

valid generated by that CA and which

play10:05

certificates are not valid so we

play10:07

invalidate them all the moment the

play10:09

private key gets compromised so we call

play10:11

this a single point of failure right one

play10:13

CA doesn't sound like a very good idea

play10:15

so we have the second scenario where we

play10:17

rely on a hierarchy of CAS so we have

play10:20

multiple Cas each one signing the

play10:23

certificates of those below them which

play10:26

creates a hierarchy in which we have

play10:27

root Cas we have intermediate Cas and

play10:30

then we have Leaf Cas at the end of this

play10:33

hierarchic tree now this model creates

play10:35

what is called as certificate chaining

play10:38

or a chain of trust that is because each

play10:40

and every certificate that is generated

play10:41

by a leaf CA can be traced back to its

play10:45

parent in the hierarchy of trust up to

play10:47

the root CA that actually signed all

play10:50

those intermediate and leave cas

play10:52

why do we need to over complicate this

play10:54

so I mean what's the benefit instead of

play10:57

having just the one single Routier well

play10:59

the benefit is that by Distributing this

play11:02

infrastructure this way at some point we

play11:05

can safely take the root CA completely

play11:07

offline

play11:08

I mean we don't want to keep it online

play11:12

and exposed and open to attacks because

play11:16

otherwise it becomes the same single

play11:18

point of figure that we had with just

play11:19

one CA so once we have instantiated the

play11:23

intermediate and leave Cas that are

play11:26

actually going to deal with the

play11:28

certificate generation process for us we

play11:30

can safely bring the root CA offline and

play11:32

completely disconnect it from the

play11:34

network that way we can be close to 100

play11:36

sure that the private key of that CA is

play11:38

never going to be compromised even more

play11:41

so if at some point it just happens that

play11:44

one of the leaf Cas gets compromised

play11:46

well we're not going to be losing the

play11:48

all the certificates that were generated

play11:50

within that pki we're just invalidating

play11:53

the certificates generated by that

play11:54

specific leave CA not by all the other

play11:58

ones

play11:59

and you can easily view this even in

play12:01

Windows if you open the certificate

play12:02

store and navigate to one of the

play12:04

well-known root certificates out there

play12:05

or just select one of the certificates

play12:07

that you're using for a specific website

play12:09

you gotta find a tab in there that says

play12:11

certification path in this case right

play12:13

here we actually have two additional Cas

play12:17

so one root CA and one leaf CA the

play12:20

GoDaddy root certificate Authority and

play12:21

the GoDaddy secure certificate Authority

play12:23

which in turn has actually signed the

play12:26

comptia.org certificate that you're

play12:28

you're receiving whenever you're

play12:30

visiting the the CompTIA website and as

play12:32

far as the route goes as we said before

play12:34

we can safely take it offline because

play12:35

we're we're only using your root CA to

play12:39

create other

play12:40

sub ca's other intermediariess other

play12:43

leaves yeah so we're not signing end

play12:45

user certificates we are just empowering

play12:48

other Cas to do this for us so once

play12:52

you've generated you've generated the

play12:53

the certificates you've signed the

play12:55

certificates of all your necessary Cas

play12:57

you can safely bring it offline now the

play13:00

process of registration when it comes to

play13:01

Cas is basically a process of

play13:03

authentication over the process of

play13:05

creating an account with that CA so that

play13:08

your identity is validated and then you

play13:10

gain the rights of requesting further

play13:12

certificates for example once I have

play13:14

proven my identity as I am Andrew right

play13:17

to to my favorite CA I can then ask that

play13:19

CA well give me a certificate for email

play13:21

signatures give me one for a web server

play13:24

that I own give me one for disk

play13:26

encryption and so on so that's the

play13:28

registration part it's the identity

play13:30

checks I wouldn't say background checks

play13:32

actually but it's a it's a sort of

play13:33

validating the the true identity of the

play13:36

entity that is requesting that

play13:38

certificate for example in case of the

play13:40

people who are want to use a digital

play13:42

certificate to sign their email you

play13:44

might be required to present some sort

play13:46

of an identification like a government

play13:48

issued idea or in case of a website if

play13:52

you want to secure your website to allow

play13:54

clients to connect over https and you

play13:57

want to install a certificate on that

play13:58

website you have to prove ownership of

play14:00

that website by publishing something in

play14:03

the DNS domain or by sending an email

play14:04

from the domain that has the same name

play14:07

as the website and anyway you have to

play14:10

prove that you're an admin and you are

play14:12

authorized to request a certificate for

play14:15

that specific domain

play14:16

there can be even simpler situations

play14:19

such as in Microsoft Windows Active

play14:21

Directory there are policies in active

play14:24

directory which allow users to generate

play14:27

a certificate simply by authenticating

play14:29

themselves inside of the domain so once

play14:32

you you authenticate using a username

play14:34

and a password or a smart card or

play14:35

whatever you're using to log into

play14:37

Windows once you're authenticated in the

play14:39

domain you can freely request as many

play14:41

certificates as you want for example for

play14:43

a BitLocker or disk encryption

play14:45

but the official method by which any

play14:48

person can receive a certificate from a

play14:50

CA is by filling in a form basically

play14:53

that could be digital form of course

play14:55

which is called a CSR that's a

play14:57

certificate signing request I'm

play14:58

requesting you you my Dr CA to sign the

play15:02

certificate for me that's a CSR now in

play15:05

digital form don't imagine it's a it's

play15:07

not a PDF file or anything like that

play15:09

it's basically an ASCII file it's an

play15:11

ASCII string of characters encoded

play15:14

actually in base64. and that file

play15:17

includes all the information that I want

play15:19

to end up with in my resulting

play15:20

certificate such as my identity my name

play15:22

maybe the domain names that I want to

play15:24

cover if it's a web server certificate

play15:25

and of course my public key

play15:27

and that's the information that the ca

play15:29

actually has to validate before actually

play15:31

emitting that certificate the

play15:33

information submitted in the CSR now

play15:36

again in some cases simply because the

play15:38

this process of generating and receiving

play15:41

csrs creates the ca to be extremely

play15:44

exposed because it constantly receives

play15:46

input information from from outside

play15:49

users the process of managing csrs is

play15:52

sometimes outsourced to a different

play15:55

entity which is called a registration

play15:57

Authority this one is also part of the

play15:59

pki but it's a separate server separate

play16:01

entity that only deals with receiving

play16:03

and validating csrs they don't actually

play16:06

emit the end user certificates but they

play16:09

do give a verdict as whether the CSR is

play16:12

valid or not so finally if we pass all

play16:14

those checks we end up with a digital

play16:17

certificates received from the CA and

play16:20

signed by that CA so it's basically just

play16:22

a container for your public key with

play16:23

some additional information that

play16:25

identifies you as a person or as a

play16:28

machine as web server as an email server

play16:30

depending on the use case for that

play16:32

specific certificate generally

play16:34

certificates nowadays are based on the

play16:36

x509 ietf standard remember that one but

play16:40

there is also an additional set of

play16:41

Standards created by RSA you have the

play16:43

same name as the algorithm which is pkcs

play16:47

a very generic name that stands for

play16:49

public key cryptography standards

play16:51

standards themselves Define What fields

play16:55

are allowed within a certificate where

play16:56

they should be positioned what data type

play16:58

is accepted in there and the use case is

play17:00

acceptable by each certificate type

play17:03

now among the information that is

play17:05

available within a certificate we're

play17:07

going to find a serial number this is

play17:08

just a unique number that uniquely

play17:10

identifies the certificate very useful

play17:12

when we want to check the validity of a

play17:14

specific certificate or when we want to

play17:16

revoke it from the ca so the ca can

play17:19

actually publish a list or respond to

play17:21

some requests that are going to say that

play17:24

this specific list of serial numbers or

play17:26

this specific list of certificates

play17:27

basically are not valid anymore have

play17:30

been retired we also have the signature

play17:33

algorithm of the ca the algorithm that

play17:35

was used to sign that certificate why do

play17:38

we need this well we need to know the

play17:39

signature algorithm so that we can check

play17:41

that signature right we need to

play17:42

calculate the hash on our own so that we

play17:45

can have something to compare it with so

play17:47

we need to know the algorithm that was

play17:48

used from the very beginning

play17:49

specifically we need to know the

play17:51

signature hash algorithm as well we're

play17:53

going to find the issuer in there that's

play17:55

basically the name of the ca who signed

play17:57

that certificate or who issued the

play17:59

certificate we're going to see a Time

play18:01

range described as a valid 2 and valid

play18:04

from fields which indicates the period

play18:06

of time in which the certificate is

play18:08

valid all certificates out there have an

play18:10

expiration date

play18:11

we also get this subject that is the

play18:14

entity that the certificate represents

play18:16

it might be your name it might be your

play18:17

email address if you're using for email

play18:19

signing it might be part of the web

play18:22

server fully qualified domain name if

play18:24

you plan on using it in a network device

play18:26

of course we get the public key because

play18:28

we're basically talking about a wrapper

play18:30

for the public key so it has to be in

play18:32

there somewhere and some more extensions

play18:34

couple of them will be covered in the in

play18:36

the next sections

play18:38

so going back to the topic of that

play18:39

subject because that's the identifier of

play18:42

the actual person or entity or server

play18:45

that is using that certificate we have a

play18:47

number of ways in which we can describe

play18:49

that subject information first of all we

play18:51

had had with an emphasis on the past

play18:54

time here CN that's common name usually

play18:57

this one was designed to be the fully

play19:01

qualified domain name of the of the

play19:04

website or of the server that

play19:05

certificate is supposed to belong to now

play19:08

since the CN actually did not specify an

play19:12

exact syntax that is to be followed it

play19:15

is nowadays deprecated because some

play19:17

browsers some validation entities had

play19:19

some problems in uh in double checking

play19:22

this field and actually figuring out

play19:24

which entities the certificate belongs

play19:26

to so nowadays it was replaced with

play19:28

something called Sam subject alternative

play19:30

names and now the name itself might

play19:34

suggest that a San is uh is just an

play19:37

alternative to

play19:38

to the actual subject no it's just

play19:41

basically a list of all the subjects

play19:43

covered by the certificate itself

play19:47

in the example here on the slide we can

play19:49

see a certificate from CompTIA which has

play19:51

a subject section that uses the CN field

play19:53

you can see here it's

play19:54

cnlearn.comti.org now on the other hand

play19:56

we have a certificate from cisco.com you

play19:59

get the certificate if you access

play20:00

cisco.com in your browser and there's a

play20:02

section of subject alternative names

play20:05

and you can see here it's an actual list

play20:07

of alternative domain names that this

play20:11

certificate can protect so if you visit

play20:12

any of the Cisco www.cisco.com media

play20:15

files score static Cisco the websites or

play20:18

the browser visits them in the

play20:19

background then it's going to use them

play20:22

and validate those destinations by using

play20:24

this same certificate now from a more

play20:27

practical point of view listing all the

play20:28

domains in here just like Cisco did is a

play20:31

bit more secure but in reality you're

play20:34

going to find wild card notations in

play20:36

here like

play20:37

star.cisco.com something like that which

play20:39

implies that any subdomain that belongs

play20:41

to that parent domain is going to be

play20:43

protected by that certificate not all

play20:45

certificates are equal that is not all

play20:47

certificates have the same type the type

play20:50

actually refers to the key usage what

play20:52

can that certificate be used for could

play20:54

we use it for signing emails for

play20:56

encrypting files for encrypted disk and

play20:58

so on and so forth and these user

play21:00

scenarios are described in the key usage

play21:03

field as part of the certificate itself

play21:05

and of course since the contents of the

play21:07

certificate are digitally signed by the

play21:09

ca

play21:10

so are validated first by the CA and

play21:12

then the digital signature is applied in

play21:13

there you cannot just freely change this

play21:16

use cases for a specific certificate if

play21:18

a certificate was generated only for

play21:20

email signing then you will not be able

play21:22

to use that certificate for disk

play21:24

encryption

play21:25

alternatively we can find a field called

play21:28

extended key usage or the way Microsoft

play21:30

likes to call it if you open up a

play21:32

certificate in Windows is enhanced key

play21:34

usage which is just another way a more

play21:37

flexible way of defining use cases for

play21:39

the certificate but the end result is

play21:41

pretty much the same

play21:42

so among the use case examples that we

play21:45

can select inside of this key use it or

play21:47

extended key usage field are server

play21:49

authentication client authentication can

play21:51

use this for code signing that's the

play21:54

same type of certificate by the way that

play21:55

is used when you're downloading and

play21:57

validating applications downloaded from

play21:59

an official app store on your mobile

play22:00

device that's also going to be validated

play22:03

using some sort of a code signing

play22:04

certificate and email protection now you

play22:07

can see that we have a couple more

play22:08

extensions apart from these standard

play22:10

fields that we find in the certificate

play22:12

now of course these extensions can be or

play22:15

might not be recognized by all the

play22:18

clients and all the software out there

play22:20

which brings us to the discussion about

play22:22

critical and non-critical extensions in

play22:24

a certificate if an extension is tagged

play22:27

as critical then the application that

play22:29

processes the certificate that uses it

play22:31

in any way must be able to recognize

play22:33

that extension if the application

play22:35

doesn't recognize the extension maybe

play22:37

it's an optional one it shouldn't use

play22:39

the certificate at all it should reject

play22:41

it completely and you can probably guess

play22:43

what non-critical extension means well

play22:45

it's a non-critical extension even if

play22:47

the application doesn't recognize that

play22:48

specific extension it's still going to

play22:50

use the rest of the fields in the

play22:51

certificate and the way the application

play22:52

was programmed to use that certificate

play22:55

even if it doesn't understand its

play22:56

contents 100 percent

play22:58

now when it comes to websites the

play23:00

certificate that the website presents to

play23:02

all its clients to all their browsers is

play23:05

basically a proof of the website's

play23:06

identity which is very important if

play23:08

you're interacting with a with an

play23:10

e-commerce site or with a banking site

play23:11

or with any site that requires you

play23:13

provide some sensitive data personally

play23:15

identified or confidential information

play23:17

so you need to validate the identity of

play23:19

the entity that you're talking to that

play23:21

you're actually communicating with

play23:23

you're giving your credit card details

play23:25

to Amazon and not to I don't know Amazon

play23:28

with double o's at the ends.com

play23:31

and that's a real problem actually there

play23:34

are situations where anybody can just

play23:36

set up a new domain name and perhaps

play23:39

even submit a certificate signing

play23:42

request for that new domain name such as

play23:44

amazon.com to a real CA trusted by

play23:47

anyone and they would get a valid

play23:49

certificate for that website which then

play23:51

they can use to impersonate amazon.com

play23:55

and steal credit card data so we have

play23:57

different levels of security involved

play23:59

whenever the checks are being performed

play24:01

before actually emitting web server

play24:03

certificates from publicly trusted cas

play24:07

and the way we can Implement these

play24:08

checks we have two methods we have

play24:10

domain validation which is a very simple

play24:12

check which uh just proves that you're

play24:14

the owner of the domain that you're

play24:16

trying to register a certificate for it

play24:18

might require you to fill in some DNS

play24:21

records temporarily that can be publicly

play24:23

checked by the ca or by the ra the

play24:25

registration Authority or you might be

play24:28

required to send an email from the

play24:29

domain name with the same name as the

play24:31

the website you're trying to register

play24:33

the certificate for now for a higher

play24:35

profile websites there's also an

play24:37

additional more complex process called

play24:39

extended validation which checks the

play24:42

legal ownership the legal identity of

play24:45

the owner of that of that resource that

play24:47

we're trying to create a certificate for

play24:48

and we avoid situations such as those

play24:51

that are trying or attempting to create

play24:54

valid certificates for spoofed or or

play24:56

phishing domains

play24:58

now the other certificate types that

play24:59

you're going to encounter because users

play25:01

and websites are not the only ones that

play25:03

need certificates we're going to start

play25:06

with users all right we can generate

play25:08

certificates for users for them to be

play25:10

able to use them for email signing or

play25:12

for this encryption we can also generate

play25:14

certificates for servers and

play25:15

applications we can use those

play25:17

certificates to prove the identity of

play25:19

the server or the application that is

play25:21

being accessed you can also use

play25:22

certificates to sign code files and

play25:25

applications and we can also have

play25:27

self-site certificates because nobody

play25:29

stops you from generating a certificate

play25:31

that you are signing by yourself this

play25:34

comes back to the discussion about the

play25:36

napkin one or two videos ago I mean it's

play25:39

nobody's going to trust it right

play25:40

nobody's going to be able to validate it

play25:42

but it is still a true and correct

play25:46

certificate now the self-signed

play25:47

certificates are usually the ones that

play25:49

get installed in internal networks in

play25:51

lab environments in demo environments

play25:53

and pocs and those are the situations

play25:55

where we get that warning in the browser

play25:57

that says the certificate is not trusted

play25:59

well it's not trusted because the

play26:01

signature on that certificate is the

play26:03

signature of somebody that we can cannot

play26:06

validate its identity we don't know who

play26:08

that is all right I can sign my own

play26:10

certificates are you going to trust me

play26:11

no because that's the point of all the

play26:13

process right to trust my identity to

play26:15

find another method of validating my

play26:17

identity my signature means nothing you

play26:20

need a CA for that also keep in mind

play26:23

that in many cases the authentication

play26:26

process for example gaining access to a

play26:28

network can be performed at two

play26:30

different levels we can validate the

play26:32

identity of the user or the admin that

play26:35

is trying to access the network and we

play26:36

can also validate the identity of the

play26:39

machine that the user or the admin is

play26:41

trying to connect to the network so we

play26:43

can have two levels in there

play26:44

authenticate user and also the laptop

play26:46

that is trying to gain access to the

play26:47

network that's why they also have

play26:49

machine certificates and user

play26:51

certificates ever found yourself in a

play26:53

situation where if you're using a

play26:55

company laptop you can easily plug

play26:57

anything red cable into it and gain

play26:59

instant access to the local network

play27:00

while if you bring your own laptop from

play27:03

home you're not getting any kind of

play27:04

access well that's because that laptop

play27:07

in there has some sort of authentication

play27:08

information built into it most likely a

play27:11

certificate that it presents as a

play27:13

machine certificate and authenticates

play27:14

itself to the access control system that

play27:17

allows access to the rest of your

play27:19

network your home laptop doesn't have

play27:21

that certificate doesn't have a valid

play27:23

identity that it can present so it is

play27:25

denied access

play27:27

so a certificate is going to go through

play27:29

a number of stages during its lifetime

play27:30

starting with the creation of the keying

play27:32

material that is the creation of the

play27:34

private key and the public key right

play27:35

we're using just a public key to grade a

play27:37

certificate but we need a private key as

play27:39

well because the public key is derived

play27:41

from the private key not the other way

play27:43

around you should know this by now

play27:46

then we move on to the certificate

play27:48

creation that is filling in that CSR

play27:51

sending the CSR and receiving a valid

play27:53

certificate from the ca certificate

play27:55

storage is important not necessarily

play27:57

from a security perspective but more

play27:59

from a usability perspective you need to

play28:01

store that certificate load it into a

play28:03

certificate store where it can be

play28:05

accessed by any applications that need

play28:07

to use it to validate someone's identity

play28:10

now on the other hand you should store

play28:12

in a very secure manner the private key

play28:14

that was used to generate that

play28:16

certificate and finally we have

play28:18

revocation of that certificate or

play28:20

putting the certificate out of business

play28:22

it might be because the certificate has

play28:24

expired or it might be because the

play28:27

private key has been compromised in any

play28:29

situation a certificate can always be

play28:31

renewed now if the private key has been

play28:33

compromised you're probably gonna want

play28:35

to use a new key and generate a new

play28:37

public key pair for the new certificate

play28:39

but if the certificate just happened to

play28:41

expire because it reached its end of

play28:44

life its expiration date you can will

play28:46

reuse the same keying material you don't

play28:48

need to generate a new key and keep in

play28:50

mind that all certificates expire at

play28:51

some point there is always going to be

play28:52

an expiration date on certificates

play28:55

now in general storing secure Keys is a

play28:58

big problem in security because if you

play29:00

back up the key just to say you're

play29:02

you're storing it in multiple versions

play29:04

just to make sure that you're not going

play29:06

to lose it it exponentially increases

play29:08

the risk of that Key's exposure on the

play29:11

other hand if you don't have a backup

play29:12

for the key then the place you're

play29:13

actually storing that key becomes a

play29:15

single point of failure which can cause

play29:17

in case of failure your inability to

play29:20

ever access your encrypted data so there

play29:23

have been invented some processes for

play29:25

dealing with this type of key recovery

play29:28

in which we're trying to store the

play29:30

private key somewhere but in a as secure

play29:34

manner as possible for example we we

play29:37

store its segmented into a different

play29:40

number of storage devices or we need a

play29:43

specific number like two or three admins

play29:46

with access at the same time in order to

play29:48

recover all the pieces and and build

play29:50

that key back again then we're using all

play29:53

these security measures to avoid any

play29:56

kind of collusion or exploitation that

play29:59

might happen against that key storage

play30:01

system now key escrow is kind of similar

play30:04

but it refers from a legal standpoint to

play30:07

the practice of giving that key to some

play30:09

third party for the purpose of safe

play30:12

storage if you don't want to invest in

play30:14

some Secure Storage infrastructure for

play30:16

your keys you can pay a third-party

play30:18

company to do that for you now of course

play30:20

the liability that comes from a

play30:23

potential keep compromise can be

play30:25

transferred as a risk to that

play30:27

third-party company but don't forget

play30:29

that even if they are the ones now

play30:31

responsible for the security of the key

play30:33

any side effects that might occur from

play30:36

that key being compromised are going to

play30:38

hit back your own company and your own

play30:40

reputation

play30:41

and we talked about the fact that all

play30:43

certificates expire at some point

play30:45

normally these certificates that are

play30:46

generated for end users have a shorter

play30:48

lifespan maybe a couple of months maybe

play30:50

even 30 days maybe even one year or so

play30:52

but real certificates are usually

play30:54

created for a longer period of time such

play30:56

as one three five ten years or so now

play31:00

generally when a certificate expires

play31:01

there's a very simple procedure to just

play31:03

renew it and in case of CAS or

play31:06

registration authorities the process

play31:08

itself if the user already has a valid

play31:10

certificate if the user wants to just

play31:12

renew it the process is going to be much

play31:14

more smooth so not so many checks are

play31:16

going to be performed if the user is

play31:18

already holding a valid certificate

play31:21

now certificate can also be revoked that

play31:23

is manually and explicitly taken out of

play31:26

commission so it's a process where we

play31:28

suddenly decide that these certificates

play31:30

are not going to be valid anymore maybe

play31:31

the company went out of business the

play31:33

company doesn't exist anymore maybe the

play31:35

uh the private Keys has been compromised

play31:37

maybe the servers that were storing them

play31:38

are have been the victim of a data

play31:40

breach and we don't know exactly how

play31:42

much data was lost in there but we

play31:43

decide to to revoke all those

play31:45

certificates how can we do this well

play31:47

there are two methods for doing this the

play31:49

first one relies on the actual CA and

play31:52

the ca can inform the end users what are

play31:55

the revoked certificates that it manages

play31:59

and that's called a certificate

play32:01

revocation list crl now the way this

play32:03

works is that when clients attempt to

play32:06

validate a certificate with a CA well

play32:07

they grab the public key of that CA they

play32:09

decrypt the signature and so on so forth

play32:11

but they also should check the serial

play32:13

number of the ca to see whether it is

play32:16

found in one of the crls that they can

play32:18

download from the from the ca of course

play32:21

this is up to the client if they perform

play32:22

this additional check or not

play32:24

which means that certain clients might

play32:26

not perform this check at all and other

play32:28

clients might perform this check maybe

play32:30

once a day once a week or so when they

play32:33

just download those crls and then they

play32:35

don't update them until let's say a

play32:37

number of days have passed it also might

play32:40

happen that the cas don't update those

play32:42

crls immediately for everybody else to

play32:45

download so revoking a certificate might

play32:48

not happen instantaneously we have

play32:50

another method of providing the

play32:51

certificate expiration revocation list

play32:53

dynamically to our users and that is

play32:55

based on the ocsp online certification

play32:58

status protocol now this instead of

play33:00

downloading an entire list of serial

play33:01

numbers of expired certificates or

play33:03

revoke certificates we're simply relying

play33:06

on a type of request reply protocol

play33:08

where we simply send a query about a

play33:11

specific serial number and then we'll

play33:12

receive a response based on that serial

play33:14

number telling us whether the

play33:16

certificate is still valid or not now of

play33:19

course it depends on the server

play33:20

implementation how they're performing

play33:22

this type of query processing so some

play33:24

servers might be acquiring the database

play33:26

of certificates directly others might be

play33:28

querying the crl list so in case the

play33:31

serial list is a bit behind or up to

play33:33

date then ocsp is also going to provide

play33:35

a less than ideal or less than

play33:39

up-to-date answer and since this entire

play33:41

process of request reply request reply

play33:43

puts a lot of stress on the actual CA

play33:47

server we can actually delegate the web

play33:49

server that we're trying to access to

play33:51

respond on behalf of the ca with these

play33:54

ocsp status responses how does this work

play33:58

well the web server obtains from the ca

play34:00

a timestamped response which then in

play34:03

turn it can use to provide as an answer

play34:06

to any request that might come into the

play34:08

web server in order to validate its

play34:09

certificates so it doesn't have to go

play34:11

back and forth to the ca every single

play34:13

time somebody validates that certificate

play34:15

asks the ca once receives a signed

play34:19

response and then shows everyone this is

play34:21

the signed response from the ca stating

play34:23

that my certificate is still valid trust

play34:25

this one and this process is called

play34:27

ocasb stapling

play34:31

there's another problem here that we can

play34:33

address and that is a problem of another

play34:35

man in the middle type of attack because

play34:38

theoretically at least when you're

play34:39

accessing a site such as google.com

play34:41

you're performing a certificate exchange

play34:43

you're requesting the certificate from

play34:44

Google in order to validate it now what

play34:47

if somebody in the middle of that

play34:49

conversation intercepts that certificate

play34:51

and injects their own certificate

play34:53

signed certificate trusted certificate

play34:56

what are you going to do with that

play34:58

certificate well you're going to accept

play34:59

it and you're going to think that Google

play35:02

certificate is the one that you just

play35:04

received and then what you're going to

play35:06

do well you're going to send your

play35:07

authentication data you're going to send

play35:09

your emails you're going to upload your

play35:10

files

play35:11

you're going to perform all your tasks

play35:13

and you're going to encrypt those with

play35:16

the public key that came

play35:18

from within that bogus certificate that

play35:20

was just injected and of course all that

play35:22

information now can be safely inspected

play35:25

and snooped by the attacker that

play35:28

injected that certificate

play35:29

so in order to avoid this situation we

play35:31

have something called certificate

play35:33

pinning or hbkp

play35:35

which stands for HTTP public key pinning

play35:40

which is just a method of embedding the

play35:43

information in the original certificate

play35:45

in the actual Google certificate

play35:46

somewhere within the application code so

play35:49

somewhere within the the web page code

play35:52

of Gmail for example there's going to be

play35:54

the contents of Google certificate now

play35:56

the browser of course has to know to

play35:58

look for this has to be configured to

play36:00

understand hpkp so if it finds a set of

play36:03

information that describes the

play36:05

certificate within the application code

play36:07

then it can compare it with the actual

play36:08

certificate that it received now if the

play36:11

certificate has been tampered with and

play36:13

has been injected by a foreign attacker

play36:16

then of course they're not going to

play36:17

match so that's how the browser can

play36:19

detect an attempt for a man-in-the-mill

play36:21

attack and unfortunately it doesn't

play36:24

always happen for a malicious purpose

play36:27

this type of man in the middle

play36:28

interception because in many companies

play36:30

you have dedicated firewalls Next

play36:32

Generation firewalls especially that

play36:34

perform SSL decryption in order to

play36:36

inspect the web traffic that the

play36:38

employees are sending back and forth in

play36:40

order to block them from accessing

play36:42

unwanted websites in order to block them

play36:45

from downloading malware from unwanted

play36:48

destinations and so on but every pretty

play36:50

much all the web traffic nowadays is

play36:51

encrypted so you have to perform SSL

play36:54

decryption on the traffic before you can

play36:57

actually look at the traffic which means

play36:58

that you'll have to replace the

play37:00

certificate that the user is actually

play37:02

expecting to come from Google with your

play37:05

own self-signed certificate or some

play37:06

internal company certificate which is

play37:08

basically just the same example as

play37:10

before it's performing a man in the

play37:12

middle attack now if that website uses

play37:15

hpkp or certificate pinning that man in

play37:18

the middle approach is not going to work

play37:20

anymore it doesn't matter if it's

play37:21

performed in a legitimate manner or by

play37:23

an attacker so that was one of the

play37:26

reasons why at some point hpkp

play37:28

implementation started to back off just

play37:30

a bit because they were creating a lot

play37:33

of issues with legitimate company

play37:35

approved and an employee approved

play37:38

traffic inspection that's happening all

play37:40

over the the Enterprise world

play37:43

okay so how do you store certificates

play37:45

well at the end of the day don't forget

play37:47

that a certificate is nothing more than

play37:48

a simple file so we store it as a file

play37:51

on the disk with a certain extension

play37:52

perhaps to help you recognize them

play37:54

easier now one of the first types is a

play37:57

binary format with the Der extension

play37:59

you're not going to find these very

play38:01

often the one that you will find more

play38:04

often are the pem extension files these

play38:07

are certificates stored in ASCII format

play38:09

which means that they're easily

play38:11

selectable copy and pasteable you can

play38:14

attach them to email you can even paste

play38:16

them inside of an email if you wish and

play38:18

you can paste them in a in a web

play38:19

interface for an API access for example

play38:22

so they're much easier to you know to

play38:24

move from one place to another

play38:26

and the screenshot right here on the

play38:28

slide shows you the contents of a PM

play38:31

format certificate now don't expect to

play38:33

be able to read the contents by yourself

play38:35

because it's a base64 encoding but

play38:38

base64 is easily reversible in one of

play38:40

the simplest thing coding methods out

play38:42

there so you can immediately get to the

play38:45

actual contents of the certificate and

play38:47

you're also going to find certificates

play38:48

using the extensions such as CRT or CER

play38:51

which unfortunately don't happen to

play38:54

agree on a specific format so they don't

play38:56

tell you if it's binary or ASCII format

play38:59

what's stored in there and we also have

play39:01

some specific file extensions and file

play39:03

types that can store more than one

play39:05

certificate for example the pkcs trail

play39:08

format allows us to bundle the private

play39:12

key and the public key together in the

play39:14

same certificate this is normally

play39:16

atypical because a certificate is meant

play39:19

to store only the public key right but

play39:21

there are situations for example when

play39:22

you need to move the private key along

play39:25

with the public key from one machine to

play39:27

another for example when you're

play39:28

performing an upgrade you're replacing a

play39:30

server your web server right and you

play39:33

want to move the the certificate content

play39:35

the cryptographic content from one

play39:37

machine to the next you can export it as

play39:39

a pfx or p12 format file and then import

play39:42

it on the next machine

play39:44

and it's also used for backup purposes

play39:47

if you want to back up your private keys

play39:49

and you want to store them somewhere

play39:50

safe you can use the pfx format or p12

play39:53

ideally you should also protect this

play39:55

type of certificate format with a

play39:57

password because it contains sensitive

play39:59

information

play40:01

and we also have the p7b format which

play40:04

stores the entire certificate chain

play40:06

sometimes a host that uses a certificate

play40:09

or has to validate it doesn't have the

play40:11

ability of dynamically downloading the

play40:13

entire certificate chain in order to

play40:14

validate the certificate it's CA this

play40:17

the one the ca that signed that CA and

play40:19

so on and so forth so it might help

play40:22

especially for embedded devices small

play40:23

devices to help them by providing the

play40:26

entire certificate chain so that they

play40:27

can use it to validate whatever

play40:29

certificates have been generated by the

play40:32

by the leaf CA in that chain

play40:34

managing certificates depend on which

play40:36

operating system you're using on Windows

play40:39

all the certificate business is most

play40:40

likely managed by active directory

play40:43

and there are some command line tools

play40:44

out there as well especially the search

play40:46

util Windows utility that can help you

play40:49

manually generate interact with or

play40:51

validate digital certificates now in

play40:54

Linux we very often use the open SSL

play40:56

series of utilities

play40:59

and you can use an open SSL for a number

play41:01

of tasks for example you can even make

play41:04

yourself ACA you can generate a

play41:06

certificate signing request you can

play41:08

generate an actual certificate you can

play41:09

validate a certificate and so on and so

play41:11

forth you get the ability to manage

play41:13

everything related to certificates

play41:16

on the example on the slide you can see

play41:18

that we're generating an RSA type of

play41:20

public-private key pair of 2048 bits

play41:23

we're generating a certificate that is

play41:26

going to have an expiration date of one

play41:28

year and we are outputting it as a PM

play41:31

format in the file called certificate.pm

play41:35

now of course this is going to be a

play41:36

self-signed certificate

play41:38

also notice the information that is

play41:40

required for you to provide before

play41:42

actually generating this user

play41:44

certificate

play41:46

and for your reference here are some

play41:48

basic open SSL commands that you can use

play41:50

to generate and manage certificates by

play41:52

default of course you can run these on a

play41:54

Linux system but you can also get access

play41:56

to openssl if you're running a Windows

play41:59

subsystem for Linux on top of Windows 10

play42:02

or 11. so starting with a generation of

play42:04

an RSA key pair the first command is

play42:06

going to generate the private key for

play42:08

you while the second one as you can see

play42:10

uses the private key as an input in

play42:13

order to generate the public key

play42:14

remember we talked about this we said

play42:16

that the public key can be derived from

play42:18

the private one but not the other way

play42:20

around the length the 1496 at the end is

play42:25

the length of the key and the AES 256

play42:28

parameter in there indicates that we

play42:30

intend to encrypt which is going to

play42:33

require a passphrase from you as well

play42:35

we're going to encrypt the private key

play42:36

because that is truly sensitive

play42:39

information moving forward you can also

play42:41

use openssl to make yourself a CA and

play42:44

start signing certificates for accepting

play42:47

csrs certificate signing requests first

play42:50

you need to generate the CSR on the

play42:52

server for which you want to generate

play42:54

the certificate for that's a command for

play42:56

this one and then you assign the CSR on

play42:59

your own CA

play43:01

finally a couple of commands for viewing

play43:03

and validating certificates generated by

play43:06

you or generated by anyone else and

play43:09

signed by any public CA out there right

play43:13

so a lot of information here about

play43:14

digital certificates I know it's not

play43:16

light not easy to process but they're

play43:19

everywhere nowadays we have to know

play43:20

about them you have to know about them

play43:21

for the exam as well so I really hope

play43:23

you found this video informative and

play43:25

useful if you want to discuss more leave

play43:27

a comment and if you like this oh like

play43:29

And subscribe and good luck on the exam

play43:31

see you on the next video thank you and

play43:33

bye bye

play43:36

foreign

play43:40

[Music]

Rate This
β˜…
β˜…
β˜…
β˜…
β˜…

5.0 / 5 (0 votes)

Related Tags
Digital CertificatesPublic KeyCryptographySecurity InfrastructureAsymmetric KeysIdentity ValidationEncryption MethodsCertificate AuthoritySSL/TLSCybersecurity