Comments (16)
This looks fairly complex, and I don't think a build script is the right place to write code, it's sad that Gradle encourages this. Using the Ant task should be easier:
configurations {
jsign
}
dependencies {
jsign group: 'net.jsign', name: 'jsign', version: '1.3'
}
task jsign << {
ant.taskdef(name: 'jsign', classname: 'net.jsign.PESignerTask', classpath: configurations.jsign.asPath)
ant.jsign(file: 'application.exe',
name: 'My Application',
url: 'http://www.example.com',
keystore: 'keystore.p12',
alias: 'test',
storepass: 'secret',
tsaurl: 'http://timestamp.comodoca.com/authenticode')
}
from jsign.
Integrating an Ant task with Gradle is quite easy and for now I don't plan to implement a Gradle plugin. But if someone wants to write one I'd be happy to merge it.
from jsign.
I'm not sure a gradle plugin could be much simpler than just calling out to PESigner directly. Here's how I do it:
task sign {
doLast {
PESigner signer = new PESigner(INSTALLER_FILE)
signer.setArg('name', 'MyApp')
signer.setArg('url', 'https://myapp.com')
...
signer.sign()
}
}
from jsign.
is the installer file the actual jsign file? just getting back to this now. thanks for the info.
from jsign.
INSTALLER_FILE is the file you want to sign. In my case, it's an .exe. Not sure what a jsign file is.
from jsign.
http://search.maven.org/#artifactdetails%7Cnet.jsign%7Cjsign%7C1.3%7Cjar this file is what i was referencing.
from jsign.
Gotcha. You add that to your buildscript by putting this at the top of your buildscript:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath "net.jsign:jsign:1.3"
}
}
import net.jsign.PESigner
from jsign.
:launcher-bootstrap:signexe FAILED
FAILURE: Build failed with an exception.
* Where:
Build file 'C:\Users\Myahm\Desktop\coding\git\MC\github\oblivion\Launcher\launcher-bootstrap\build.gradle' line: 71
* What went wrong:
Execution failed for task ':launcher-bootstrap:signexe'.
> Could not find matching constructor for: net.jsign.PESigner(java.lang.String)
I am dealing with a multi project setup when i run that it fails due to that.
from jsign.
Whoops, sorry. Looks like we actually have a little in-house code.
import net.jsign.PESignerCLI;
public class PESigner {
private final File fileToSign;
private final Map<String, String> stringProps = Maps.newHashMap();
public PESigner(File fileToSign) {
this.fileToSign = fileToSign;
}
public void setArg(String key, String value) {
stringProps.put(key, value);
}
public void sign() {
List<String> args = Lists.newArrayList();
for (Map.Entry<String, String> entry : stringProps.entrySet()) {
args.add("--" + entry.getKey());
args.add(entry.getValue());
}
args.add(fileToSign.getAbsolutePath());
PESignerCLI.main(args.toArray(new String[args.size()]));
}
}
from jsign.
https://gist.github.com/dmodoomsirius/ba96f9c98283bf63fa94bb79acc2801a
^ my build.gradle for the project that has the exe i am trying to sign.
:launcher-bootstrap:signexe FAILED
FAILURE: Build failed with an exception.
* Where:
Build file '%userprofile%\Desktop\coding\git\MC\github\oblivion\Launcher\launcher-bootstrap\build.gradle' line: 95
* What went wrong:
Execution failed for task ':launcher-bootstrap:signexe'.
> Could not find matching constructor for: PESigner(java.lang.String)
from jsign.
If you know how to use buildSrc
, then put the PESigner I copy-pasted above into it. If you don't, try something like this:
import net.jsign.PESignerCLI;
task sign {
doLast {
args = ['--arg', 'argValue', 'C:\PathToFileToSign']
PESignerCLI.main(args.toArray(new String[args.size()]));
}
}
from jsign.
I don't atm. I am looking into it right now.
from jsign.
Now I have can't read private key even tho I converted a PuttyGEN Key into a pvk using this tool. not sure what I am doing wrong.
from jsign.
Edit: moved issue to another issue. #34
from jsign.
I added a native Gradle plugin, please give it a try. Here is a usage example:
buildscript {
repositories {
mavenLocal()
}
dependencies {
classpath 'net.jsign:jsign-gradle-plugin:1.4-SNAPSHOT'
}
}
apply plugin: 'net.jsign'
task sign << {
signexe(file : 'application.exe',
name : 'My Application',
url : 'http://www.example.com',
keystore : 'keystore.p12',
alias : 'test',
storepass : 'secret',
tsaurl : 'http://timestamp.comodoca.com/authenticode')
}
I plan to upload the plugin to the Gradle Plugin Portal once the next version is released. The usage will then be easier :
plugins {
id "net.jsign" version "1.4"
}
task sign << {
signexe(file : 'application.exe',
name : 'My Application',
url : 'http://www.example.com',
keystore : 'keystore.p12',
alias : 'test',
storepass : 'secret',
tsaurl : 'http://timestamp.comodoca.com/authenticode')
}
from jsign.
ohh thank you. I will sure to give this a try when i get home.
from jsign.
Related Issues (20)
- Contradictory error message if no storepass is provided HOT 2
- Signature verification failed, the private key doesn't match the certificate HOT 8
- Doubt about Google HSM changes
- Support for Office files HOT 1
- Unsupported File ".exe" HOT 10
- Support for Oracle OCI Vault HOT 19
- BattlEye validation issue due to missing intermediate certificates HOT 16
- AzureKeyVault JCA provider requires list aliases permission - Unable to retrieve Azure Key Vault certificate aliases HOT 10
- Unable to retrieve the certificate chain from Azure Trusted Signing (socket write error) HOT 24
- jarsigner error: java.lang.RuntimeException: java.security.KeyStoreException: Unable to retrieve Azure Key Vault certificate aliases HOT 1
- Certificate chain not found with jarsigner and Azure Key Vault HOT 26
- Error with a Yubikey FIPS in PIV mode: The parameters in the data field are incorrect HOT 6
- apksigner & jsign with AWS? HOT 8
- Support AWS KMS Key Aliases HOT 3
- Access Denied for jsign when using from Github Action Role HOT 7
- sign more than one file with API (YUBIKEY) HOT 22
- Signing exe with Yubikey on MacOS HOT 5
- Invalid code signing after successful operation HOT 3
- error after 30 minutes : "SCARD_E_NO_SERVICE" HOT 8
- Nuget.org: Signed packages must only have an author signature. Other signature types are not supported. HOT 8
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jsign.