1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
//! # licverify
//!
//! Enterprise-grade license verification for Rust applications.
//!
//! `licverify` is a Rust client for the [go-license](https://github.com/luhtfiimanal/go-license)
//! verification system, providing secure license validation with RSA-SHA256 signatures,
//! hardware binding, and automatic expiry enforcement.
//!
//! This library is fully compatible with licenses generated by the go-license ecosystem,
//! including the main [go-license](https://github.com/luhtfiimanal/go-license) generator
//! and [python-licverify](https://github.com/luhtfiimanal/python-licverify) client.
//!
//! ## Features
//!
//! - **🔐 RSA-SHA256 Verification**: Cryptographic signature validation using 2048-bit RSA
//! - **💻 Hardware Binding**: Device-locked licensing with MAC addresses, disk IDs, and hostnames
//! - **⏰ Expiry Validation**: Automatic license expiration checking
//! - **🔄 Format Support**: Compatible with both binary (v2.0+) and JSON (v1.x) license formats
//! - **🚀 Cross-Platform**: Supports Linux, Windows, and macOS
//! - **📚 Easy Integration**: Simple API for embedding in applications
//!
//! ## Quick Start
//!
//! ```rust,no_run
//! use licverify::Verifier;
//!
//! # fn main() -> Result<(), Box<dyn std::error::Error>> {
//! // Load your RSA public key
//! let public_key_pem = std::fs::read_to_string("public.pem")?;
//! let verifier = Verifier::new(&public_key_pem)?;
//!
//! // Load and verify license
//! let license = verifier.load_license("license.lic")?;
//! verifier.verify(&license)?;
//!
//! println!("✅ License is valid!");
//! println!("Customer: {}", license.customer_id);
//! println!("Expires: {}", license.expiry_date);
//! # Ok(())
//! # }
//! ```
//!
//! ## Hardware Binding
//!
//! Prevent license sharing by binding to specific hardware:
//!
//! ```rust,no_run
//! use licverify::{Verifier, HardwareInfo};
//!
//! # fn main() -> Result<(), Box<dyn std::error::Error>> {
//! # let public_key_pem = "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA...\n-----END PUBLIC KEY-----";
//! # let verifier = Verifier::new(public_key_pem)?;
//! # let license = verifier.load_license("license.lic")?;
//! // Verify hardware binding
//! verifier.verify_hardware_binding(&license)?;
//!
//! // Get current hardware info
//! let hw_info = HardwareInfo::get()?;
//! println!("MAC Addresses: {:?}", hw_info.mac_addresses);
//! # Ok(())
//! # }
//! ```
//!
//! ## License Formats
//!
//! - **Binary Format**: Full support for go-license v2.0+ binary format
//! - **JSON Format**: Legacy compatibility with go-license v1.x JSON format
//! - **Signature**: RSA-2048 PKCS#1 v1.5 with SHA-256 hashing
pub use ;
pub use ;
pub use License;
pub use Verifier;