Slm4j project aimed to provide an easy-to-use, easy-to-implement license manager system for java projects.
Basic functionality
The project includes a command line tool to generate private and public keys for cryptographic signing, and a runtime class (or jar module) to validate the generated keys.
The signed data is an ASCII armored file, which could store date or time limitations, functionality restrictions or any user specified strings. The embedded license file validator ensures that file is not modified by using DSA algorythm.
Command line usage
The following command signs input1.txt file and writes the result to output1.txt. If test1.pub (public key file) and test1.pkf (private key file) do not exists, then these files are automatically generated.
$ java -jar SignatureCreator.jar sign -license input1.txt -public test1.pub \
-private test1.pkf -sign output1.txt
After the initial key generation, the generated key files are used for futher sign actions.
$ java -jar SignatureCreator.jar sign -license input2.txt -public test1.pub \
-private test1.pkf -sign output2.txt
To verify the generated keys use the "verify" action:
$ java -jar SignatureCreator.jar verify -sign output1.txt -public test1.pub
License is valid
$ java -jar SignatureCreator.jar verify -sign output2.txt -public test1.pub
License is valid
To check what happens if we modify the generated license file use our favourite editor and try it:
$ vim output2.txt
$ java -jar SignatureCreator.jar verify -sign output2.txt -public test1.pub
License is not valid
Usage from java programs
To validate a user supplied license file in your application, you must include your public key file in the binary distribution (eg. in a hardcoded static private string in your license handler class) and import SignatureValidator.jar file. To check the input license file, issue:
private static final String PUBLIC_KEY = "...";
try {
SignatureValidator validator = new SignatureValidator();
if ( validator.verifyLicenseWithString( PUBLIC_KEY, fileToValidate ) )
System.out.println("License is valid");
System.out.println("Registred to: " +
validator.getLicenseOptions().get("RegistredTo") );
} else {
System.out.println("License is not valid");
}
} catch (SlmException ex) {
System.out.println("Can not load license information: " + ex.getMessage() );
}
For more information please refer to included javadocs.
Example license file
The following file was generated by slm4j:
----- BEGIN LICENSE -----
RegistredTo=John Smith
ExpirationDate=20090630
Version=Full
----- END LICENSE -----
----- BEGIN SIGNATURE -----
MCwCFCKRoTnYFdE7JJzH
W2XQddSq9wqCR43hRQ+J
BZV5FS+ZU5j90JAZFUA2
WQ==
----- END SIGNATURE -----
Downloads
Souce code: slm4j-src-1.00.zip (81k, ZIP)
JAR files: slm4j-bin-1.00.zip (69k, ZIP)
To access source code online or for pull requests please visit project's home on github.
License
Released under BSD license





Please call us for more information:
Starschema became the official partner of Tableau Software, the market leader of data visualization and ad-hoc BI technology focusing on intuitive exploration of data and correlations.
EMC Greenplum, a massively parallel database platform has been chosen by a multinational email marketing company to support their data warehouse developed in Hungary. The selection was preceded by an intensive testing and POC phase to ensure that the Greenplum database has the
Starschema Team, in cooperation with Wincor-Nixdorf, one of the world's leading providers of banking and retail solutions, has successfully implemented a massive parallel analytic data warehouse for ATM machine generated data...