So, now we have a way, to ensure the confidentiality using Secure Socket Layer, an public private key encryption. An the only question now remaining, is, who are we talking to? And are we talking to that, server that we think we're talking to? Are we really talking, to Amazon? Are we really talking to Coursera? How do we know? Now, you'll notice if you take a look at the top of your browser, perhaps right now, even, you can take a look at the top of your browser. And usually when it's indicating that you have a secure connection, you can click on this and see some information. It's called the certificate information. Okay? And so, https has the notion of a public key. We retrieve the public key when we make the connection. But there are two kinds of keys. There are public keys that are just made up that are sent to us, and then there are public keys that are signed and validated by a third-party certification authority. So, this is a Coursera, and it is certified by GoDaddy certification authority. So, it's not just that we're getting the certificate from Coursera, we're actually getting the certificate signed by GoDaddy. That GoDaddy has, has, has checked the ID of Coursera and said, okay, you must be the CEO of Coursera or I'm not going give you this signed, private key. So, it's a process to get private keys signed and it's a way to make sure you are talking to who you think you're talking to. So, this is called digital certificates, also known as sort of signed private keys. Now if we go back and we talk about the integrity. Right? We want to know who we're talking about, and so we have this notion of a signature. A signature's a way that you know that you're talking to who you're talking to. So, for example, like if a guy comes to your office and says, hi, I'm Doctor Chuck, got like a beard and some white hair. You can say, hey, if you're really Doctor Chuck, show me your tattoo. And now you know, that very few people will look like this and have this tattoo. Right? So, this is my private key and this is my signature of my private key. This is like my message digest so, so people won't have this tattoo if they claim to be Doctor Chuck. So, this is Doctor Chuck, this is my message digest. So, there's a difference between a private key and a private key that's been certified by one of these designated third parties. These designated third parties are called certificate authorities. Now you could say, I'm a certificate authority, well some certificate authorities are more better certificate authorities than others, okay. So, they're a trusted third party. And so, how do they start, well, some are more trusted than others, and the more we trust them, they kind of all work out. So, it's not everybody, you can't become a trusted authority so one of the many trusted authorities. And one of the oldest ones and one of the more popular ones. And one of the more expensive ones. It's pretty expensive to get your certificate signed, it can be as inexpensive as a couple hundred dollars. It can be thousands of dollars to get a certificate signed. And their sign is one of the oldest and most well respected of the certificate authorities. So, the idea is, is that, I have this website called online.drchuck.com, where I teach Python classes and do various other things. And I wanted a secure certificate because I would be handling people's data. And I wanted to, to be respectable and have a secure certificate. So, I had a public and a private key and then I sent it to a certificate authority and I paid them money and then they send me back a signed private key, okay. So, this is a, now, now you might say, oh, this is kind of evil. Or, this is really expensive because all they really are doing is like, changing a few bits in the, in my private key or adding a few bits to my private key. But they have a lot of responsibility, and the good ones have a lot of credibility. So, they don't want to lose information. They gotta spend some time validating identity, saying okay are you really the owner of drchuck.com. They're not going to hand a certificate, a signed certificate for drchuck.com to anybody, except the true owner, and so they spend some time. Checking to make sure that it's the true owner, and they do this by looking at the registration data at drchuck.com, et cetera et cetera. So, there is a cost of verifying all this identity, kind of like signature track on Coursera. And that's kind of what's going on on signature track of Coursera. There's a difference between a certificate and a certificate that Coursera is going to assert, that we have verified the identity. And the cost is in the verification of the identity. So, certificate authorities are charging Amazon. But then ensuring that they don't mistakenly give the Amazon.com certificate, to a random bad guy because if they did. That bad guy could pretend to be Amazon.com. So then you might ask, who decides which of the certificate authorities to trust? We use the certificate authorities to decide whether or not to trust Amazon.com or Coursera.org or drchuck.com or whatever. How do we decide which of the certificate authorities we're going to trust? Well, it turns out that Apple, Microsoft, and Linux and other operating system vendors. Pre-install at the moment that you're either purchasing your computer or installing your operating system. Part of that operating system is actually a list of the public keys of the chosen certificate authority. So, if you look deep enough inside your computer. This is my Mac, you can see the companies that have been included by Apple as the manufacturer of the operating system. And so you see that Verisign is one of those companies that has been pre-included in Apple Macintosh. Which means that a certificate from Verisign is going to be known, right? So, let's, so let's look a li, a little bit more. So, so these come, your browsers and your operating systems come with pre built in public key certificates for certain certificate authorities like Verisign. Now that's a lot of trust that Apple, Microsoft, and Linux have placed in Verisign. And that's because over the years Verisign has earned that trust. It says, Verisign doesn't just give out certificates without checking, right. If Verisign gave out an amazon.com certificate to somebody without checking, they would lose a lot of credibility. And then Microsoft would like, take them out, right, say, well, Verisign seems to be kind of sleazy, they seem not to be able to to handle their security, but they have. So, they remain in there, and it's kind of an interesting thing where they are motivated to keep their security high. They are motivated to do a good job because the moment that they fail, they lose a lot of credibility and respect. Their value, the Verisign brand is all the respect we have for Verisign. So, so, so, we mentioned public, private key encryption. We have the public key that goes across and I'm about to type my credit card in. And so, the problem now we're going to solve is, I'm, is this really Amazon's key? Is it really Amazon's public-key? I mean I'm, I got a public-key from the, across this connection I made to a server and it claims that it's amazon.com. But, do I believe that it says it's amazon.com? So, that's the integrity thing, that's the secure, that's the, do I believe it? Is it really got the Verisign tattoo in addition to the amazon.com that it, it's, it represents that it's amazon.com's public key. So, we can also use public keys to do signing. And, and basically Verisign has a public and private key for Verisign. The public key for Verisign is sitting in your browser right now. And they use, they do an encryption much like the message digest. They do an encryption of Amazon's certificate, and then sort of create a digest and then add that digest to it. So, the certificate says I'm Amazon.com, and later it says, oh yes, and Verisign signed this with Verisign's private key. Okay, so Verisign's private key is used to sign Amazon. This is probably easiest if I just show you sort of a video. Wait, oop, I'm going the wrong way, am I going the wrong way? What's going on here? I'm going the wrong way. Yeah, I'm going the wrong way. Okay. So, here we go, we're going backwards. Here's how it works. this is how Amazon gets a public key signed by Verisign. Right? So, in the beginning Verisign makes a public and a private key. Somewhere in a bunker, and they store the private key. And they'll, sometime you can read up on how many, how much effort they go to storing the private key and then they hand the public key to Apple. Microsoft and Linux and then they bundle that in with your laptop. So, your laptop that you buy, you walk out and you have a laptop and it's got public keys in it from the vendor. Now Amazon says, you know what, I'd like to do some commerce. And I would like to be able to use SSL and have a certified private key. So, then what Amazon does. Is Amazon inside of its servers generates a pair, a public-private key pair. So, this private key is not leaving Amazon servers. It takes a while, it takes minutes sometimes to generate the right random, sufficiently random public and private key. Like looking at all the large prime numbers and then picking one and then, bang, making a public and private key. Then what Amazon does at that point, is it transports its public key to Verisign. Now, during that transport, it might, eave might've seen it. But it's okay, because it's just, it's just a public key, right? So, it's just a public key and so it actually can be sent across the internet and it's most commonly sent across the internet. Like when I got the online.drchuck.com certificates, we just typed it in and sent it, because if you get a hold of the public key, all it means is you can encrypt. It doesn't mean you can decrypt. So, then what happens is inside of Verisign's servers, Verisign computes a message digest using its public, it, it, it, it's private key. Right? And then it adds basically a signature that says, oh, here's Amazon's public key that I received from Amazon, verified the identity of the person, and now I have signed it Mr. Verisign. I've signed it. And that of course is just like message digest-like information that is appended to the bits of the public key. Then that public key with signature is sent back. Bundled together and sent back to Amazon. And now Amazon has not just any old public key. It has a public key that says I am Amazon.com and Verisign is now asserting that I am really who I am. Now, an, an, again, so eve saw that one. Who cares? It's just a public key. There's nothing about the VeriSign private key, it never left the VeriSign servers. The signature is public information. You can, use the, the Verisign public key to verify that the signature is right. But you can't forge the signature. So Eve can look at that. Eve could look going this way, Eve can look that way. Eve gets nothing. Eve gets nothing. So, Amazon now has a signed, and certified private key. Then what happens, is sooner or later, many hours, many days, many months later, you decide on your laptop, remember this is you, opps. This is you, you want to buy some shoes, so you connect to Amazon.com with your browser, with an https connection. And then what happens is, Amazon sends you it's public key and Eve of course is eaves dropping all the time. Eve sees it goes by. It's worthless. Right? It's worthless because it's just the encryption key. It's not the decryption key. The fact that it's signed, it sees that but it can't do anything with that information. Now, within your laptop, within your laptop, you have from the vendor the Verisign public key, from Macintosh, or Apple, or whatever. So, you can look with this, oh, come back, you can look with this public key at that signature. And just like we did with the message digest before, we can go, Yep, that's good, that really had to have been signed by Verisign. And if your computer is really conservative, it can actually go check with Verisign, send it up and say hey, did you verify this?. And Verisign can verify it too, but you actually don't need to connect, because you have the public key. The only way that the, the you know, whatever that message digest could be right would be, is if Verisign, it's private key, was used to generate the message digest. Just like we do Santa in the other one. The Santa is really simple, but it's the same basic mechanism. This is verifiable that it came from this private key. Now, if somebody broke in and stole the private key, that's a different story. But if the private key is safe and secure, hasn't been compromised, the only way to generate that message digest is to be in possession of the private key. So, now you are in a position where you are in a good mood, right? You see an https, you can pop that little thing and say that was signed by Verisign. You can be assured that Verisign is asserting that that key came really, that public key came from Amazon. And now it is time to encrypt your Visa card and send it over encrypted connection to Amazon. Okay? Because you won't send your encrypted thing, your, your, your, you won't send it unless you believe that the https is proper. And your browser will pop-up a little pop-up and say, wait a sec, this certificate looks a little funky. It claims to be from Amazon.com, but it's not signed by one of the signatures that I believe in. So, you send your data, it is encrypted and Eve is watching, right? Eve is always watching, but because it's encrypted with a public key, unless Eve has supercomputers in a couple of months, there is nothing that Eve can do. And then of course, Amazon decrypts it using the private key. So, the private key comes in, and let me redo that. Alright, so in it comes. Eve watches, but it's helpless because they don't have enough computers. Eve doesn't have enough computers an your key is large enough. So, Amazon, then takes this private key, an uses that to decrypt it, an ends up with your plain text again. So, if you think this whole thing through, this, Eve was watching the whole time. We sent a public key. We signed and returned a public key. Then we sent the public key to your laptop. We verified the public key. And the whole time Eve is sort of watching all this information and she is powerless to break it. Pretty dang clever, if you ask me. And we can thank Diffy, Helmon and Merkel for that. Pretty darn clever. Because Eve sees it all. Just think what would happened if like, the Germans had this in World War II. It would've been pretty cool. Course, they didn't have computers, so, it'd have been difficult. I don't know. Too much to think about right now, okay. Continuing on. So, what we have, is we have this thing called the certificate authority which is a trusted, third-party that signs these certificates, right? And so it's the entity that issues digital signatures on public keys. So, that we the public have a way of validating that an Amazon.com certificate really came from Amazon.com. So, if you then add this all together, right? If you add this all together, we have basic public, private key encryption. That make sure that, this data can move across the internet, out of your computer, out, back into the next one, all encrypted. That's just public private that does that. An then we have this third party, certificate authority, that your application, can use, to validate the certificate, that comes out. An so, the combination of SSL, or the Secure Sockets Layer. And the certificate authority gives us high confidence, that when we're talking to something we know we're really talking to it. So, it's pretty non intrusive security. If your browser pops up with a little popup message, that means it's got a certificate that it has no certificate of authority to validate. And that's not a good time to be typing in sensitive information, unless you know exactly what's going on. So, that sort of brings us to the conclusion of this, these last couple of lectures have been about message confidentially. And that's protecting the contents from being revealed. We use encrypting and decrypting for that. And then we have message digest. And, sur, to sign things. We've signed messages, we've signed certificates, we've signed many things, and those are important. And we talked about both sort of, shared key, and secret key, where you have to get together. And agree on a key which is a symmetric key that's used for encrypting and decrypting. And then you have the public private key which is the asymmetric. Which is one key is used for encrypting and the other key is used for decrypting. And you can freely show the encrypting key because it gives very little information. Although, it is mathematically possible, but difficult to decrypt public private key message. So, that kinds of suns up, kind of sums up our lecture on public private keys and I hope you find it valuable. See you on the net.