0% found this document useful (0 votes)
12 views4 pages

LAB33

Uploaded by

manokashop
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views4 pages

LAB33

Uploaded by

manokashop
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 4

LAB3 : DIGITAL CERTIFICATES

REPORT

Submitted by:
Omar
Bengebara
Mohammed
Belkasri

Submitted to:
Professor Souad
Sadki
Objectives of the Lab

The primary objective of this lab is to understand and implement secure


communication between a client and a server using Java. This involves
generating a self-signed digital certificate, exporting it, and then
importing it into a truststore. The specific objectives include:

1. Understanding Digital Certificates: Learn about the role and


structure of digital certificates in securing communications over
networks.
2. Keytool Utility Mastery: Gain practical experience with the keytool
utility for generating key pairs, creating self-signed certificates, and
managing keystores and truststores.
3. Implementing Secure Socket Layer (SSL) Communication: Utilize
Java's SSL/TLS support to create a secure communication channel
between a server and a client, ensuring data confidentiality and
integrity.
4. Certificate Management: Learn how to export certificates from a
keystore and import them into a truststore, facilitating the trust
relationship between the server and the client.

Steps of the Lab

Step 1: Generate Keystore and Key Pair for the Server

 Use the keytool command to generate a new keystore named


serverkey.jks and a key pair with a self-signed certificate.
 Provide details such as the distinguished name, organizational unit,
organization name, city/locality, state/province, and country code
when prompted.
 The keystore password is set to omar123.

Step 2: Export the Server’s Certificate

 Export the server's certificate from serverkey.jks to a file named


serverCertificate.cer, ensuring that external entities (like a client) can
trust the server.
Step 3: Create and Import into the Client Truststore

 Create a truststore for the client named clientTruststore.jks.


 Import the server's certificate (serverCertificate.cer) into the client's
truststore, establishing trust in the server's certificate.

Step 4: Implement the Server and Client in Java

 Server Implementation: Create a Java application that initializes an


SSLServerSocket, loading the server’s keystore and waiting for client
connections. Upon receiving a connection, the server sends a greeting to
the client.
 Client Implementation: Develop a Java application that creates an
SSLSocket to connect to the server, using the client's truststore to
authenticate the server's certificate. The client then listens for the
server's greeting.

Step 5: Testing and Validation

 Compile and run the server application.


 Compile and run the client application in a separate terminal.
 Verify secure communication is established by checking for successful
message exchange between the server and the client.
SERVER
CODE

CLIENT
CODE

You might also like