0% found this document useful (0 votes)
42 views2 pages

Digital Signatures Lab

This lab teaches how to digitally sign a document using OpenSSL, covering the generation of private and public keys, creating a document, generating a digital signature, and verifying that signature. Steps include using the command prompt to create keys and sign a text document. The process ensures document integrity by allowing verification of the signature against the public key.

Uploaded by

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

Digital Signatures Lab

This lab teaches how to digitally sign a document using OpenSSL, covering the generation of private and public keys, creating a document, generating a digital signature, and verifying that signature. Steps include using the command prompt to create keys and sign a text document. The process ensures document integrity by allowing verification of the signature against the public key.

Uploaded by

kenwestzm
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Lab: Digitally Signing a Document Using

OpenSSL
Objective
In this lab, you will learn how to:
1. Generate a private key.
2. Generate a public key.
3. Create a document to sign.
4. Generate a digital signature using OpenSSL.
5. Verify the digital signature.

Step 1: Open the Command Prompt (CMD)


1. Press Win + R, type cmd, and hit Enter.

2. Navigate to the Desktop (assuming students will create and sign a document there):
cd %USERPROFILE%\Desktop

Step 2: Generate a Private Key


A private key is required to sign the document. Run the following command:
openssl genpkey -algorithm RSA -out private_key.pem

• This creates a private_key.pem file on the Desktop.


• This key should be kept secret.

Step 3: Generate a Public Key


A public key is required to verify the signature. Extract the public key from the private key
openssl rsa -in private_key.pem -pubout -out public_key.pem

• This creates a public_key.pem file on the Desktop.


• This key can be shared publicly.
Step 4: Create a Document to Sign
Create a simple text file using Notepad:
1. Open Notepad.
2. Type some text, e.g.
This is my important document that I want to sign.

3. Save it as document.txt on the Desktop.


Alternatively, create it directly in CMD:
echo This is my important document that I want to sign. > document.txt

Step 5: Generate a Digital Signature


To sign the document, use the private key:
openssl dgst -sha256 -sign private_key.pem -out signature.bin document.txt

• The signature.bin file is generated.


• This is the digital signature of the document.

Step 6: Verify the Digital Signature


To verify that the document has not been altered:
openssl dgst -sha256 -verify public_key.pem -signature signature.bin
document.txt

• If the document is unchanged, OpenSSL will confirm:


nginx
CopyEdit
Verified OK

• If the document was altered, OpenSSL will report an error.

You might also like