A simple, secure command-line tool for generating RSA-signed license keys for desktop applications. This tool helps you create machine-specific licenses with customizable expiration dates.
This tool generates cryptographically signed license keys that:
- Are tied to a specific machine's MAC address
- Have a customizable validity period (in days)
- Use RSA signature verification to prevent tampering
- Can be validated offline by your desktop application
- Secure: Uses RSA-2048 encryption with SHA-256 signatures
- Machine-Specific: License keys are bound to MAC addresses
- Offline Validation: No internet connection required for verification
- Easy to Use: Simple command-line interface
- Organized: Automatically saves keys with timestamps
-
Key Generation (this tool):
- Takes MAC address and validity period as input
- Signs the data with a private key
- Generates a Base64-encoded license key
- Saves it to a timestamped file
-
Key Validation (your app):
- Uses the included JavaScript validation code
- Verifies the signature with the public key
- Checks MAC address match
- Tracks license expiration
- Rust (1.70 or later)
- Cargo (comes with Rust)
# Clone the repository
git clone <your-repo-url>
cd license-key-generator
# Build the project
cargo build --release
# The executable will be in target/release/# On macOS/Linux
./target/release/desktop-app-license-key-generator
# On Windows
target\release\desktop-app-license-key-generator.exe-
Run the application
-
Enter the MAC address of the target machine
- Example:
00:1B:44:11:3A:B7
- Example:
-
Enter the number of days the license should be valid
- Example:
365for one year
- Example:
-
Enter a machine name (optional)
- This is used for the filename
- Press Enter to use the MAC address as the name
-
Get your license key
- The key is displayed in the terminal
- Automatically saved to
License Keys/<name>_<timestamp>.txt
Desktop App License Key Generator
Enter MAC ID:
00:1B:44:11:3A:B7
Enter number of days:
365
Enter machine name (optional, press Enter to use MAC ID):
John-Laptop
License key saved to file: License Keys/John-Laptop_20251205143022.txt
License Key: <base64-encoded-license-key>
Press Enter to exit...
The js/main.js file contains a complete Node.js implementation for validating licenses in your application. Key functions:
saveLicense(licenseKey)- Save and validate a new licensevalidateLicense()- Check if the current license is validgetMacAddress()- Get the machine's MAC address
const { validateLicense, saveLicense } = require('./main');
// When user enters a license key
try {
saveLicense(userEnteredKey);
console.log('License activated successfully!');
} catch (error) {
console.log('Invalid license key');
}
// Check license on app startup
if (validateLicense()) {
// License is valid, start app
} else {
// License invalid or expired, show activation screen
}-
Generate your own RSA key pair:
# Generate private key openssl genrsa -out private_key.pem 2048 # Extract public key openssl rsa -in private_key.pem -pubout -out public_key.pem
-
Update the keys:
- Replace the
private_key_peminsrc/main.rs - Replace the
PUBLIC_KEYinjs/main.js
- Replace the
-
Keep your private key secure:
- Never share it publicly
- Store it in a secure location
- Consider using environment variables or secure vaults
license-key-generator/
├── src/
│ └── main.rs # Key generator (Rust)
├── js/
│ └── main.js # License validator (Node.js)
├── assets/
│ └── icon.ico # Application icon
├── License Keys/ # Generated keys saved here
├── Cargo.toml # Rust dependencies
└── README.md # You are here
License keys are Base64-encoded and contain:
- RSA signature of the MAC+days payload
- Validity period (in days)
Format: <signature>__<days>__
Contributions are welcome! Feel free to:
- Report bugs
- Suggest features
- Submit pull requests
This project is available as-is for personal and commercial use. Feel free to modify and adapt it to your needs.
If you have questions or run into issues, please open an issue on GitHub.
Made with ❤️ for developers who need simple, secure licensing for their desktop apps.