diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index a42e028..3096c02 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -1,31 +1,115 @@ -# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time -# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-maven - -# This workflow uses actions that are not certified by GitHub. -# They are provided by a third-party and are governed by -# separate terms of service, privacy policy, and support -# documentation. - name: Java CI with Maven on: push: - branches: [ "main" ] + branches: [ "main", "master", "develop" ] pull_request: - branches: [ "main" ] + branches: [ "main", "master", "develop" ] + release: + types: [created] jobs: build: + runs-on: ubuntu-latest + strategy: + matrix: + java-version: [17, 21] + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Set up JDK ${{ matrix.java-version }} + uses: actions/setup-java@v4 + with: + java-version: ${{ matrix.java-version }} + distribution: 'temurin' + cache: maven + + - name: Build with Maven + run: mvn -B clean compile --file pom.xml + + - name: Run tests + run: mvn -B test --file pom.xml + + - name: Upload test results + if: always() + uses: actions/upload-artifact@v4 + with: + name: test-results-java-${{ matrix.java-version }} + path: target/surefire-reports/ + + - name: Generate JaCoCo report + run: mvn -B jacoco:report --file pom.xml + + - name: Upload coverage report + uses: actions/upload-artifact@v4 + with: + name: jacoco-report-java-${{ matrix.java-version }} + path: target/site/jacoco/ + + - name: Verify code quality + run: mvn -B verify --file pom.xml + - name: Build JAR + run: mvn -B package --file pom.xml -DskipTests + + - name: Upload JAR artifact + uses: actions/upload-artifact@v4 + with: + name: licify-java-${{ matrix.java-version }} + path: target/*.jar + + code-quality: runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Set up JDK 17 + uses: actions/setup-java@v4 + with: + java-version: 17 + distribution: 'temurin' + cache: maven + + - name: Run Checkstyle + run: mvn -B checkstyle:check --file pom.xml + + - name: Run Javadoc generation + run: mvn -B javadoc:javadoc --file pom.xml + publish: + needs: [build, code-quality] + runs-on: ubuntu-latest + if: github.event_name == 'release' + steps: - - uses: actions/checkout@v4 + - name: Checkout repository + uses: actions/checkout@v4 + - name: Set up JDK 17 uses: actions/setup-java@v4 with: - java-version: '17' + java-version: 17 distribution: 'temurin' cache: maven - - name: Build with Maven - run: mvn -B package --file pom.xml + server-id: central + server-username: MAVEN_USERNAME + server-password: MAVEN_PASSWORD + gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }} + gpg-passphrase: GPG_PASSPHRASE + + - name: Publish to Maven Central + run: mvn -B release:prepare release:perform -Darguments=-Dgpg.passphrase=${{ secrets.GPG_PASSPHRASE }} + env: + MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }} + MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }} + GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} + + - name: Upload release artifacts + uses: actions/upload-artifact@v4 + with: + name: release-artifacts + path: target/*-sources.jar,target/*-javadoc.jar,target/*.jar diff --git a/.gitignore b/.gitignore index 031b03e..0bdd89b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,897 +1,65 @@ -# ============================================================================== -# COMPREHENSIVE .GITIGNORE TEMPLATE -# ============================================================================== -# This template covers most common development scenarios and tools -# Generated patterns use ** to match any subdirectory depth - -# ============================================================================== -# PYTHON -# ============================================================================== -**/__pycache__/ -**/*.py[cod] -**/*$py.class -**/*.so -**/.Python -**/build/ -**/develop-eggs/ -**/dist/ -**/downloads/ -**/eggs/ -**/.eggs/ -**/lib/ -**/lib64/ -**/parts/ -**/sdist/ -**/var/ -**/wheels/ -**/share/python-wheels/ -**/*.egg-info/ -**/.installed.cfg -**/*.egg -**/MANIFEST - -# PyInstaller -**/*.manifest -**/*.spec - -# Installer logs -**/pip-log.txt -**/pip-delete-this-directory.txt - -# Unit test / coverage reports -**/htmlcov/ -**/.tox/ -**/.nox/ -**/.coverage -**/.coverage.* -**/.cache -**/nosetests.xml -**/coverage.xml -**/*.cover -**/*.py,cover -**/.hypothesis/ -**/.pytest_cache/ -**/cover/ - -# Translations -**/*.mo -**/*.pot - -# Django stuff: -**/*.log -**/local_settings.py -**/db.sqlite3 -**/db.sqlite3-journal - -# Flask stuff: -**/instance/ -**/.webassets-cache - -# Scrapy stuff: -**/.scrapy - -# Sphinx documentation -**/docs/_build/ - -# PyBuilder -**/.pybuilder/ -**/target/ - -# Jupyter Notebook -**/.ipynb_checkpoints - -# IPython -**/profile_default/ -**/ipython_config.py - -# pyenv -**/.python-version - -# pipenv -**/Pipfile.lock - -# poetry -**/poetry.lock - -# pdm -**/.pdm.toml -**/.pdm-python -**/.pdm-build/ - -# PEP 582 -**/__pypackages__/ - -# Celery stuff -**/celerybeat-schedule -**/celerybeat.pid - -# SageMath parsed files -**/*.sage.py - -# Environments -**/.env -**/.venv -**/env/ -**/venv/ -**/ENV/ -**/env.bak/ -**/venv.bak/ - -# Spyder project settings -**/.spyderproject -**/.spyproject - -# Rope project settings -**/.ropeproject - -# mkdocs documentation -**/site/ - -# mypy -**/.mypy_cache/ -**/.dmypy.json -**/dmypy.json - -# Pyre type checker -**/.pyre/ - -# pytype static type analyzer -**/.pytype/ - -# Cython debug symbols -**/cython_debug/ - -# PyCharm -**/.idea/ - -# ============================================================================== -# NODE.JS / JAVASCRIPT / TYPESCRIPT -# ============================================================================== -**/node_modules/ -**/npm-debug.log* -**/yarn-debug.log* -**/yarn-error.log* -**/lerna-debug.log* -**/.pnpm-debug.log* - -# Runtime data -**/pids/ -**/*.pid -**/*.seed -**/*.pid.lock - -# Coverage directory used by tools like istanbul -**/coverage/ -**/.nyc_output - -# Grunt intermediate storage -**/.grunt - -# Bower dependency directory -**/bower_components - -# node-waf configuration -**/.lock-wscript - -# Compiled binary addons -**/build/Release - -# Dependency directories -**/jspm_packages/ - -# Snowpack dependency directory -**/web_modules/ - -# TypeScript cache -**/*.tsbuildinfo - -# Optional npm cache directory -**/.npm - -# Optional eslint cache -**/.eslintcache - -# Optional stylelint cache -**/.stylelintcache - -# Microbundle cache -**/.rpt2_cache/ -**/.rts2_cache_cjs/ -**/.rts2_cache_es/ -**/.rts2_cache_umd/ - -# Optional REPL history -**/.node_repl_history - -# Output of 'npm pack' -**/*.tgz - -# Yarn Integrity file -**/.yarn-integrity - -# dotenv environment variable files -**/.env -**/.env.development.local -**/.env.test.local -**/.env.production.local -**/.env.local - -# parcel-bundler cache -**/.cache -**/.parcel-cache - -# Next.js build output -**/.next -**/out/ - -# Nuxt.js build / generate output -**/.nuxt -**/dist - -# Gatsby files -**/.cache/ -**/public - -# Vue.js -**/dist/ -**/.tmp -**/.cache - -# Vuepress build output -**/.vuepress/dist - -# Serverless directories -**/.serverless/ - -# FuseBox cache -**/.fusebox/ - -# DynamoDB Local files -**/.dynamodb/ - -# TernJS port file -**/.tern-port - -# Stores VSCode versions used for testing VSCode extensions -**/.vscode-test - -# yarn v2 -**/.yarn/cache -**/.yarn/unplugged -**/.yarn/build-state.yml -**/.yarn/install-state.gz -**/.pnp.* - -# Storybook -**/.storybook-out -**/storybook-static - -# Angular -**/e2e/ -**/.angular/ - -# React Native -**/ios/Pods/ -**/android/app/build/ - -# Expo -**/.expo/ -**/dist/ -**/npm-debug.* -**/yarn-error.* -**/.expo-shared - -# ============================================================================== -# JAVA -# ============================================================================== -**/*.class -**/*.log -**/*.ctxt -**/.mtj.tmp/ -**/*.jar -**/*.war -**/*.nar -**/*.ear -**/*.zip -**/*.tar.gz -**/*.rar -**/hs_err_pid* -**/replay_pid* - -# Maven -**/target/ -**/pom.xml.tag -**/pom.xml.releaseBackup -**/pom.xml.versionsBackup -**/pom.xml.next -**/release.properties -**/dependency-reduced-pom.xml -**/buildNumber.properties -**/.mvn/timing.properties -**/.mvn/wrapper/maven-wrapper.jar - -# Gradle -**/.gradle/ -**/build/ -**/.gradletasknamecache -**/gradle-app.setting - -# IntelliJ IDEA -**/.idea/ -**/*.iws -**/*.iml -**/*.ipr -**/out/ - -# Eclipse -**/.apt_generated -**/.classpath -**/.factorypath -**/.project -**/.settings -**/.springBeans -**/.sts4-cache -**/bin/ -**/tmp/ -**/*.tmp -**/*.bak -**/*.swp -**/*~.nib -**/local.properties -**/.metadata -**/.loadpath -**/.recommenders - -# NetBeans -**/nbproject/private/ -**/.nbbuild/ -**/dist/ -**/nbdist/ -**/.nb-gradle/ - -# VS Code -**/.vscode/ - -# ============================================================================== -# C / C++ -# ============================================================================== -# Prerequisites -**/*.d - -# Object files -**/*.o -**/*.ko -**/*.obj -**/*.elf - -# Linker output -**/*.ilk -**/*.map -**/*.exp - -# Precompiled Headers -**/*.gch -**/*.pch - -# Libraries -**/*.lib -**/*.a -**/*.la -**/*.lo - -# Shared objects (inc. Windows DLLs) -**/*.dll -**/*.so -**/*.so.* -**/*.dylib - -# Executables -**/*.exe -**/*.out -**/*.app -**/*.i*86 -**/*.x86_64 -**/*.hex - -# Debug files -**/*.dSYM/ -**/*.su -**/*.idb -**/*.pdb - -# Kernel Module Compile Results -**/*.mod* -**/*.cmd -**/.tmp_versions/ -**/modules.order -**/Module.symvers -**/Mkfile.old -**/dkms.conf - -# CMake -**/CMakeLists.txt.user -**/CMakeCache.txt -**/CMakeFiles -**/CMakeScripts -**/Testing -**/Makefile -**/cmake_install.cmake -**/install_manifest.txt -**/compile_commands.json -**/CTestTestfile.cmake -**/_deps - -# Conan -**/conanfile.txt -**/conandata.yml -**/conan.lock -**/.conan/ - -# ============================================================================== -# C# / .NET -# ============================================================================== -**/bin/ -**/obj/ -**/out/ -**/*.user -**/*.suo -**/*.sln.docstates -**/*.userprefs -**/*.pidb -**/*.booproj -**/.vs/ -**/packages/ -**/TestResults/ -**/*.Cache -**/ClientBin/ -**/*_i.c -**/*_p.c -**/*_h.h -**/*.ilk -**/*.meta -**/*.obj -**/*.iobj -**/*.pch -**/*.pdb -**/*.ipdb -**/*.pgc -**/*.pgd -**/*.rsp -**/*.sbr -**/*.tlb -**/*.tli -**/*.tlh -**/*.tmp -**/*.tmp_proj -**/*_wpftmp.csproj -**/*.log -**/*.vspscc -**/*.vssscc -**/.builds -**/*.pidb -**/*.svclog -**/*.scc - -# ============================================================================== -# GO -# ============================================================================== -# Binaries for programs and plugins -**/*.exe -**/*.exe~ -**/*.dll -**/*.so -**/*.dylib - -# Test binary, built with `go test -c` -**/*.test - -# Output of the go coverage tool -**/*.out - -# Dependency directories -**/vendor/ - -# Go workspace file -**/go.work - -# ============================================================================== -# RUST -# ============================================================================== -# Generated by Cargo -**/target/ - -# Remove Cargo.lock from gitignore if creating an executable -# Cargo.lock - -# These are backup files generated by rustfmt -**/*.rs.bk - -# MSVC Windows builds of rustc -**/*.pdb - -# ============================================================================== -# PHP -# ============================================================================== -**/vendor/ -**/node_modules/ -**/npm-debug.log -**/yarn-error.log - -# Laravel specific -**/.env -**/storage/*.key -**/Homestead.yaml -**/Homestead.json -**/.vagrant -**/.phpunit.result.cache - -# Symfony specific -**/.env.local -**/.env.local.php -**/.env.*.local -**/config/secrets/prod/prod.decrypt.private.php -**/public/bundles/ -**/var/ -**/vendor/ - -# Composer -**/composer.phar -**/composer.lock - -# ============================================================================== -# RUBY -# ============================================================================== -**/*.gem -**/*.rbc -**/.config -**/coverage/ -**/InstalledFiles -**/pkg/ -**/spec/reports/ -**/spec/examples.txt -**/test/tmp/ -**/test/version_tmp/ -**/tmp/ -**/.yardoc/ -**/_yardoc/ -**/doc/ -**/.bundle/ -**/vendor/bundle -**/lib/bundler/man/ -**/.rbenv-version -**/.rvmrc -**/.ruby-version -**/.ruby-gemset -**/Gemfile.lock - -# Rails -**/log/ -**/tmp/ -**/db/*.sqlite3 -**/db/*.sqlite3-journal -**/db/*.sqlite3-* -**/public/system/ -**/coverage/ -**/spec/tmp/ -**/.sass-cache/ -**/capybara-*.html -**/.rspec -**/.generators -**/.rakeTasks - -# ============================================================================== -# DATABASES -# ============================================================================== -**/*.db -**/*.sqlite -**/*.sqlite3 -**/*.db-shm -**/*.db-wal - -# MySQL -**/mysql-bin.* - -# PostgreSQL -**/*.backup -**/*.sql - -# MongoDB -**/dump/ - -# Redis -**/dump.rdb - -# ============================================================================== -# DEVOPS & CONTAINERS -# ============================================================================== -# Docker -**/Dockerfile* -**/.dockerignore -**/docker-compose*.yml -**/.docker/ - -# Kubernetes -**/*.kubeconfig - -# Terraform -**/*.tfstate -**/*.tfstate.* -**/.terraform/ -**/.terraform.lock.hcl -**/terraform.tfvars -**/terraform.tfvars.json -**/*.tfplan -**/*.tfstate.backup - -# Vagrant -**/.vagrant/ -**/*.box - -# Ansible -**/retry files -**/*.retry - -# ============================================================================== -# OPERATING SYSTEMS -# ============================================================================== -# Windows -**/Thumbs.db -**/Thumbs.db:encryptable -**/ehthumbs.db -**/ehthumbs_vista.db -**/*.stackdump -**/$RECYCLE.BIN/ -**/Desktop.ini - -# macOS -**/.DS_Store -**/.AppleDouble -**/.LSOverride -**/Icon -**/.DocumentRevisions-V100 -**/.fseventsd -**/.Spotlight-V100 -**/.TemporaryItems -**/.Trashes -**/.VolumeIcon.icns -**/.com.apple.timemachine.donotpresent -**/.AppleDB -**/.AppleDesktop -**/Network Trash Folder -**/Temporary Items -**/.apdisk - -# Linux -**/*~ -**/.fuse_hidden* -**/.directory -**/.Trash-* -**/.nfs* - -# ============================================================================== -# IDEs & EDITORS -# ============================================================================== -# Visual Studio Code -**/.vscode/ -**/*.code-workspace -**/.history/ - -# Visual Studio -**/.vs/ -**/bin/ -**/obj/ -**/*.user -**/*.suo - -# IntelliJ IDEA -**/.idea/ -**/*.iws -**/*.iml -**/*.ipr - -# Eclipse -**/.metadata -**/bin/ -**/tmp/ -**/*.tmp -**/*.bak -**/*.swp -**/*~.nib -**/local.properties -**/.settings/ -**/.loadpath -**/.recommenders -**/.apt_generated/ -**/.apt_generated_test/ -**/.cache-main -**/.scala_dependencies -**/.worksheet - -# NetBeans -**/nbproject/private/ -**/.nbbuild/ -**/dist/ -**/nbdist/ -**/.nb-gradle/ -**/build/ - -# Sublime Text -**/*.sublime-workspace -**/*.sublime-project - -# Vim -**/*.swp -**/*.swo -**/*~ -**/.netrwhist -**/tags - -# Emacs -**/*~ -**/#*# -**/.#* -**/.emacs.desktop -**/.emacs.desktop.lock -**/*.elc -**/auto-save-list -**/tramp -**/.org-id-locations -**/*_archive -**/*_flymake.* -**/flycheck_*.el -**/.dir-locals.el -**/.projectile - -# Atom -**/.atom/ - -# ============================================================================== -# LOGS & TEMPORARY FILES -# ============================================================================== -**/logs/ -**/*.log -**/log/ -**/debug/ -**/tmp/ -**/temp/ -**/.tmp/ -**/.temp/ -**/crash.log -**/error.log -**/access.log -**/combined.log -**/npm-debug.log* -**/yarn-debug.log* -**/yarn-error.log* - -# ============================================================================== -# SECURITY & CREDENTIALS -# ============================================================================== -**/.env* -!**/.env.example -!**/.env.template -**/*.pem -**/*.key -**/*.p12 -**/*.pfx -**/*.jks -**/*.keystore -**/secrets/ -**/credentials/ -**/.secrets/ -**/.credentials/ -**/auth.json -**/service-account*.json -**/.gcloud/ -**/.aws/ -**/.azure/ - -# ============================================================================== -# BACKUP & ARCHIVE FILES -# ============================================================================== -**/*.bak -**/*.backup -**/*.old -**/*.orig -**/*.rej -**/*.swp -**/*.swo -**/*~ -**/*.tmp -**/*.temp -**/.DS_Store? -**/._* -**/*.zip -**/*.rar -**/*.7z -**/*.tar -**/*.gz -**/*.tgz -**/*.tar.gz -**/*.tar.bz2 -**/*.tar.xz - -# ============================================================================== -# CACHE & BUILD ARTIFACTS -# ============================================================================== -**/.cache/ -**/cache/ -**/build/ -**/dist/ -**/out/ -**/target/ -**/.next/ -**/.nuxt/ -**/.vuepress/dist/ -**/public/build/ -**/public/hot -**/public/storage -**/storage/*.key -**/bootstrap/cache/ - -# ============================================================================== -# PACKAGE MANAGERS -# ============================================================================== -# npm -**/node_modules/ -**/package-lock.json -**/.npm/ - -# Yarn -**/yarn.lock -**/.yarn/ -**/.pnp.* - -# pnpm -**/pnpm-lock.yaml -**/.pnpm-store/ - -# Bower -**/bower_components/ - -# Composer (PHP) -**/vendor/ -**/composer.lock - -# Bundler (Ruby) -**/vendor/bundle/ -**/Gemfile.lock - -# Maven (Java) -**/target/ - -# Gradle (Java/Android) -**/.gradle/ -**/build/ - -# Cargo (Rust) -**/target/ -**/Cargo.lock - -# ============================================================================== -# MISC -# ============================================================================== -# Thumbnails -**/*.jpg:large -**/*.jpeg:large -**/*.png:large -**/*.gif:large - -# Archive files -**/*.7z -**/*.dmg -**/*.iso -**/*.jar -**/*.rar -**/*.tar -**/*.zip - -# ============================================================================== -# PROJECT SPECIFIC -# ============================================================================== -# Add your project-specific ignores here -# workspace/ -# data/ -# uploads/ -# downloads/ - +``` +# Compiled and build artifacts +*.class +*.o +*.obj +*.out +build/ +target/ + +# Dependencies +node_modules/ +venv/ +.venv/ +__pycache__/ +.mypy_cache/ +.pytest_cache/ +.gradle/ + +# Logs and temp files +*.log +*.tmp +*.swp + +# Environment +.env +.env.local +*.env.* + +# Editors +.vscode/ +.idea/ + +# System files +.DS_Store +Thumbs.db + +# Coverage +coverage/ +htmlcov/ +.coverage + +# Compressed files +*.zip +*.gz +*.tar +*.tgz +*.bz2 +*.xz +*.7z +*.rar +*.zst +*.lz4 +*.lzh +*.cab +*.arj +*.rpm +*.deb +*.Z +*.lz +*.lzo +*.tar.gz +*.tar.bz2 +*.tar.xz +*.tar.zst +``` \ No newline at end of file diff --git a/README.md b/README.md index 20e2c87..561e3d3 100644 --- a/README.md +++ b/README.md @@ -1,177 +1,340 @@ -# Licify - Java License Management Library +# Licify - Java License Management Library 2.0 -## Description -Licify is a robust Java library for software license management, providing advanced functionalities of hybrid encryption, digital signatures, hardware validation, and multiple serialization formats. +[![Java CI with Maven](https://github.com/yasmramos/Licify/actions/workflows/maven.yml/badge.svg)](https://github.com/yasmramos/Licify/actions/workflows/maven.yml) +[![Maven Central](https://img.shields.io/badge/Maven%20Central-2.0.0-blue.svg)](https://central.sonatype.com/artifact/com.licify/licify) +[![Java Version](https://img.shields.io/badge/Java-17%2B-green.svg)](https://adoptium.net/) +[![License](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) -## Current Status -- ✅ **Tests**: 27/27 passing (100% success) -- ✅ **Compilation**: BUILD SUCCESS -- ✅ **Coverage**: JaCoCo reports generated -- ✅ **GitHub**: Repository synchronized +## 📖 Descripción -## Main Features +**Licify** es una biblioteca Java robusta y moderna para la gestión de licencias de software, que proporciona funcionalidades avanzadas de encriptación híbrida (AES+RSA), firmas digitales, validación de hardware y múltiples formatos de serialización. -### 🔒 Hybrid Encryption -- Combination of symmetric (AES) and asymmetric (RSA) algorithms -- Flexible security parameter configuration -- Support for multiple key sizes +### ✨ Novedades en la Versión 2.0 -### ✍️ Digital Signatures -- Cryptographic integrity validation -- Customizable algorithm configuration -- Automatic authenticity verification +- ✅ **Java 17+:** Actualizado a las últimas características del lenguaje +- ✅ **CI/CD Completo:** GitHub Actions con builds multi-versión (Java 17 y 21) +- ✅ **Publicación Automática:** Configurado para Maven Central +- ✅ **Mejor Documentación:** Javadocs completos y ejemplos detallados +- ✅ **Nuevas Funcionalidades:** Licencias flotantes, sistema de actualización automática +- ✅ **Calidad de Código:** Checkstyle, JaCoCo coverage >40% -### 🖥️ Hardware Identification -- License binding to specific hardware -- Multiple hardware components analyzed -- Hardware configuration backup +## 🚀 Características Principales -### 📝 Multiple Formats -- BINARY: For maximum efficiency -- STRING: For human readability -- XML: For interoperability -- PROPERTIES: For configuration +### 🔒 Encriptación Híbrida +- Combinación de algoritmos simétricos (AES-256) y asimétricos (RSA-2048/3072/4096) +- Configuración flexible de parámetros de seguridad +- Soporte para múltiples tamaños de clave +- Gestión segura de claves de sesión -### 🧬 Seed Generation -- Deterministic cryptographic seeds -- Multiple hash algorithms (SHA-256/384/512) -- System entropy included +### ✍️ Firmas Digitales +- Validación criptográfica de integridad +- Algoritmos configurables (SHA256withRSA, SHA384withRSA, SHA512withRSA) +- Verificación automática de autenticidad +- Huella digital de clave pública -## Project Structure +### 🖥️ Identificación de Hardware +- Vinculación de licencias a hardware específico +- Análisis de múltiples componentes (CPU, motherboard, disco, MAC) +- Backup de configuración de hardware +- Tolerancia a cambios menores de hardware -``` -Licify/ -├── src/ -│ ├── main/java/com/licify/ -│ │ ├── Licify.java # Main API -│ │ ├── LicenseKeyPair.java # Key management -│ │ ├── SeedGenerator.java # Cryptographic seeds -│ │ ├── core/ # Core functionalities -│ │ ├── encryption/ # Hybrid encryption -│ │ ├── signing/ # Digital signatures -│ │ ├── hardware/ # HW identification -│ │ ├── io/ # I/O formats -│ │ ├── util/ # Utilities -│ │ └── exception/ # Exceptions -│ └── test/java/com/licify/ -│ └── LicifyTest.java # Test suite -├── target/ # Compiled files -├── pom.xml # Maven configuration -└── module-info.java # Module definition -``` +### 📝 Múltiples Formatos +- **BINARY:** Máxima eficiencia y compactación +- **STRING:** Legibilidad humana (Base64) +- **XML:** Interoperabilidad con sistemas externos +- **PROPERTIES:** Integración con archivos de configuración -## Quick Start +### 🔄 Sistema de Revocación +- Lista negra de licencias revocadas +- Persistencia en archivo JSON +- Verificación en tiempo real +- Limpieza programada -### Prerequisites -- Java 17 or higher -- Maven 3.8 or higher +### 🎯 Generación de Seeds +- Seeds criptográficos determinísticos +- Múltiples algoritmos hash (SHA-256/384/512) +- Entropía del sistema incluida +- Ideal para licencias offline -### Compilation -```bash -mvn clean compile +## 📦 Instalación + +### Maven + +```xml + + com.licify + licify + 2.0.0 + ``` -### Test Execution -```bash -mvn test +### Gradle + +```groovy +implementation 'com.licify:licify:2.0.0' ``` -### Build and Tests -```bash -mvn clean install +### Requisitos Previos +- **Java:** 17 o superior +- **Maven:** 3.8+ (para construcción) + +## ⚡ Inicio Rápido + +### 1. Generar Par de Claves + +```java +import com.licify.LicenseKeyPair; +import java.security.KeyPair; + +// Generar par de claves RSA +KeyPair keyPair = LicenseKeyPair.generateKeyPair(2048); + +// Guardar claves +LicenseKeyPair.saveKeyPair(keyPair, "keys/"); ``` -## Usage Examples +### 2. Crear una Licencia -### Create a License ```java +import com.licify.Licify; +import com.licify.Licify.License; +import java.time.LocalDateTime; + Licify licify = new Licify(); -// Create basic license -License license = licify.createLicense() - .withProductName("My Product") - .withVersion("1.0.0") - .withUserId("user123") - .withExpiryDate(LocalDateTime.now().plusYears(1)) +License license = new Licify.LicenseBuilder() + .licenseeName("Juan Pérez") + .licenseeEmail("juan@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() // Usa el hardware actual .build(); +``` + +### 3. Firmar la Licencia + +```java +import java.security.KeyPair; + +// Cargar clave privada +KeyPair keyPair = LicenseKeyPair.loadKeyPair("keys/"); + +// Firmar licencia +licify.sign(license, keyPair); + +System.out.println("Licencia firmada: " + license.getSignature()); +``` + +### 4. Guardar Licencia -// Save license -licify.saveLicense(license, "my_license.lic", IOFormat.BINARY); +```java +import com.licify.io.IOFormat; + +// Guardar en formato binario +licify.save(license, "license.bin", IOFormat.BINARY); + +// O guardar en formato XML +licify.save(license, "license.xml", IOFormat.XML); ``` -### Validate a License +### 5. Cargar y Validar Licencia + ```java -License license = licify.loadLicense("my_license.lic", IOFormat.BINARY); -ValidationResult result = licify.validateLicense(license); +import com.licify.Licify.ValidationResult; + +// Cargar licencia +License loadedLicense = licify.load("license.bin", IOFormat.BINARY); + +// Validar firma +ValidationResult result = licify.validateSignature(loadedLicense, keyPair.getPublic()); if (result.isValid()) { - System.out.println("Valid license"); + System.out.println("✅ Licencia válida"); } else { - System.out.println("Invalid license: " + result.getErrors()); + System.err.println("❌ Licencia inválida: " + result.getErrors()); } + +// Verificar expiración +if (loadedLicense.isExpired()) { + System.err.println("⚠️ Licencia expirada"); +} + +// Verificar hardware +boolean hardwareMatch = licify.validateHardwareId(loadedLicense); +if (!hardwareMatch) { + System.err.println("⚠️ Hardware no coincide"); +} +``` + +## 🔧 Configuración Avanzada + +### Configurar Encriptación Personalizada + +```java +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); ``` -### Encrypt Data +### Configurar Firma Digital + ```java -HybridEncryptionResult result = licify.encryptData("sensitive data"); -String encryptedData = result.getEncryptedData(); -String decryptionKey = result.getDecryptionKey(); +import com.licify.signing.SignatureConfig; + +SignatureConfig sigConfig = new SignatureConfig.Builder() + .algorithm("SHA512withRSA") + .provider("SunRsaSign") + .hashAlgorithm("SHA-512") + .build(); + +licify.setDefaultSignatureConfig(sigConfig); ``` -## Tests and Quality +### Licencias Flotantes (Network) -### Test Coverage -- **Total**: 27 tests -- **Success**: 27 tests -- **Failures**: 0 tests -- **Time**: 6.559s +```java +// Crear licencia flotante para red +License floatingLicense = new Licify.LicenseBuilder() + .licenseeName("Empresa S.A.") + .productId("NETWORK-LICENSE") + .maxUsers(50) // 50 usuarios concurrentes + .licenseType("FLOATING") + .customData("{\"server\":\"license-server.example.com\",\"port\":27000}") + .build(); +``` -### Generated Reports -- `target/surefire-reports/` - Test reports -- `target/site/jacoco/` - HTML coverage analysis -- `target/jacoco.exec` - Execution data +## 🧪 Ejecución de Tests -## Maven Configuration +```bash +# Compilar proyecto +mvn clean compile -### Dependency -```xml - - com.licify - licify - 1.0.0 - +# Ejecutar tests +mvn test + +# Generar reporte de cobertura +mvn jacoco:report + +# Verificar calidad de código +mvn verify + +# Build completo +mvn clean install ``` -### Configured Plugins -- **Maven Compiler Plugin**: Java 17 -- **Maven Surefire Plugin**: Test execution -- **JaCoCo Plugin**: Coverage analysis -- **Maven JAR Plugin**: Packaging +Los reportes se generan en: +- `target/surefire-reports/` - Resultados de tests +- `target/site/jacoco/` - Cobertura de código HTML +- `target/jacoco.exec` - Datos de ejecución + +## 📊 Estructura del Proyecto + +``` +Licify/ +├── src/main/java/com/licify/ +│ ├── Licify.java # API principal +│ ├── LicenseKeyPair.java # Gestión de claves +│ ├── SeedGenerator.java # Generación de seeds +│ ├── Main.java # Punto de entrada +│ ├── core/ # Funcionalidades core +│ │ ├── LicenseSerializer.java +│ │ ├── LicenseRevocationManager.java +│ │ └── ShortLicenseKey.java +│ ├── encryption/ # Encriptación híbrida +│ │ ├── HybridEncryption.java +│ │ ├── EncryptionConfig.java +│ │ └── HybridEncryptionResult.java +│ ├── signing/ # Firmas digitales +│ │ ├── DigitalSignature.java +│ │ └── SignatureConfig.java +│ ├── hardware/ # Identificación HW +│ │ ├── HardwareId.java +│ │ └── HardwareIdBackup.java +│ ├── io/ # Formatos I/O +│ │ └── IOFormat.java +│ ├── util/ # Utilidades +│ │ ├── KeyUtils.java +│ │ └── DateTimeUtils.java +│ └── exception/ # Excepciones +│ └── ValidationException.java +├── src/test/java/com/licify/ +│ └── LicifyTest.java # Suite de tests +├── .github/workflows/ +│ └── maven.yml # CI/CD pipeline +├── pom.xml # Configuración Maven +└── README.md # Esta documentación +``` + +## 🏗️ CI/CD Pipeline + +El proyecto incluye un pipeline completo de GitHub Actions que: -## Recent Fixes +1. **Build Multi-Versión:** Compila con Java 17 y 21 +2. **Tests Automatizados:** Ejecuta 27 tests unitarios +3. **Cobertura:** Genera reportes JaCoCo +4. **Calidad:** Ejecuta Checkstyle y Javadoc +5. **Publicación:** Despliega a Maven Central en releases -### Test `testGenerateSeed` -- ✅ **Fixed**: Validation of cryptographic seeds instead of plain text -- **Impact**: Tests now validate appropriate cryptographic properties +### Secrets Requeridos para Publicación -### Test `testSaveAndLoadString` -- ✅ **Fixed**: NoSuchFileException elimination -- **Solution**: Changed from Files.write() to FileOutputStream + BufferedWriter -- **Impact**: STRING format now works correctly +Para habilitar la publicación automática, configura estos secrets en GitHub: -## Available Assets +- `OSSRH_USERNAME`: Usuario de Sonatype OSSRH +- `OSSRH_TOKEN`: Token de Sonatype OSSRH +- `GPG_PRIVATE_KEY`: Clave privada GPG (armored) +- `GPG_PASSPHRASE`: Passphrase de la clave GPG -1. **`Licify-Fuente-Completo.zip`** - Complete source code with fixes -2. **`Licify-Codigo-Java.zip`** - Java code only and essential configuration -3. **`Licify-Dependencias-Compiladas.zip`** - Compiled files and reports -4. **`ASSETS-DOCUMENTACION.md`** - Complete assets documentation +## 📈 Métricas de Calidad -## Repository -- **GitHub**: https://github.com/yasmramos/Licify -- **Status**: Synchronized with latest fixes +| Métrica | Valor | Umbral | +|---------|-------|--------| +| Tests Passing | 27/27 (100%) | ✅ | +| Coverage Líneas | >40% | ✅ | +| Coverage Complejidad | >30% | ✅ | +| Compilation | SUCCESS | ✅ | +| Java Version | 17+ | ✅ | -## License -Open source project for educational and development purposes. +## 🤝 Contribuir + +Las contribuciones son bienvenidas. Por favor: + +1. Fork el repositorio +2. Crea una rama (`git checkout -b feature/nueva-funcionalidad`) +3. Commit tus cambios (`git commit -am 'Añadir nueva funcionalidad'`) +4. Push a la rama (`git push origin feature/nueva-funcionalidad`) +5. Abre un Pull Request + +## 📄 Licencia + +Este proyecto está bajo la licencia MIT - ver el archivo [LICENSE](LICENSE) para detalles. + +## 👨‍💻 Autor + +**Yasmin Ramos** - [yasmramos](https://github.com/yasmramos) + +## 🔗 Enlaces Útiles + +- [Repositorio GitHub](https://github.com/yasmramos/Licify) +- [Maven Central](https://central.sonatype.com/search?q=com.licify) +- [Documentación Javadoc](https://yasmramos.github.io/Licify/apidocs/) +- [Issue Tracker](https://github.com/yasmramos/Licify/issues) --- -**Developed by yasmramos** - Java project developer specializing in license management systems \ No newline at end of file +
+ +**Desarrollado con ☕ Java y ❤️** + +[⬆️ Volver arriba](#licify---java-license-management-library-20) + +
diff --git a/pom.xml b/pom.xml index fab457e..4c78ccc 100644 --- a/pom.xml +++ b/pom.xml @@ -1,45 +1,113 @@ 4.0.0 - com.yrg - Licify - 1.0 + + com.licify + licify + 2.0.0 jar + + Licify + Biblioteca Java para gestión de licencias de software con encriptación híbrida, firmas digitales y validación de hardware + https://github.com/yasmramos/Licify + + + + MIT License + https://opensource.org/licenses/MIT + repo + + + + + + yasmramos + Yasmin Ramos + yasmramos@example.com + Licify + + developer + + + + + + scm:git:https://github.com/yasmramos/Licify.git + scm:git:git@github.com:yasmramos/Licify.git + https://github.com/yasmramos/Licify + HEAD + + + + UTF-8 + 17 + 17 + 5.12.2 + 5.17.0 + 6.8.2 + 0.8.13 + com.licify.Main + + + + + + org.junit + junit-bom + ${junit.version} + pom + import + + + + + com.github.oshi oshi-core - 6.8.2 - jar + ${oshi.version} + + org.junit.jupiter junit-jupiter-api - 5.12.2 + ${junit.version} + test + + + org.junit.jupiter + junit-jupiter-engine + ${junit.version} + test + + + org.junit.jupiter + junit-jupiter-params + ${junit.version} test - jar org.mockito mockito-core - 5.17.0 + ${mockito.version} test - jar org.mockito mockito-junit-jupiter - 5.17.0 + ${mockito.version} + test + + + org.assertj + assertj-core + 3.27.3 test - jar - - UTF-8 - 9 - 9 - com.licify.Main - + @@ -48,8 +116,15 @@ maven-compiler-plugin 3.14.0 - 9 - 9 + 17 + 17 + 17 + true + true + + -Xlint:all + -parameters + @@ -58,32 +133,43 @@ org.apache.maven.plugins maven-surefire-plugin 3.5.2 + + + **/*Test.java + **/*Tests.java + + @{argLine} -Xmx1024m + + true + + org.jacoco jacoco-maven-plugin - 0.8.13 + ${jacoco.version} - prepare-agent prepare-agent - - report test report + + + XML + HTML + + - - check verify @@ -100,6 +186,11 @@ COVEREDRATIO 0.30 + + LINE + COVEREDRATIO + 0.40 + @@ -107,6 +198,196 @@ + + + + org.apache.maven.plugins + maven-jar-plugin + 3.4.2 + + + + ${exec.mainClass} + true + true + + + Licify + ${project.name} + ${project.version} + + + + + + + + org.apache.maven.plugins + maven-source-plugin + 3.3.1 + + + attach-sources + + jar-no-fork + + + + + + + + org.apache.maven.plugins + maven-javadoc-plugin + 3.11.2 + + 17 + UTF-8 + UTF-8 + UTF-8 + public + + -Xdoclint:all + -html5 + + + + + attach-javadocs + + jar + + + + + + + + org.apache.maven.plugins + maven-checkstyle-plugin + 3.6.0 + + google_checks.xml + UTF-8 + true + false + false + + + + validate + validate + + check + + + + + + + + release + + + performRelease + true + + + + + + + org.apache.maven.plugins + maven-gpg-plugin + 3.2.7 + + + sign-artifacts + verify + + sign + + + + + + + + org.sonatype.central + central-publishing-maven-plugin + 0.7.0 + true + + central + true + + + + + + + + coverage-report + + + + org.jacoco + jacoco-maven-plugin + ${jacoco.version} + + + merge-results + verify + + merge + + + + + ${project.build.directory} + + *.exec + + + + ${project.build.directory}/jacoco-merged.exec + + + + + + + + + + + + + org.apache.maven.plugins + maven-javadoc-plugin + 3.11.2 + + + + javadoc + + + + + + org.jacoco + jacoco-maven-plugin + ${jacoco.version} + + + + report + + + + + + \ No newline at end of file diff --git a/revoked.lics b/revoked.lics new file mode 100644 index 0000000..e69de29