https://github.com/shaina-gh/dss
Java implementation of the Digital Signature Standard (DSS) for message integrity and authenticity verification.
https://github.com/shaina-gh/dss
cryptography cryptography-algorithms digital-signature-algorithm digital-signature-authentication dss java signature-verification
Last synced: 28 days ago
JSON representation
Java implementation of the Digital Signature Standard (DSS) for message integrity and authenticity verification.
- Host: GitHub
- URL: https://github.com/shaina-gh/dss
- Owner: shaina-gh
- Created: 2025-04-19T09:39:59.000Z (about 1 month ago)
- Default Branch: main
- Last Pushed: 2025-04-19T09:45:14.000Z (about 1 month ago)
- Last Synced: 2025-04-19T15:39:00.786Z (about 1 month ago)
- Topics: cryptography, cryptography-algorithms, digital-signature-algorithm, digital-signature-authentication, dss, java, signature-verification
- Language: Java
- Homepage:
- Size: 6.84 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# ๐ก๏ธ Digital Signature Standard (DSS) in Java
> Java implementation of the Digital Signature Standard (DSS) for message integrity and authenticity verification.
---
### Author: Shaina
---
## ๐ฏ Aim
To implement the Digital Signature Standard (DSS) to generate and verify digital signatures, ensuring the authenticity and integrity of communicated messages.
---
## โ๏ธ How It Works
The Digital Signature Standard is implemented in the following phases:
1. **Hashing the Message:**
- A custom hash function simulates a SHA-like hashing mechanism to generate a digest from the input message.2. **Key Generation:**
- Generate a private key `x`.
- Calculate the public key `y = g^x mod p`, where `g` is the generator.3. **Signature Generation:**
- Use the private key to compute the signature components `r` and `s` using a fixed ephemeral key `k`.
- These values are derived through modular exponentiation and inversion operations.4. **Signature Verification:**
- Using the public key, message hash, and the signature, the verifier computes a value `v`.
- The signature is valid if `v == r`.---
## ๐ Key Components
- `modularExponentiation`: Computes (base^exponent) mod modulus.
- `extendedEuclidean`: Finds GCD and the Bรฉzout coefficients for modular inverse.
- `findModularInverse`: Used for computing modular multiplicative inverses.
- `customHash`: A deterministic hash function simulating SHA behavior.
- `generateDSSKeys`: Generates the private and public keys.
- `createDigitalSignature`: Computes the digital signature for a message.
- `verifyDigitalSignature`: Validates the authenticity of the digital signature.---
## ๐ Steps to Run
1. **Clone the repo**
```bash
git clone https://github.com/shaina-gh/DSS.git
cd DSS
```2. **Compile and Run the Java File**
```bash
javac DSS.java
java DSS
```
3. **Expected Output**Signature creation and verification results for both an original and a tampered message.
---
## ๐งช Sample Output
``` yaml
Created Private Key: 3
Created Public Key: 18
Message Digest: 138972264302481705700123578240310737814155524
Ephemeral Value k: 1
Signature Component r
Signature Component s: 5
Verification Value v: 4
Signature Verification Result: True
Verification Value v: 1
Tampered Message Verification Result: False
```---
## ๐ Observation
Signature verification succeeds for valid, untampered messages.Signature verification fails for tampered messages, proving the integrity of DSS.
---
## โ Result
The DSS algorithm for digital signature generation and verification was successfully implemented in Java.---