Giter Site home page Giter Site logo

christian-schlichtherle / truelicense Goto Github PK

View Code? Open in Web Editor NEW
314.0 314.0 66.0 4.69 MB

An open source engine for license management on the Java Virtual Machine.

Home Page: https://truelicense.namespace.global

License: Apache License 2.0

Java 85.04% Scala 12.96% HTML 2.01%
license license-checking license-generator license-management license-system licenses licensesdialog

truelicense's People

Contributors

christian-schlichtherle avatar dependabot[bot] avatar github-actions[bot] avatar sonersivri 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  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  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  avatar

Watchers

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

truelicense's Issues

Hepl Mac M1 not install license

'/private/var/folders/vh/jmry8stx16g99q181vpk4zbm0000gn/T/jna-119427/jna5426719301717680703.tmp' (fat file, but missing compatible architecture (have 'i386,x86_64', need 'arm64e')), '/usr/lib/jna5426719301717680703.tmp' (no such file)

Questions

  • Can you please enable Github discussions for this projects?
  • Is this project alive - no activity in some years now?

Upgrade guide from net.dev.java.truelicense:truelicense:1.29 to 4.0.3

I'm currently trying to upgrade from using net.dev.java.truelicense:truelicense:1.29 to 4.0.3, but am struggling to find any documentation on how exactly to do that on the site. All I can currently find is how to use the maven archetype, which we are not doing as far as I am aware.

Currently we decrypt the license keys by doing:

LicenseParam licenseParam = *implementation of de.schlichtherle.license.LicenseParam*
LicenseManager licenseManager = new LicenseManager(licenseParam);
licenseManager.install(new File("path_to_license_file"));
LicenseContent licenseContent = lm.verify();
Properties props = new Properties();
props.load(new StringReader(licenseContent.getInfo()));
// use props to toggle features

How would we go about doing this same code using the new global.namespace.truelicense:truelicense?

I assume I need to include the global.namespace.truelicense:truelicense-v1:4.0.3 dependency, but beyond that I can't find any documentation on what to do.

the document website dead

image

I was able to access the document website normally yesterday, but suddenly it's not working today

mvn generate fails if there are spaces in company name

Hi,

Just starting with truelicense. When running the mvn generate as shown on this page, if the company name specified for -Dcompany has any spaces in it, the build fails with an error that looks like what I've pasted in below. This happens anytime there are spaces in the company name provided for the -Dcompany option, regardless of what the name is. If I put an _ (underscore) in place of any spaces in the company name the build completes successfully. Are you aware of this issue?

[ERROR] Unknown lifecycle phase "Inc.?". You must specify a valid lifecycle phase or a goal in the format : or :[:]:. Available lifecycle phases are: validate, initialize, generate-sources, process-sources, generate-resources, process-resources, compile, process-classes, generate-test-sources, process-test-sources, gen
erate-test-resources, process-test-resources, test-compile, process-test-classes, test, prepare-package, package, pre-integration-test, integration-test, post-integration-test, verify, install, deploy, pre-clean, clean, post-clean, pre-site, site, post-site, site-deploy. -> [Help 1]

Thank you.

Lisa

ObfuscatedString: Inconsistent conversion error handling between toCharArray() and toString

Class ObfuscatedString provides basically two ways to retrieve its obfuscated string data (for good reasons): Either (and traditionally) via it's toString method or via its toCharArray(). This two-fold API is nicely designed, but it turns out that both methods do use different error handling strategies: toString is implemented by means of evaluating String.String(byte[] bytes, int offset, int length, Charset charset), which is specified such that malformed-input and unmappable-character sequences are replaced by the charset's default replacement string. Contrary to this toCharArray() is implemented by creating a fresh CharsetDecorder using Charset.newDecoder(), where the specification tells us:

The default action for malformed-input and unmappable-character errors is to report them.

I'm wondering about the different error handling strategies: First, is this difference really intended? It looks astonishing on the first sight. Assuming that it is intended, I would feel that at least a second way should be provided that creates a String by means of a byte[]->char[] conversion which would also report above sort of errors (e.g. toStringChecked), possibly also a toCharArrayUnchecked.

If agreement exists to at least some of the suggested changes, I'm willing to provide a corresponding pull request.

If no consensus exists for any code changes, I think the semantic difference between both methods should be clearly documented.

Building under graalvm native-image will report an error java.lang.reflect.UndeclaredThrowableException

de.schlichtherle.xml.PersistenceServiceException: java.lang.reflect.UndeclaredThrowableException
at de.schlichtherle.xml.PersistenceService.load(PersistenceService.java:397)
at de.schlichtherle.license.PrivacyGuard.key2cert(PrivacyGuard.java:174)
at com.xxx.xxxx.loader.license.core.CustomLicenseManager.install(CustomLicenseManager.java:69)
at de.schlichtherle.license.LicenseManager.install(LicenseManager.java:406)
at de.schlichtherle.license.LicenseManager.install(LicenseManager.java:382)
at com.xxx.xxxx.loader.license.core.LicenseVerify.install(LicenseVerify.java:36)
at com.xxx.xxx.loader.launcher.tool.LicenseTool.install(LicenseTool.java:42)
at com.xxx.xxx.loader.launcher.FaasStartApplication.main(FaasStartApplication.java:44)
Caused by: java.lang.reflect.UndeclaredThrowableException
at de.schlichtherle.xml.PersistenceService$1.exceptionThrown(PersistenceService.java:79)
at com.sun.beans.decoder.DocumentHandler.handleException(DocumentHandler.java:359)
at com.sun.beans.decoder.DocumentHandler$1.run(DocumentHandler.java:388)
at com.sun.beans.decoder.DocumentHandler$1.run(DocumentHandler.java:372)
at java.security.AccessController.doPrivileged(AccessController.java:105)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:74)
at com.sun.beans.decoder.DocumentHandler.parse(DocumentHandler.java:372)
at java.beans.XMLDecoder$1.run(XMLDecoder.java:201)
at java.beans.XMLDecoder$1.run(XMLDecoder.java:199)
at java.security.AccessController.doPrivileged(AccessController.java:105)
at java.beans.XMLDecoder.parsingComplete(XMLDecoder.java:199)
at java.beans.XMLDecoder.close(XMLDecoder.java:174)
at de.schlichtherle.xml.PersistenceService.load(PersistenceService.java:395)
... 7 more
Caused by: java.io.IOException: Stream closed
at java.io.BufferedInputStream.getBufIfOpen(BufferedInputStream.java:170)
at java.io.BufferedInputStream.fill(BufferedInputStream.java:214)
at java.io.BufferedInputStream.read(BufferedInputStream.java:265)
at com.sun.org.apache.xerces.internal.impl.XMLEntityManager$RewindableInputStream.read(XMLEntityManager.java:2902)
at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.setupCurrentEntity(XMLEntityManager.java:674)
at com.sun.org.apache.xerces.internal.impl.XMLVersionDetector.determineDocVersion(XMLVersionDetector.java:148)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:806)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:771)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1213)
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:643)
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl.parse(SAXParserImpl.java:327)
at com.sun.beans.decoder.DocumentHandler$1.run(DocumentHandler.java:375)
... 17 more

Question: Backward binary compatibility of licenses

Hi,

I have some licenses generated with this library:

    <groupId>de.schlichtherle.truelicense</groupId>
    <artifactId>truelicense-core</artifactId>
    <version>1.33</version>

are they still compatible (can the licenses still be verified) with the License Manager from

    <groupId>global.namespace.truelicense</groupId>
    <artifactId>truelicense-core</artifactId>
    <version>4.0.3</version>

``` ?
Thanks !

Java 17? WrongMethodTypeException: expected (GenerateSourcesMavenTask$$proxy)Path but found (GenerateSourcesMavenTask)Path

Following the getting started instructions, ./mvnw clean verify -Pintegration-test results in:

[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary for stargazer 1.0-SNAPSHOT:
[INFO] 
[INFO] stargazer .......................................... SUCCESS [  0.283 s]
[INFO] stargazer-keygen ................................... FAILURE [  0.128 s]
[INFO] stargazer-keymgr ................................... SKIPPED
[INFO] stargazer-keymgr-service ........................... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  0.468 s
[INFO] Finished at: 2022-11-18T10:14:26+11:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal global.namespace.truelicense:truelicense-maven-plugin:4.0.3:generate-main-sources (generate-main-sources) on project stargazer-keygen: java.lang.invoke.WrongMethodTypeException: expected (GenerateSourcesMavenTask$$proxy)Path but found (GenerateSourcesMavenTask)Path -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal global.namespace.truelicense:truelicense-maven-plugin:4.0.3:generate-main-sources (generate-main-sources) on project stargazer-keygen: java.lang.invoke.WrongMethodTypeException: expected (GenerateSourcesMavenTask$$proxy)Path but found (GenerateSourcesMavenTask)Path
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:215)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:956)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:288)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:192)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:77)
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:568)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:77)
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:568)
    at org.apache.maven.wrapper.BootstrapMainStarter.start (BootstrapMainStarter.java:39)
    at org.apache.maven.wrapper.WrapperExecutor.execute (WrapperExecutor.java:122)
    at org.apache.maven.wrapper.MavenWrapperMain.main (MavenWrapperMain.java:55)
Caused by: org.apache.maven.plugin.MojoExecutionException: java.lang.invoke.WrongMethodTypeException: expected (GenerateSourcesMavenTask$$proxy)Path but found (GenerateSourcesMavenTask)Path
    at global.namespace.truelicense.maven.plugin.commons.BasicMojo.execute (BasicMojo.java:48)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:956)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:288)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:192)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:77)
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:568)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:77)
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:568)
    at org.apache.maven.wrapper.BootstrapMainStarter.start (BootstrapMainStarter.java:39)
    at org.apache.maven.wrapper.WrapperExecutor.execute (WrapperExecutor.java:122)
    at org.apache.maven.wrapper.MavenWrapperMain.main (MavenWrapperMain.java:55)
Caused by: java.lang.invoke.WrongMethodTypeException: expected (GenerateSourcesMavenTask$$proxy)Path but found (GenerateSourcesMavenTask)Path
    at java.lang.invoke.Invokers.newWrongMethodTypeException (Invokers.java:523)
    at java.lang.invoke.Invokers.checkExactType (Invokers.java:532)
    at global.namespace.truelicense.maven.plugin.generation.GenerateSourcesMavenTask$$proxy.projectDirectory (Unknown Source)
    at global.namespace.truelicense.build.tasks.generation.GenerateSourcesTask$TemplateSet.resolveWithProjectDirectory (GenerateSourcesTask.java:170)
    at global.namespace.truelicense.build.tasks.generation.GenerateSourcesTask$TemplateSet.processDirectory (GenerateSourcesTask.java:130)
    at global.namespace.truelicense.build.tasks.generation.GenerateSourcesTask.execute (GenerateSourcesTask.java:110)
    at global.namespace.truelicense.maven.plugin.commons.BasicMojo.execute (BasicMojo.java:45)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:956)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:288)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:192)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:77)
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:568)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:77)
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:568)
    at org.apache.maven.wrapper.BootstrapMainStarter.start (BootstrapMainStarter.java:39)
    at org.apache.maven.wrapper.WrapperExecutor.execute (WrapperExecutor.java:122)
    at org.apache.maven.wrapper.MavenWrapperMain.main (MavenWrapperMain.java:55)

This using:

 mvn -v                                                                                                                 
Apache Maven 3.8.6 (84538c9988a25aec085021c365c560670ad80f63)
Maven home: /opt/maven
Java version: 17.0.4.1, vendor: N/A, runtime: /usr/lib/jvm/java-17-openjdk

I see the warning regarding Java 14; altering pom.xml to contain:

                <plugin>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>3.8.1</version>
                    <configuration>
                            <release>11</release>
                    </configuration>
                </plugin>

doesn't help.

How to use consumerAmount?

When create *.lic file, we can write some content, one of the attribute is consumerAmount. However, I cannot find any useful documentation about it.
As I assume, it will restrict user count to be allowed to use the system, is that right?

Old documentation site certificate issue

The old documentation site (https://truelicense.net/) is soft-blocked by Firefox with a certificate security warning:

Web sites prove their identity via certificates. Firefox does not trust this site because it uses a certificate that is not valid for truelicense.net. The certificate is only valid for the following names: *.github.com, github.com

Error code: SSL_ERROR_BAD_CERT_DOMAIN

generate key from CLI

am trying to generate a key from CLI when i run the command
java -jar JarHome/stargazer-keygen-1.0-SNAPSHOT-standalone.jar generate license.lic -verbose true -output -{"consumerAmount":1,"consumerType":"User","holder":"CN=Bank","issued":1690437913563,"notAfter":1722063600000,"issuer":"CN=Company","subject":"StarGazer 2020"}
-output
i get the line in red and a license with this standard values is created.

global.namespace.truelicense.v4.V4License@f1ce2f88[subject="StarGazer 2020", holder="CN=Unknown", issuer="CN=Company Inc.", issued=Thu Jul 27 09:05:14 EET 2023, notBefore=null, notAfter=null, consumerType="User", consumerAmount=1, info=null]

if i try to use this
-input global.namespace.....
i get an error..
java.nio.file.FileSystemException: global.namespace.truelicense.v4.V4License@752005ff[subject=StarGazer 2020,holder=CN=Christian Schlichtherle,issuer=CN=Company Inc.,issued=Sat May 23 18:55:08 CEST 2020,notBefore=Sat May 23 18:55:08 CEST 2020,notAfter=Sun May 23 18:55:08 CEST 2024,consumerType=User,consumerAmount=1,info=null]: File name too long

How can i use the V4 what is the code after the @?
Thank you

whate is the different version license store type in V1、V2、V4?

V2JsonLicense、V4License、LicenseContent for different version license entity model?
What's the difference between them?
now,Best practices,use V4License?

“This facade provides a static factory method for license management context builders for use with Version 4 (V4) format license keys. This class should not be used by applications because the created license management context builders are only partially configured.

Question: How can I determine the edition of a License?

Using the keymgr library in my app, I've gotten this far:

val lm = LicenseManager.get()
lm.install(file(licenseFile))
val license = lm.load()
lm.verify()

Now I want to do logic based on the edition:

if (/* license edition == "foo" */) {
    ...
} else {
    ...
}

What's the logic I need to write the if condition?

AbstractKeyStoreParam.getStream() throw FileNotFoundException

I can correct load keyStore file, right get privateKey and publicKey ,but use licenseManager.store((content), new File(licensePath)), program throw FileNotFoundException,
so debug to discovery the throw exception code is AbstractKeyStoreParam.getgetStream()function

public InputStream getStream() throws IOException { InputStream var1 = this.clazz.getResourceAsStream(this.resource); if (null == var1) { throw new FileNotFoundException(this.resource); } else { return var1; } }

ObfuscatedString#toCharArray(): Unwarranted assumption that CharsetDecoder returns an array-based CharBuffer

The current implementation of ObfuscatedString#toCharArray() unconditionally returns from the obtained CharBuffer the result array by invoking its array() method. But there is no guarantee that CharsetDecoder.decode actually returns a result buffer that is backed by an array, though.

My recommendation would be to change the implementation so that it is guaranteed to work correctly regardless on assumptions about implementation details, something along the lines of the following:

final CharBuffer charBuffer = charset.newDecoder().decode(ByteBuffer.wrap(encoded, 0, length));
final char[] chars = new char[charBuffer.remaining()];
charBuffer.get(chars);
if (charBuffer.hasArray()) {
	Arrays.fill(charBuffer.array(), (char) 0);
}
return chars;

If agreement exists for this general idea, I would provide a corresponding pull request.

install license file seems not persisted

env:
java8
TrueLicense:4.0.3
Linux

case:
I followed the latest doc to genered three submodels and use the api to install the license file.
Windows: which is the dev os, I can successfully install license file in one java application, and verify it suceessfully in another java application.
Linux: I installed the license file successfully and verify it ok, but after a while(~30 minutes) or restart the java application , it tell me no license file found when I use LicenseManager.get().load() or LicenseManager.get().verify().

Unable to get keygen API to work

Hi,

I need to know how to properly use the current keygen and keymgr Java APIs.

I have tried using the keygen API to generate a license using Java code, and the current code behavior does not seem to match the documentation for using the API that is on the truelicense.net website. Here is what is on the site:

VendorLicenseManager manager = LicenseManager.${edition};
LicenseVendorContext context = manager.context();
License bean = context.license();
Sink sink = context.pathStore(java.nio.file.Paths.get("${license-key-path}"));
manager.generate(bean, sink);

Here is what I have found:

LicenseVendorContext does not have an exposed license() method. There is, however, a licenseFactory() method, which returns an object that has a license() method.
LicenseVendorContext does not have a pathStore method.
VendorLicenseManager does not have a generate() method, but does have a generateFromKey() method.

Here is what I have been able to do so far with the API methods that seem to be available:

VendorLicenseManager manager;

	VendorLicenseManager manager = LicenseManager.standard;
	LicenseManagementContext licMgrContext = manager.context();
	License prelic = licMgrContext.licenseFactory().license();
	try {
		LicenseKeyGenerator keyGenerator = manager.generateKeyFrom(prelic);
		License lic = keyGenerator.license();
           }
           catch( LicenseManagementException exc ) {
                  ...
          }

At this point it seems I have a valid license in the lic object. If I call lic.getSubject() I get what I would expect for how I generated the Maven project and built the code. Now I'm stuck not being able to figure out how to get the license/key file written. LicenseKeyGenerator has a storeTo() method that takes a Sink as an argument. Since there appears to be no pathStore method in LicenseManagementContext I can't figure out how to create the Sink correctly. I tried searching the code for examples, but didn't find anything that would help me. Also looked at the javadocs.

I assume, based on what I see in the code, that similar problems exist with the documentation for the keymgr API.

The code I pulled is from the develop branch.

Need updated API usage instructions.

Thank you.

Generating A License Key occur Mistake

Develop Envirment: Mac Os M2 chipest
JDK: 1.8

Hi,

I follow the guide and generate a project successfully ! But when I start the step2 "Generating A License Key" , it makes some mistakes, the terminal responses below information :

{"consumerAmount":1,"consumerType":"User","holder":"CN=Unknown","issued":1709113790330,"issuer":"CN=Company Inc.","subject":"StarGazer 2020"}zsh: command not found: {consumerAmount:1,consumerType:User,holder:CN=Unknown,issued:1565085418292,issuer:CN=Company

it seems like the command consider the parameter {"consumerAmount":1,"consumerType":"User","holder":"CN=Unknown","issued":1709113790330,"issuer":"CN=Company Inc.","subject":"StarGazer 2020"}" as a command ,not a parameter.

Questions:

  • did I input a mistake command?
  • what should I prepared before Generating A License Key?

Wrapped LicenseParam in v1.29

Hi again :)

If I have wrapped LicenseParam class as
public interface ValidatingLicenseParam extends LicenseParam { Collection<Restriction> getRestrictions(); }
and I use it to create LicenseManager, collection of Restriction is stored in license but in v4.0.3 I cannot access it while loading. Is there a way to access this field?
Thanks!

java.io.FileNotFoundException: public.ks

Hello,

I'm building a Java plugin for Atlassian Jira (On-Premise) and try to implement truelicense to license our plugin.

Everything works in the local testing / development from IntelliJ / Maven and the public.ks file is visible in target/classes/public.ks. If I extract my *.jar file I also can see the file.

I've installed the public in my standalone server instance and the truelicense libraries / dependencies are correctly loaded and can be used.

It always throw FileNotFoundException on manager.install(source).

I've also did some research... https://developer.atlassian.com/server/confluence/what-is-the-best-way-to-load-a-class-or-resource-from-a-plugin/

I've tried multiple variants.

InputStream inputStream = ClassLoaderUtils.getResourceAsStream("public.ks", this.getClass());
        int value = inputStream.available();
        log.debug("inputStream.available() " + value);

final URL publicKsURL = ClassLoaderUtils.getResource("public.ks", getClass());

URL resource1 = getClass().getClassLoader().getResource("public.ks");
URL resource2 = ConsumerLicenseManager.class.getClassLoader().getResource("public.ks");
URL resource3 = getClass().getResource("/public.ks");
URL resource4 = ConsumerLicenseManager.class.getResource("/public.ks");
2022-09-10 11:03:47,311+0200 inputStream.available() 1378
2022-09-10 11:03:47,311+0200 Loading publicKsURL from bundle://295.0:1/public.ks
2022-09-10 11:03:47,312+0200 Loading resource1 from bundle://295.0:1/public.ks
2022-09-10 11:03:47,312+0200 Loading resource2 from bundle://295.0:1/public.ks
2022-09-10 11:03:47,312+0200 Loading resource3 from bundle://295.0:1/public.ks
2022-09-10 11:03:47,312+0200  Loading resource4 from bundle://295.0:1/public.ks

If I replace the filename with something different if failes with a NullPointerException. So for me it looks like that the public.ks is in the classpath. truelicense doesn't picks it.

Did I miss something? I'm slowly running out of ideas and I hope you can give me some hint.

Kind Regards,
Tim

Should some secret be kept private from the VCS?

From reading the documentation, it seems like the default recommendation is to check both the keystores and the password (which I see is in the POM) into VCS.

I'm thinking about the threat that the source code of a licensing project might be stolen from VCS, and how to protect against that.

Obviously the first step is to keep the repo private. I'm wondering is there another recommendation for keeping some secret out of VCS that prevents someone with the repo from generating licenses?

Would keeping the password out of the POM and storing only it in a local file do the trick?

Or should the keystores not be checked in if this is a concern?

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.