The presentation layer is about HTTP compression using gzip, deflate, br, and TLS for creating secure connections between two hosts. Layer 6 is loaded with encoders/decoders, byte order format tools, data standard systems allowing communication across disparate operating systems, hardware architectures, developer languages, and syntax methodologies. We have MIME/SMIME, the amazing encoders for email. Layer 6 is often described in vague terms that aren't helpful for IT students or IT professionals to understand what takes place at Layer 6.
Hello and my name is Lowell Vanderpool and this channel is dedicated to IT professionals,
IT students, and anyone who's interested in technical subjects. Welcome back to our study
of the OSI model. We are now on layer six. We have just touched on just a little bit of what
can be explored and learned about our network stack. We have mentioned before in our study of
the OSI compared to the internet model, the internet model does not recognize layer five,
six, and seven. And in reality, there are many real life protocols that exist that is hard to
tell. Are they in five? Are they in six? Are they in seven? Or they could function in all three of
those layers. So there is real validity to that internet model. No one is arguing that.
That being said, there are still some protocols we use every day that fit perfectly
in the description of OSI layer, presentation layer, layer six. Things like anytime we get
into encoding and decoding, we're taking the byte order or the bit order or the syntax and the way
you manage data and translating that or encryption. We're going to look at TLS,
which is the de facto standard for connecting to secure websites. We're going to look at
compression used in HTTP. So there's a lot of things that are being used every day. We're
going to look at those practical protocols that fit perfectly in layer six. Let's come back to
this slide because it really is a great presentation of what's going on at layer six.
There is translation and you'll notice you have text encoding. We see ASCII and Unicode. We'll
see byte order, bit order. We're going to look at data stream, file syntax. This is all going to be
very important part of what's happening at layer six. There's also encryption. This is where TLS
is going to come in. The only thing that's missing here would be compression. Let's take a look at an
example of coded information that has to be converted or modified and it happens at layer six.
Now our first example is going to be Universal Coded Character Set Transformation Format. Wow,
mouthful. Its acronym is UTF. When we look at all the languages that there are, the standard
bodies had to come up with a way of representing Chinese and French, English, all of these
languages and their alphabets and characters and things that are unique to that language
in some kind of agreed binary format and that is where UTF standard came in. Now there are many of
them. There's UTF-16, UTF-8 and they all do the same thing except they're slightly different.
They all represent languages of the world, alphabetical characters, numbers, unique symbols
for that language and it represents in a standard. So that's a great thing. So no matter what language
I'm dealing with where it's Chinese or Japanese or whatever, I can come up with a standard so that
a binary number represents that character of that particular language. So if I'm on Windows Server
and Microsoft shows UTF-16, this is a character code scheme that it uses for the Windows operating
system, whether you're Windows 10 or the server. So if I develop an application and I'm creating
data and creating text and creating all this information, I'm using UTF-16. It just so happens
this server also wants to serve web pages to various people on the internet and the internet,
the World Wide Web, uses UTF-8 or HTTP uses UTF-8, which is different than UTF-16. So guess what?
Before it leaves my server, the program has to be able to call an API to say, hey, we're getting
ready to send this to a macOS browser. Someone running Safari is going to be running HTML and
we need to convert from Windows UTF-16 to the HTTP standard, which is UTF-8. How does that happen?
Well, it's really, really simple. The application calls an API and that API on Windows will actually
do the conversion from UTF-16 to UTF-8 and send it across the network. This is true of Linux, Mac,
Android. They all have APIs, libraries of tools and utilities for the developer. The developer
on Windows doesn't have to worry about a converter. It has API libraries that it can call
on Windows and say, I need this conversion to happen. If I open up my Windows directory, I'm
going to go to C drive. I'm going to go to Windows. I'm going to slide down to system 32 and I'm going
to go over here to the search and I'm going to type in star dot DLL and I'm going to call up
all the DLLs in the system 32 directory. And if you look at the bottom of Explorer,
it shows that there are over 4,463 DLLs. If you know anything about DLLs, they are the foundation
that runs Windows and the rich library and API sets that are available for developers. Developers
don't have to develop a converter from UTF-16 to UTF-8. It's all built into the operating system.
And where is that API? That API is at layer 6. We've looked at just one purpose for presentation
layer, layer 6, to translate information from one scheme into another scheme. There are many more.
So back to our slide, Windows 10, .NET, Python languages use the character encoding scheme
called UTF-16 and it represents those letters, numbers, and all kinds of characters for all
the languages you need to represent. But 95% of websites, including Java programming, use UTF-8.
So there again, there has to be that constant changing of the data's format from one standard
to another. You can imagine it going to mobile platform, mobile apps, to Linux boxes, to webpages,
to you can see a lot of converting has to go on. Another one is called the ANS.1. It's a standard
used by crypto certificate authorities, mobile standards like GSM and LTE for serializing and
deserializing data across many platforms. What does that mean? I have an application I wrote
and I use the language C to write that application on my Windows server. And I'm managing data and
structuring data a certain way because I'm using C language to create the application. I'm running
on an Intel processor and there are certain rules and restrictions that apply. But I ultimately want
to transfer this data that is running in this application to a new Mac user who's just got his
brand new Mac that's ARM based, that uses none of the structure syntax that I use on the Windows
platform. How do I get that data that runs fine on Windows server to the Mac user who's using an
ARM processor? So there's where we're going to take whatever is used on Windows and convert it
to a standard. In this case, we're just using this as an example, ANS.1. If I'm only dealing with one
PC, one CPU architecture, one operating system, I don't need a lot of converting of data except maybe
to display it on a screen or to print out on a printer. But the minute I take that same PC, plug
it to the internet, now it's talking to all these different operating systems, CPU architectures,
languages written for different platforms. Now we have to stop and look at standards so that we can
send information across the network and people can communicate. So let's look at one more example of
this problem and we'll see, begin to see the significance of Layer 6. There were some super
bright engineers that came up with the idea that saying if we're going to store a number, a binary
number, we're going to take the first byte of that number and we're going to store it first. And they
call that system Big Indian. Don't go there. Hang on. Stay with me. And then they take the next byte
of that number and they store it next. Well, there was another super group of engineers, just as smart
as the first group. And they said, you know what? We're going to take the least significant digit
byte of that number and we're going to store it first. And we're going to call it Little Indian.
You can see where this one's going. So if I've got a platform that is Big Indian, all of its numbers
are stored that way. And then I have another platform that is Little Indian. We've got a
problem. Layer 6. Mr. Vanderpool, it can't be this complicated. Well, let's take a look. The internet
has established the standard of network byte order, which happens to be Big Indian. The x86,
the AMD64 use the Little Indian format, of course. TIFF images, those graphic files, often have
headers and instruct applications about what Indianess their internal binary integers are done
in. So if a file in a TIFF begins with a signature MM, it means that the integers within the file
represent Big Indian. If that same signature is II, it means Little Indian. And just to throw in
for good measure, if you use the server message block protocol, it uses the Little Indian system.
All that said, Layer 6 is really important. We talked extensively about translation. We're going
to get into encryption. But one missing piece here is the compression. So let's take a quick
look at that. HTTP compresses data moving from the server to the client to speed up data transfer.
HTTP compression uses public domain compression algorithms like gzip or deflate, there's others,
to compress XHTML, Java, CSS, and other types of text files on the server to the client. Well,
the client then recognizes those compressed files and then must uncompress them, calling for some
APIs, pulling that uncompressed engine up, and decompressing those files. So here I've launched
Brave, and I'm at google.com. I'm going to hit the F12 keystroke, which pulls down my developer.
This is true for any browser. Hit F12, you get the developer tools. I'm going to come up here to
network, and I am then going to refresh this. And you can see it pulls down and shows me what's
going on here. I can see I went to a host called www.google.com. I'm going to choose the header
tab right here, and I'm going to scroll through this header. I can see that I'm using content
encoding called BR. I'm going to scroll down here, and I can see that the Google site uses a number
of compression algorithms, gzip, deflate, and BR. So here's where we can see those algorithms, and
it's up to the server to choose which one. So I've launched my, I'm back to Brave, and I'm going to go
to bbc.com. Go ahead and launch that. Again, hit F12, pull up my developer tools. I'm going to go
to network. I'm going to refresh so I can see, and I'm going to scroll this up to bbc.com, and I'm
going to choose header, and I'm going to scroll down here, and I can see it's using gzip. I can
scroll down here further to see what kind of encoding that it uses, and it also uses gzip,
deflate, or BR. So those are all three open source algorithms for compression.
So I'm downloading files from bbc.com, and up through the network stack comes a gzip file.
As it gets to layer six, an API is called, which calls a function and says, hey, we need an
uncompression engine. I decided somewhere on Windows there's got to be a file to uncompress
these compressed files, so I did a search, and sure enough, gzip.dll pulls that into memory,
uncompresses the file, and off it goes to Chrome or Edge or Firefox or whatever browser you're
using. Pretty cool. We are going to begin a review quickly of some very popular layer six protocols.
The first one is TLS, and we're going to look at IMAP, which is related to email,
and then MIME, this very interesting encoding decoding tool. TLS is the new SSL protocol.
TLS allows us safe online secure connections to other hosts to do banking, access our credit card,
do our mortgage, enterprise applications, company payroll. About 76% of US online sites are
protected by TLS. So how do we set up a secure connection between two devices? You got it.
It's complicated. We start with asymmetrical keys. The Diffie-Hellman is a very popular method for
safely developing and exchanging keys over insecure channel like the internet. This scheme
actually makes calculations based on exceptionally large prime numbers. At some point in the
cryptological exchange, we're going to move to symmetrical keys to finally encrypt all the
webpage. I'm going to go through these steps quickly. So we start with step one. The session
begins with the client. This is the client saying hello, and we're going to provide protocol version,
random data, an optional session ID to resume, a list of cipher suites, a list of compression
methods, and a list of extensions. Here, I've actually used Wireshark to capture the connection
to CNN.com. You can see I start off with client hello. Step two, the server says hello back,
and it provides random data, session ID, cipher suite, selected compression method, and a list
of extensions. Here again, you see I've captured my connection to CNN, and you can see the server
hello. Third step, the server provides a certificate containing host name of the server,
public key, proof of a trusted third party, and here in Wireshark, I'm connecting to CNN,
and I captured that packet with a certificate. The server certificate uses the ASM.1 encoding scheme.
If you'll notice this list of certificate authorities, iDentrust has the largest share
of market for certificates. Step four, we actually do a server key exchange generation.
We actually create a complex set of numbers. Here you can see in Wireshark, I captured that
key exchange. Once the generation of the key in step four, then five, we actually move the key
exchange. The server wraps up its portion of the handshake and does a server hello done.
So now it's the turn of the client to generate its own exchange key. The client now does the
key exchange. The client now has all the information to calculate the encryption keys
that will be used on both sides. The client changed cipher spec, and finally the client
handshake finish. Now the server has enough information that it can calculate the encryption
key. Step 13 for the server is change the cipher spec. 14, we have the server handshake finish.
We now have the client application data, or it sends a data ping. The server responds with a
data pong. At that point, we're basically done. The handshake is complete. We now have a secure
connection between two hosts. The client can send the last and final one, the close notify,
when it wants to close the connection. If you're wondering how long does this take,
on a good network, you could probably complete this whole handshake process within about 170
milliseconds. When you're going to websites, you should check your certificate of authority.
Remember that certificate of authority is the company that plays a key role in verifying the
TLS system. So you can come up. I'm at bbc.com. You see the lock. I'm going to click on the lock.
You can see the certificate. It says it's valid. We're going to open it up, and I can see information
about who was a certificate of authority, and that was GlobalSign. I can also look at the details,
and I can see it's version 3. You want to make sure you're going to websites that have the
newest version of TLS. You don't want an older version, which could make you at risk. Because
encryption is very CPU intensive, most web farms will have some kind of TLS accelerator appliance
where they'll stuff a bunch of MathGo processors inside and relieve the web farm servers of the
encryption decryption. This one is a 1U rack. It runs about six grand and has about 150 gigabit
of application thorough put. TLS is not used just for websites, because we can also use it
for databases. This is an Oracle card, a crypto accelerator card for TLS, and it goes inside of
a server to allow TLS to be used to encrypt a database. How would you like to pay for this one?
Also, these certificate authorities give you a certificate depending on what you need it for.
You can get one as low as $399 a year, and there are some institutions that are paying over
a half a million dollars a year for their certificate. Another protocol that resides
at Layer 6 is the Internet Message Access Protocol, or IMAP. For you that do not deal
with enterprise mail, this is something that you may not be as comfortable with.
Most of the IT pros that deal with enterprise email are probably very comfortable with this,
because email is a big deal with enterprise. But we know that email servers use SMTP's protocol
to communicate and store their messages, and anytime a client needs to connect to an SMTP
server, your email server, it is going to use one or two protocols. One is POP3, and very popular
now is IMAP, the Internet Message Access Protocol. And that's what goes up, talks to the SMTP server,
pulls your mail down, sends mail up. There are advantages between POP3 and IMAP as the protocol
that goes up to the SMTP server, your email server, and pulls your mail down or delivers your mail up.
So I'm not going to go through all the details. It's on the slide. Most mobile phones are using
IMAP, so IMAP is growing in popularity. POP3 is kind of going away. In the early days of email
servers, they could only send ASCII text. There was no such thing as sending a picture, or a word
document, or a spreadsheet, or even using Russian, or some other non-standard language like Chinese
or Japanese. In the early days of email, a very clever encoding and decoding scheme called MIME
was developed. It was brilliant. It could take anything, a picture, a video, a Russian, Chinese,
anything, and convert it into ASCII text. So we could still use the SMTP protocol between mail
servers. We could send just about anything on the planet with our email, regardless whether
it was ASCII text or not. This functionality does reside at Layer 6.