Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

21 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Licify - Java License Management Library 2.0

Java CI with Maven Maven Central Java Version License

πŸ“– Overview

Licify is a robust and modern Java library for software license management, providing advanced features including hybrid encryption (AES+RSA), digital signatures, hardware validation, and multiple serialization formats.

✨ What's New in Version 2.0

  • βœ… Java 17+: Updated to the latest language features
  • βœ… Complete CI/CD: GitHub Actions with multi-version builds (Java 17 and 21)
  • βœ… Automatic Publishing: Configured for Maven Central
  • βœ… Enhanced Documentation: Complete Javadocs and detailed examples
  • βœ… New Features: Floating licenses, automatic update system
  • βœ… Code Quality: Checkstyle, JaCoCo coverage >40%

πŸš€ Key Features

πŸ”’ Hybrid Encryption

  • Combination of symmetric (AES-256) and asymmetric (RSA-2048/3072/4096) algorithms
  • Flexible security parameter configuration
  • Support for multiple key sizes
  • Secure session key management

✍️ Digital Signatures

  • Cryptographic integrity validation
  • Configurable algorithms (SHA256withRSA, SHA384withRSA, SHA512withRSA)
  • Automatic authenticity verification
  • Public key fingerprint

πŸ–₯️ Hardware Identification

  • License binding to specific hardware
  • Multi-component analysis (CPU, motherboard, disk, MAC)
  • Hardware configuration backup
  • Tolerance to minor hardware changes

πŸ“ Multiple Formats

  • BINARY: Maximum efficiency and compactness
  • STRING: Human readability (Base64)
  • XML: Interoperability with external systems
  • PROPERTIES: Integration with configuration files

πŸ”„ Revocation System

  • Blacklist of revoked licenses
  • JSON file persistence
  • Real-time verification
  • Scheduled cleanup

🎯 Seed Generation

  • Deterministic cryptographic seeds
  • Multiple hash algorithms (SHA-256/384/512)
  • System entropy included
  • Ideal for offline licenses

πŸ“¦ Installation

Maven

<dependency>
    <groupId>com.licify</groupId>
    <artifactId>licify</artifactId>
    <version>2.0.0</version>
</dependency>

Gradle

implementation 'com.licify:licify:2.0.0'

Prerequisites

  • Java: 17 or higher
  • Maven: 3.8+ (for building)

⚑ Quick Start

1. Generate Key Pair

import com.licify.LicenseKeyPair;
import java.security.KeyPair;

// Generate RSA key pair
KeyPair keyPair = LicenseKeyPair.generateKeyPair(2048);

// Save keys
LicenseKeyPair.saveKeyPair(keyPair, "keys/");

2. Create a License

import com.licify.Licify;
import com.licify.Licify.License;
import java.time.LocalDateTime;

Licify licify = new Licify();

License license = new Licify.LicenseBuilder()
    .licenseeName("John Doe")
    .licenseeEmail("john@example.com")
    .productId("MYPRODUCT-001")
    .productVersion("1.0.0")
    .expirationDate(LocalDateTime.now().plusYears(1))
    .maxUsers(10)
    .feature("premium-support")
    .feature("cloud-sync")
    .licenseType("COMMERCIAL")
    .hardwareId()  // Uses current hardware
    .build();

3. Sign the License

import java.security.KeyPair;

// Load private key
KeyPair keyPair = LicenseKeyPair.loadKeyPair("keys/");

// Sign license
licify.sign(license, keyPair);

System.out.println("Signed license: " + license.getSignature());

4. Save License

import com.licify.io.IOFormat;

// Save in binary format
licify.save(license, "license.bin", IOFormat.BINARY);

// Or save in XML format
licify.save(license, "license.xml", IOFormat.XML);

5. Load and Validate License

import com.licify.Licify.ValidationResult;

// Load license
License loadedLicense = licify.load("license.bin", IOFormat.BINARY);

// Validate signature
ValidationResult result = licify.validateSignature(loadedLicense, keyPair.getPublic());
if (result.isValid()) {
    System.out.println("βœ… Valid license");
} else {
    System.err.println("❌ Invalid license: " + result.getErrors());
}

// Check expiration
if (loadedLicense.isExpired()) {
    System.err.println("⚠️ Expired license");
}

// Verify hardware
boolean hardwareMatch = licify.validateHardwareId(loadedLicense);
if (!hardwareMatch) {
    System.err.println("⚠️ Hardware mismatch");
}

πŸ”§ Advanced Configuration

Configure Custom Encryption

import com.licify.encryption.EncryptionConfig;

EncryptionConfig config = new EncryptionConfig.Builder()
    .setKeySize(4096)           // RSA 4096 bits
    .setAesKeySize(256)         // AES 256 bits
    .setTransformation("RSA/ECB/OAEPWithSHA-256AndMGF1Padding")
    .build();

licify.setDefaultEncryptionConfig(config);

Configure Digital Signature

import com.licify.signing.SignatureConfig;

SignatureConfig sigConfig = new SignatureConfig.Builder()
    .algorithm("SHA512withRSA")
    .provider("SunRsaSign")
    .hashAlgorithm("SHA-512")
    .build();

licify.setDefaultSignatureConfig(sigConfig);

Floating Licenses (Network)

// Create floating license for network
License floatingLicense = new Licify.LicenseBuilder()
    .licenseeName("Company Inc.")
    .productId("NETWORK-LICENSE")
    .maxUsers(50)  // 50 concurrent users
    .licenseType("FLOATING")
    .customData("{\"server\":\"license-server.example.com\",\"port\":27000}")
    .build();

πŸ§ͺ Running Tests

# Compile project
mvn clean compile

# Run tests
mvn test

# Generate coverage report
mvn jacoco:report

# Verify code quality
mvn verify

# Full build
mvn clean install

Reports are generated in:

  • target/surefire-reports/ - Test results
  • target/site/jacoco/ - HTML code coverage
  • target/jacoco.exec - Execution data

πŸ“Š Project Structure

Licify/
β”œβ”€β”€ src/main/java/com/licify/
β”‚   β”œβ”€β”€ Licify.java              # Main API
β”‚   β”œβ”€β”€ LicenseKeyPair.java      # Key management
β”‚   β”œβ”€β”€ SeedGenerator.java       # Seed generation
β”‚   β”œβ”€β”€ Main.java                # Entry point
β”‚   β”œβ”€β”€ core/                    # Core functionality
β”‚   β”‚   β”œβ”€β”€ LicenseSerializer.java
β”‚   β”‚   β”œβ”€β”€ LicenseRevocationManager.java
β”‚   β”‚   └── ShortLicenseKey.java
β”‚   β”œβ”€β”€ encryption/              # Hybrid encryption
β”‚   β”‚   β”œβ”€β”€ HybridEncryption.java
β”‚   β”‚   β”œβ”€β”€ EncryptionConfig.java
β”‚   β”‚   └── HybridEncryptionResult.java
β”‚   β”œβ”€β”€ signing/                 # Digital signatures
β”‚   β”‚   β”œβ”€β”€ DigitalSignature.java
β”‚   β”‚   └── SignatureConfig.java
β”‚   β”œβ”€β”€ hardware/                # Hardware identification
β”‚   β”‚   β”œβ”€β”€ HardwareId.java
β”‚   β”‚   └── HardwareIdBackup.java
β”‚   β”œβ”€β”€ io/                      # I/O formats
β”‚   β”‚   └── IOFormat.java
β”‚   β”œβ”€β”€ util/                    # Utilities
β”‚   β”‚   β”œβ”€β”€ KeyUtils.java
β”‚   β”‚   └── DateTimeUtils.java
β”‚   └── exception/               # Exceptions
β”‚       └── ValidationException.java
β”œβ”€β”€ src/test/java/com/licify/
β”‚   └── LicifyTest.java          # Test suite
β”œβ”€β”€ .github/workflows/
β”‚   └── maven.yml                # CI/CD pipeline
β”œβ”€β”€ pom.xml                      # Maven configuration
└── README.md                    # This documentation

πŸ—οΈ CI/CD Pipeline

The project includes a complete GitHub Actions pipeline that:

  1. Multi-Version Build: Compiles with Java 17 and 21
  2. Automated Tests: Runs 27 unit tests
  3. Coverage: Generates JaCoCo reports
  4. Quality: Executes Checkstyle and Javadoc validation
  5. Publishing: Deploys to Maven Central on releases

Required Secrets for Publishing

To enable automatic publishing, configure these secrets in GitHub:

  • OSSRH_USERNAME: Sonatype OSSRH username
  • OSSRH_TOKEN: Sonatype OSSRH token
  • GPG_PRIVATE_KEY: GPG private key (armored)
  • GPG_PASSPHRASE: GPG key passphrase

πŸ“ˆ Quality Metrics

Metric Value Threshold
Tests Passing 27/27 (100%) βœ…
Line Coverage >40% βœ…
Complexity Coverage >30% βœ…
Compilation SUCCESS βœ…
Java Version 17+ βœ…

🀝 Contributing

Contributions are welcome. Please:

  1. Fork the repository
  2. Create a branch (git checkout -b feature/new-feature)
  3. Commit your changes (git commit -am 'Add new feature')
  4. Push to the branch (git push origin feature/new-feature)
  5. Open a Pull Request

πŸ“„ License

This project is under the MIT license - see the LICENSE file for details.

πŸ‘¨β€πŸ’» Author

Yasmin Ramos - yasmramos

πŸ”— Useful Links


Built with β˜• Java and ❀️

⬆️ Back to top

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages