strangerRidingCaml

6. Cryptographic Protocols 본문

Modern cryptography

6. Cryptographic Protocols

woddlwoddl 2024. 5. 6. 16:21
728x90
Cryptographic Protocols

Cryptographic Protocols

Secure Communication Protocols

  • SSL/TLS (Secure Sockets Layer/Transport Layer Security): Protocols used to provide secure communication over a network, typically between a web server and a web browser.

Key Establishment Protocols

  • IKE (Internet Key Exchange): Protocol used to establish a shared security association (SA) between two parties, commonly used in IPsec VPNs.
  • Kerberos: A network authentication protocol designed to provide strong authentication for client/server applications by using secret-key cryptography.

Authentication Protocols

  • OAuth (Open Authorization): An open standard for access delegation, commonly used as a way for Internet users to grant websites or applications access to their information on other websites but without giving them the passwords.
  • OpenID: An open standard and decentralized authentication protocol that enables users to be authenticated by co-operating sites using a third-party service.

Laboratory Activities

Lab 1: SSL/TLS Communication in Python using OpenSSL


import socket
import ssl

hostname = 'www.example.com'
port = 443

context = ssl.create_default_context()

with socket.create_connection((hostname, port)) as sock:
    with context.wrap_socket(sock, server_hostname=hostname) as ssock:
        print("Server Certificate:", ssock.getpeercert())
        ssock.sendall(b'GET / HTTP/1.1\r\nHost: ' + hostname.encode() + b'\r\n\r\n')
        response = ssock.recv(4096)
        print("Response from Server:", response.decode())

This lab demonstrates establishing a secure connection to a server using SSL/TLS in Python.

Lab 2: Kerberos Authentication in Python


from pykrb5 import krb5

def kerberos_authenticate(principal, password, service):
    context = krb5.Context()
    ccache = context.default_ccache()
    ccache.init(principal)
    creds = ccache.get_init_creds_password(password)
    service_principal = context.build_principal(service)
    ticket = creds.get_service_ticket(service_principal)
    return ticket

user = 'alice@EXAMPLE.COM'
password = 'password'
service = 'HTTP/server.example.com'

ticket = kerberos_authenticate(user, password, service)
print("Service Ticket:", ticket)

This lab demonstrates Kerberos authentication in Python.