Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Easy Signing #94

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Easy Signing #94

wants to merge 4 commits into from

Conversation

SimonIT
Copy link
Member

@SimonIT SimonIT commented Jan 3, 2025

Because of the AV debacle and the recent badlogic commit libgdx/libgdx@cf2bf3f for signing the dylibs, I thought it would be nice to have integrated signing capabilities in jnigen.

There's a gradle plugin jsign for signing dlls which was quite easy to integrate and works cross-platform.

For MacOS I integrated codesign like badlogic did. I have no idea if it works... If some of you could test it, I would be happy!

I also thought there might be something for Linux, and found some old projects (bsign, elfsign, elfgpg, SignElf, DigSig-ng), but it seems no one is actually doing it (as far as I can tell).

I would love to get some feedback on this idea

@PokeMMO
Copy link
Contributor

PokeMMO commented Jan 3, 2025

osslsigncode can be used to sign windows modules from linux.

Linux itself doesn't really have any codesigning standards that would be worth doing here. Linux typically signs at package level, not at individual code.

See:
https://github.com/mtrojnar/osslsigncode
https://docs.digicert.com/en/software-trust-manager/client-tools/signing-tools/third-party-signing-tool-integrations/osslsigncode.html

@SimonIT
Copy link
Member Author

SimonIT commented Jan 3, 2025

I know osslsigncode, what is wrong with jsign?

@PokeMMO
Copy link
Contributor

PokeMMO commented Jan 3, 2025

Oh, I can't read, I thought this PR did macos only so far. lol

@@ -258,6 +263,10 @@ private void checkForTasksToAdd (BuildTarget target) {
jnigenBuildTask.setBuildTarget(target);
jnigenBuildTask.dependsOn(jnigenTask);

JnigenSignTask jnigenSignTask = project.getTasks().create("jnigenSign" + os.name() + "_" + architecture.getDisplayName() + bitness.name(), JnigenSignTask.class, this);
jnigenSignTask.setBuildTarget(target);
jnigenSignTask.dependsOn(jnigenBuildTask);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we maybe add the jnigenSign task conditionally, based on whether signing was configured?
And if signing is configured, adding something like:
jnigenBuildTask.finalizedBy(jnigenSignTask)?
Conceptionally I feel like signing belongs more to the packaging step, but I guess that doesn't work well with the current jnigen setup that packages everything on a linux host.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added a check to add the tasks only when configured.
I don't really have an opinion on finalizedBy or dependsOn

@SimonIT
Copy link
Member Author

SimonIT commented Jan 6, 2025

I just found zsign. Maybe we could replace codesign with it to be able to sign cross platform?

@Berstanio
Copy link
Contributor

I just found zsign. Maybe we could replace codesign with it to be able to sign cross platform?

I think having cross-platform signing for all targets would be certainly great.
I also heard good things about this rust implementation: https://github.com/indygreg/apple-platform-rs/tree/main/apple-codesign

But both have kinda the pain, that we would need to compile them for the targets.

@PokeMMO
Copy link
Contributor

PokeMMO commented Jan 7, 2025

I would rather see this being done at compile time. I don't see a real benefit of signing cross platform unless we also can build cross platform.

@Berstanio
Copy link
Contributor

unless we also can build cross platform.

Don't we theoretically support things like https://github.com/tpoechtrager/osxcross ?

@PokeMMO
Copy link
Contributor

PokeMMO commented Jan 7, 2025

We do, but it's not built in. You have to manually specify in your config file the prefix and that it can run on linux. We could do the same for the codesign part by making the codesign invoke configurable.

@SimonIT
Copy link
Member Author

SimonIT commented Jan 7, 2025

I also tested it on a MacBook today. Everything seems to work fine.
Maybe we can leave the cross-platform macOS compilation and signing for a new PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants