License3j | Free Licence Management Library
kandi X-RAY | License3j Summary
kandi X-RAY | License3j Summary
License3j is a Java library that can be used to create and assert license files. This way Java programs can enforce the users to compensate their use of the software in the form of payment. This is the usual way when closed source programs are distributed. License management alone does not guarantee that the program will not be stolen, pirated or used in any illegal way. However, license management may increase the difficulty to use the program illegally and therefore may drive users to become customers. There is another effect of license management which is a legal aspect. If there is sufficient license management, illegal users have less probability to successfully claim their use was based on the lack of, or on false knowledge of license conditions. License3j is an open source license manager that you can use free of charge for non-profit purposes... as well as for profit purposes as well under the license terms covered by Apache 2.0 license as defined on the web page
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Write key pair
- Gets the key bytes for the given key
- Get the byte representation of the private key
- Closes this system
- Sign a private key with a given private key
- Get the signed signature
- Gets the features in sorted order
- Creates the byte representation of the feature set
- Formats a date
- Parse a date string
- Gets the instanceId ignoring exception
- Get a double value
- Get a float value
- Get a long value as long
- Allow this hardware binder to be allowed
- Specifies that this hardware is denied by the given regex
- Test program
- Returns the integer value as int
- Get a short value as a short
- Returns the instance id for the given instance ID
- Returns the byte representation of this object
- Splits a feature into a string
- Helper method to parse a number string
- Get BigDecimal
- Gets a feature
- Returns true if the entry has expired
License3j Key Features
License3j Examples and Code Snippets
Community Discussions
Trending Discussions on License3j
QUESTION
We’re using a Java libarary called license3j
for license management. The library uses asymmetric encryption and relies itself on Bouncycastle. We create a license file using a simple gpg
command and verify the license within our software using our public key. So far everything worked fine. BUT: In 1,000 generated licenses, there is a very small fraction which cannot be verified correctly, although, they are in fact valid (approximately 5/1000).
What happens in this case: When the license is to be verified in com.verhas.licensor.License.setLicenseEncoded(InputStream)
, the org.bouncycastle.openpgp.PGPOnePassSignature.verify(PGPSignature)
throws the following exception:
org.bouncycastle.openpgp.PGPRuntimeOperationException: unable to verify signature: Signature length not correct: got 511 but was expecting 512
Sounds rather obscure to me, having only basic cryptography knowledge. Spending hours googling, gave me the clue, that there is something about "leading zeros". So, in the given example, obviously a leading zero was stripped away somewhere (where?), and the lengths of the signature data to compare do not match. Makes sense.
Now, I’ve no clue, where the issue might be located. Is it during creation of the license file? Essentially, we’re just doing the following:
...ANSWER
Answered 2017-Feb-06 at 11:13Looks like it is a bug in bouncycastle, only encountered in versions of Java after 1.6, bouncycastle has always created the data wrong, but Java became more strict since 1.7 in the data it will accept during verification.
Bouncycastle is failing to pad the signature to the right length when it serializes it to the file, if the integer has enough leading zeros then the byte representation of it will be smaller.
Java versions 1.7 and above expect RSA signature bytes to be the same length as the key.
Bouncycastle converts the RSA signature byte array(returned from Java's RSA JCE provider) into an integer and it discards information about its length.
Line 263 of the PGPSignatureGenerator
shows where the RSA signature bytes are returned from JCE and converted into an integer.
This integer is eventually written to the outputstream using MPInteger#encode
which just uses the bitlength of the underlying biginteger to determine how much data to write.
This answer describes more about why you see this aproximatley one in every 200 cases and how the version of Java plays a role.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install License3j
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page