160 likes | 532 Views
Binhe Ye. HTTP/ ssl. HTTP ( Hypertext transfer protocol) 1. Hypertext is a structured text 2. HTTP functions as a request-response protocol in the client-server computing model. 3. HTTP is an application layer protocol.
E N D
Binhe Ye HTTP/ssl
HTTP ( Hypertext transfer protocol) 1. Hypertext is a structured text 2. HTTP functions as a request-response protocol in the client-server computing model. 3. HTTP is an application layer protocol. 4.HTTP can use both reliable and unreliable transport layer protocols
HTTP defines methods (sometimes referred to as verbs) to indicate the desired action to be performed on the identified resource. 1. GET It requests a representation of the specified resource. The requests using GET only retrieve data and have no other effects 2. HEAD Asks for the response correspond to a GET request, but without the response body. HTTP Methods
3. POST Requests that the server accept the entity enclosed in the request as a new subordinate of the web resource identified by the URI In later version of HTTP, some new methods are added such as OPTIONS, PUT, DELETE, TRACE and CONNECT. HTTP Methods
Request message The request message consists of the following: 1. A request line 2. Request Headers 3. An empty line 4. An optional message body Example: GET /index.html HTTP/1.1 Host: www.example.com Request-response
Response message The response message consists of the following: 1. A Status-Line 2. Response Headers 3. An empty line 4. An optional message body Request-response
Response example HTTP/1.1 200 OK Date: Mon, 31 Mar 2014 22:38:34 GMT Content-Type: text/html; charset=UTF-8 Content-Length: 131 <html> <head> <title>An Example Page</title> </head> <body> Hello World, this is a very simple HTML document. </body> </html> Request-response
SSL Secure Sockets Layer 1. SSL is a cryptographic protocol which is designed to provide communication security over the Internet. 2. SSL is initialized at the session layer, then works at the presentation layer. 3. SSL uses a handshaking procedure. SSL
HTTP/SSL 1. HTTPS is the result of simply layering the HTTP on top of the SSL/TLS protocol, thus adding the security capabilities of SSL/TLS to standard HTTP communications. 2. The security of HTTPS is therefore that of the underlying SSL/TLS, which uses long term public and secret keys to exchange a short term session key to encrypt the data flow between client and server. https
SSL handshake 1. The client sends the server the client's SSL version number, cipher settings, session-specific data that the server needs to communicate with the client using SSL. 2. The server sends the client the server's SSL version number, cipher settings, and other information that the client needs to communicate with the server over SSL. The server also sends its own certificate, if the client is requesting a server resource, the server requests the client's certificate 3. The client uses the information sent by the server to authenticate the server 4. The client creates the pre-master secret for the session, encrypts it with the server's public key, and then sends the encrypted pre-master secret to the server. ssl
5. The server authenticates the client. If the client cannot be authenticated, the session ends. If the client can be successfully authenticated, the server uses its private key to decrypt the pre-master secret, and then generate the master secret. 6. Both the client and the server use the master secret to generate the session keys, which are symmetric keys used to encrypt and decrypt information . 7. The client sends a message to the server informing it that future messages from the client will be encrypted with the session key. It then sends a separate (encrypted) message indicating that the client portion of the handshake is finished. 8. The server sends a message to the client informing it that future messages from the server will be encrypted with the session key. It then sends a separate (encrypted) message indicating that the server portion of the handshake is finished. SSL
Encryption algorithm 1. RSA is an encryption algorithm, it’s based on the difficulty of factoring the product of two large prime numbers. 2. It’s easy to calculate the multiplication 521*379=197459 However 197459= ? * ? rsa
RSA algorithm 1. Choose two distinct prime numbers p and q. (random and large) 2. n=p*q. 3. Compute φ(n) = φ(p)φ(q) = (p − 1)(q − 1). 4. Choose an integer e such that 1 < e < φ(n) and gcd(e, φ(n)) = 1. 5. Determine d as d ≡ (mod φ(n)) RSA
RSA algorithm Encryption: c = ( mod n) Decryption: m= ( mod n ) m is the message, c is the cipher RSA
Exercise p=2 , q=5. Calculate the private key d and public key e. RSA