Certificates are used to bind a domain name (e.g. https://google.com) to an entity (Google, the company). A certificate authority (CA) is a trusted third-party that verifies that an entity controls access to its website. When you access a website on a browser, your browser checks for a valid TLS certificate. If one is unavailable or expired, it informs users that the connection is not safe. In this assignment, you will implement a part of this functionality.
1.2 Starter Code class TLSCertificateGrabber: # The hostname and port you are connecting to. def __init__(self, hostname, port):
pass
# This will be an
<OpenSSL.SSL.Connection object> def connect_and_handshake(self) -> SSL.Connection:
pass
# This will be an <OpenSSL.crypto.X509 object> def get_certificate(self, ssl_sock: SSL.Connection) -> crypto.X509: pass
# Format: “YYYYMMDDHHMMSSZ” (ASN.1 GeneralizedTime format) def get_validity_start(self, cert: crypto.X509) -> str:
pass
# Format: “YYYYMMDDHHMMSSZ” (ASN.1 GeneralizedTime format) def get_validity_end(self, cert: crypto.X509) -> str:
pass
# We only want the issuer’s common name (CN)
# E.g. if the Certificate Authority’s Distinguished Name
# in string format is “/C=US/O=Let’s Encrypt/CN=R3”, # return “R3” def get_certificate_authority(self, cert:
crypto.X509) -> str: pass
# Format: a PEM-encoded string, such as
# “—–BEGIN PUBLIC KEY—–
MIIBIjANBgkh…QIDAQAB
—–END PUBLIC KEY—–
” def get_public_key(self, cert: crypto.X509) -> str:
pass
# Ensure the function returns the existing values in # the original order def dump_certificate(self) -> (crypto.X509, str, str, str, str): ssl_sock = self.connect_and_handshake() cert = self.get_certificate(ssl_sock) not_before = self.get_validity_start(cert)
not_after = self.get_validity_end(cert) issuer = self.get_certificate_authority(cert) public_key = self.get_public_key(cert) return cert, issuer, not_before, not_after, public_key
# For your own testing if __name__ == “__main__”:
service =
TLSCertificateGrabber(“cs6262.gtisc.gatech.edu”, 443) response = service.dump_certificate() import pprint pprint.pprint(respo nse)

![[SOLVED] Cs6262 project 2 -network security, fall2025](https://assignmentchef.com/wp-content/uploads/2022/08/downloadzip.jpg)

![[SOLVED] L1094 Applied Finance Project Spring Term 2024/2025](https://assignmentchef.com/wp-content/uploads/2022/08/downloadzip-1200x1200.jpg)
Reviews
There are no reviews yet.