GithubHelp home page GithubHelp logo

cryptolens / cryptolens-java Goto Github PK

View Code? Open in Web Editor NEW
33.0 33.0 9.0 404 KB

Client API to access the functionality of Cryptolens Web API

Home Page: https://cryptolens.io/

License: MIT License

Java 100.00%
license-checking licensing licensing-as-a-service licensing-library offline-licensing

cryptolens-java's People

Contributors

artemlos avatar dependabot[bot] avatar svedi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cryptolens-java's Issues

Incorrect exception messages in LicenseKey

Hello team,
I accidentally found that in case of some errors, an incorrect exception messages is printed into the error stream, e.g.:
[Ljava.lang.StackTraceElement;@5d91ae08

This happens because of two places in the LicenseKey code where System.err.println(ex.getStackTrace()); is used:
here and here

The fix might be to just replace it with: ex.printStackTrace(System.err);

.jar files are empty

Hello,

After downloading and adding the latest .jar file, the classes in .iocryptolens are empty. I tried multiple versions now, but could not succeed. When is the maven release planned?

My errors:

Exception in thread "main" java.lang.NoClassDefFoundError: io/cryptolens/models/ActivateModel
at main.Main.validateKey(Main.java:111)
at main.Main.initializeConfig(Main.java:97)
at main.MainMenu.(MainMenu.java:62)
at main.Main.main(Main.java:75)
Caused by: java.lang.ClassNotFoundException: io.cryptolens.models.ActivateModel
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:520)

Offline activation requires productId check

Hello team,
We have faced an issue with the offline activation - LicenseKey.LoadFromString(key, licenseContent) method does not check a product ID, so it's possible to get a valid key for an activation file for a different product.
I think this is fine, since we can easily check the product ID once we have a LicenseKey object, but it might not very obvious for new users that this check needs to be done, since there is no mention in the documentation. Also, online activation methods - Key.Activate does product ID check already, so I would expect the same behavior for the offline activation.

Having said that, I think it would be nice to either add a few words about the necessity of product ID check into the documentation: https://github.com/Cryptolens/cryptolens-java#offline-activation-savingloading-licenses
Or to add an additional 'productId' parameter into LicenseKey.LoadFromString methods.

release in maven central

Hi,

to help with our packaging of this library it would really help if it got released in maven central.

Is it possible for you to release to maven central?

Thanks.

Concerning Android node locking feature

First of all, this API is amazing. It facilitated the entire licensing process and it works like a charm, and with pretty good security too.

Anyway, I developed a licensed Android app and I tried to get my product's licenses node-locked, that is, generating ANDROID_IDs and checking whether the keys are on the right machines. I always got errors saying that the licenses are not on the right machine although their IDs are correctly registered on the Web CPanel. The docs say I should call 'isOnRightMachine' with parameter v=2 if I am using Cryptolens-android.jar

There is another section of the documentation that says that 'getMachineCode' doesn't work on Android, which is correct. Which is why I had to generate Android IDs to identify a device, despite their shortcoming. However, I had to analyze the source code to know that 'isOnRightMachine' actually has a paramter that says 'machine code', that is not explicitly mentioned anywhere in the docs. It would be pretty useful if you inform Android Devs to explicitly specify the machine code in 'isOnRightMachine()' parameters instead of setting v = 2.

Also, concerning Android IDs, for now they're pretty much the only reliable identifier for newer Android versions. An Android ID will reset upon factory reset, but also, if the Android version is 8.0 or higher, the Android IDs is unique to the operating system, the device's user, AND the app's signing key itself. That's why you also have to inform the devs that using Android IDs should only reliable when you have a STATIC app signature key across all devices, all updates, all releases..etc

It's worth mentioning that 'getDeviceId()' does not work anymore due to the impossible permission it requires (PRIVILEGED_READ_PHONE_STATE) which requires the device to be in 'Enterprise Mode' (no normal end-users have this on).

Cheers!

cryptolens dependencies up-to-date in 1.26?

Hi,

I was looking into a security issue in a dependency of cryptolens.

That is: https://nvd.nist.gov/vuln/detail/CVE-2022-25647 for gson 2.8.5.

I see that latest version in pom.xml is 2.9.1, but latest jar in release 1.26 seems to contain 2.8.5.
(via file in jar: META-INF/maven/com.google.code.gson/gson/pom.xml)

If so, can you release a jar with newest deps as in source code pom.xml?

Thanks

Are you still planning to release to maven central? This can help with external dependency management.

Receiving 401 error while trying to activate a key

Hello,
I'm receiving 401 error (WebAPIError) while trying to activate a key with Java library.
I'm using v1.25 of Cryptolens. I've tried both android and non-android versions of library.

My code below:

private static void checkLicense() {
    String RSAPubKey = "MyRSAPubKey";
    String auth = "MyAuthKey";
    
    LicenseKey license = null;
    String licenseFilePath = "./de_license.lic";
    String licenseKeyPath = "./key.txt";
    APIError error = new APIError();

    try {
        String licenseString = new String(Files.readAllBytes(Paths.get(licenseFilePath)));
        license = LicenseKey.LoadFromString(RSAPubKey, licenseString, 30);
    } catch (IOException ein) {
        try {
            String licenseKey = new String(Files.readAllBytes(Paths.get(licenseKeyPath)));
            license = Key.Activate(auth, RSAPubKey, new ActivateModel(14771, licenseKey, Helpers.GetMachineCode(2)), error);
            System.out.println(error.message);
            System.out.println(error.errorType);

            if (Helpers.IsOnRightMachine(license, 2)) {
                try {
                    BufferedWriter writer = new BufferedWriter(new FileWriter(licenseFilePath));
                    writer.write(license.SaveAsString());
                    writer.close();
                } catch (IOException ignored) {
                }
            }
        } catch (IOException ignored) {
        }
    }

    if (!Helpers.IsOnRightMachine(license, 2)) {
        throw new IllegalArgumentException("Wrong license key!");
    }
}

Change HasFeature (for multiple features) to use data object instead of notes

In order to support multiple features, the GUI will write those into a separate data object called 'cryptolens_features' associated with a license key (based on the template provided in 'cryptolens_featuretemplate' data object in the product).

Earlier, this information was stored in the notes field, which we need to fix to account for this change.

The affected method is: https://github.com/Cryptolens/cryptolens-java/blob/master/src/main/java/io/cryptolens/methods/Helpers.java#L219

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.