ebourg / jsign

Java implementation of Microsoft Authenticode for signing Windows executables, installers & scripts
https://ebourg.github.io/jsign
Apache License 2.0
250 stars 107 forks source link

jsign 4.1 not Java 8 compatible #130

Closed sstamm closed 1 year ago

sstamm commented 2 years ago

Looks like 4.1 was released with Java 11 and without release-parameter and dedicated Java-Version. Was that intended? Because get the following error with Java 8:

Caused by: java.lang.NoSuchMethodError: java.nio.ByteBuffer.limit(I)Ljava/nio/ByteBuffer;
    at net.jsign.pe.PEFile.read (PEFile.java:173)
    at net.jsign.pe.PEFile.<init> (PEFile.java:131)
    at net.jsign.pe.PEFile.<init> (PEFile.java:115)
    at net.jsign.pe.PEFile.isPEFile (PEFile.java:96)
    at net.jsign.Signable.of (Signable.java:108)
    at net.jsign.Signable.of (Signable.java:94)

If release-parameter is set to Java 8 (see https://github.com/sstamm/jsign/commit/a4b66fd890c08bc4a742810a782db1e3e5f2f184)

[INFO] --- maven-compiler-plugin:3.10.1:compile (default-compile) @ jsign-core ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 69 source files to C:\GIT\GitHub\jsign\jsign-core\target\classes
[INFO] /C:/GIT/GitHub/jsign/jsign-core/src/main/java/net/jsign/jca/SigningServiceSignature.java: C:\GIT\GitHub\jsign\jsign-core\src\main\java\net\jsign\jca\SigningServiceSignature.java uses or overrides a deprecated API.
[INFO] /C:/GIT/GitHub/jsign/jsign-core/src/main/java/net/jsign/jca/SigningServiceSignature.java: Recompile with -Xlint:deprecation for details.
[INFO] /C:/GIT/GitHub/jsign/jsign-core/src/main/java/net/jsign/asn1/authenticode/AuthenticodeSignedDataGenerator.java: Some input files use unchecked or unsafe operations.
[INFO] /C:/GIT/GitHub/jsign/jsign-core/src/main/java/net/jsign/asn1/authenticode/AuthenticodeSignedDataGenerator.java: Recompile with -Xlint:unchecked for details.
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] /C:/GIT/GitHub/jsign/jsign-core/src/main/java/net/jsign/YubiKey.java:[26,35] package sun.security.pkcs11.wrapper does not exist
[ERROR] /C:/GIT/GitHub/jsign/jsign-core/src/main/java/net/jsign/YubiKey.java:[27,35] package sun.security.pkcs11.wrapper does not exist
[ERROR] /C:/GIT/GitHub/jsign/jsign-core/src/main/java/net/jsign/YubiKey.java:[75,55] cannot find symbol
  symbol:   class PKCS11Exception
  location: class net.jsign.YubiKey
[ERROR] /C:/GIT/GitHub/jsign/jsign-core/src/main/java/net/jsign/YubiKey.java:[76,9] cannot find symbol
  symbol:   class PKCS11
  location: class net.jsign.YubiKey
[ERROR] /C:/GIT/GitHub/jsign/jsign-core/src/main/java/net/jsign/YubiKey.java:[76,25] cannot find symbol
  symbol:   variable PKCS11
  location: class net.jsign.YubiKey
[INFO] 5 errors

It's not compliable.

sfeigl commented 2 years ago

Try to cast ByteBuffer to Buffer before calling position

ebourg commented 1 year ago

I made a mistake when building the release, sorry. This will be fixed in the version 4.2.

dyorgio commented 1 year ago

Same problem here, I needed to downgrade to 4.0 to use maven plugin. @ebourg I know that you have your own priorities, but in theses cases would be nice a emergencial release (maybe 4.1.1 based on tag 4.1) delivered fast 😇.

ebourg commented 1 year ago

@dyorgio Jsign 4.2 is out, properly built with Java 8 this time