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

Error: signature data too large (please report this issue) #32

Closed
diamantisk opened this issue Oct 3, 2022 · 2 comments
Closed

Error: signature data too large (please report this issue) #32

diamantisk opened this issue Oct 3, 2022 · 2 comments
Labels
apple-codesign apple-codesign crate and rcodesign CLI tool bug Something isn't working

Comments

@diamantisk
Copy link

While trying to sign a binary with p12 certificate and a plist file (somehow large), I'm getting the following error:
Error: signature data too large (please report this issue)

If I remove some keys from the plist file it seems to work. But on the other hand, while I evolved the rust code a bit more, it seems that I have to remove more data from the plist file now.

Is this an issue? Or I'm doing something wrong?

The command is: rcodesign sign --entitlements-xml-path rustswift.entitlements --p12-file Certificates.p12 --p12-password Certificate --runtime-version 12.3.0 ./target/debug/rustswift

@indygreg indygreg added bug Something isn't working apple-codesign apple-codesign crate and rcodesign CLI tool labels Oct 3, 2022
@indygreg
Copy link
Owner

indygreg commented Oct 3, 2022

We have to estimate the size of the final signature to reserve space for it.

The bug here is that code (estimate_embedded_signature_size() in macho.rs) doesn't account for the embedded plist data. (The code is also not very precise and I'm somewhat surprised it took this long for someone to find an issue!)

There are some other pieces of data (e.g. designated requirements) that it also fails to account for. See create_special_blobs() in macho_signing.rs. But the plist is likely the only one large enough to cause us to overrun the extra padding we provide.

The quick fix here is adding code similar to

if let Some(entitlements) = settings.entitlements_xml(SettingsScope::Main)? {
to estimate_embedded_signature_size() to increase the estimated size to account for the XML and DER encoded plist data.

@indygreg
Copy link
Owner

indygreg commented Nov 8, 2022

Should be fixed by #40.

@indygreg indygreg closed this as completed Nov 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
apple-codesign apple-codesign crate and rcodesign CLI tool bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants