Skip to content

Support MacOS ad hoc signing on all platforms #34917

Open
@JeyJeyGao

Description

@JeyJeyGao

Description

I am currently working on a cross-platform binary project, notation-azure-kv, based on .NET. We have recently run into an issue where our cross-compiled binary is unable to function properly on macOS due to the absence of macOS CodeSign.

As you might know, the CodeSign process can only be executed on macOS. This makes the release procedure for cross-platform binaries more complicated, as every developer is required to construct their own macOS-specific pipeline in order to integrate the CodeSign.

Given this, I suggest that .NET should implement macOS CodeSign in its offerings instead of call the codesign binary on macOS, so the codesign can be done on any OS. By doing so, it would greatly simplify the CodeSign process and would make .NET a more appealing and efficient language for cross-platform binary products.

Moreover, if this functionality was combined with .NET's Ahead-of-Time (AOT) compilation feature, .NET would be even more robust and efficient as a Command Line Interface (CLI) language. This would streamline the development process for all .NET developers and potentially open up .NET to more use-cases in the future.

Reproduction Steps

On an Linux machine, run:

dotnet publish \
    --configuration Release \
    --self-contained true \
    -p:PublishSingleFile=true \
    -r osx-arm64 \
    -o "$output_dir/binary-name"

to build an macOS binary. Then run the binary on ARM based macOS machine, the binary will be killed because of no codesign.

Expected behavior

The codesign should be done in a platform independent way like Golang. https://github.com/golang/go/blob/master/src/cmd/internal/codesign/codesign.go

Actual behavior

If the macOS binary was not built on macOS, the binary cannot run on an ARM macOS machine. The user needs to do codesign manually.

Regression?

No response

Known Workarounds

No response

Configuration

No response

Other information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-Hosthelp wantedIssues that we would accept external contributions on. Also known as up-for-grabs.

    Type

    No type

    Projects

    Status

    No status

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions