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

It isnt possible to sign binary data? #491

Closed
honiahaka10 opened this issue Dec 7, 2023 · 3 comments · Fixed by #495
Closed

It isnt possible to sign binary data? #491

honiahaka10 opened this issue Dec 7, 2023 · 3 comments · Fixed by #495
Assignees
Labels
bug Compliance Compliance with applicable specifications
Milestone

Comments

@honiahaka10
Copy link

Hi! I want to sign binary data in payload.
Payload is detached and headers are:
['b64' => false, 'crit' => ['b64']].

$jwsBuilder = new JWSBuilder([new PS256]);
$jwsBuilder = $jwsBuilder->create()->withPayload($binaryPayload, true);

This causes new InvalidArgumentException('The payload must be encoded in UTF-8');
When i get rid of that exception by manually deleting it signing and verifying just works fine.

rfc7797 should allow binary detached payload.
https://datatracker.ietf.org/doc/html/rfc7797#section-5.1
A detached payload can contain any octet sequence representable by the application.

Am I doing something wrong or should the UTF-8 check only be done with nondetached payloads?

Best Regards

@Spomky
Copy link
Member

Spomky commented Dec 7, 2023

Hi,

Thank you for reporting this issue. Indeed, UTF8 is only required for unencoded non-detached payload. This exception should not be thrown.
I will fix it ASAP.

@Spomky Spomky self-assigned this Dec 7, 2023
@Spomky Spomky added bug Compliance Compliance with applicable specifications labels Dec 7, 2023
@Spomky Spomky added this to the 3.1.8 milestone Dec 7, 2023
@Spomky Spomky linked a pull request Jan 4, 2024 that will close this issue
@Spomky Spomky modified the milestones: 3.1.8, 3.2.9 Jan 4, 2024
@Spomky
Copy link
Member

Spomky commented Jan 4, 2024

Hi,

The issue is addressed in the related PR.
Will be tagged soon.

Best regards.

@Spomky Spomky closed this as completed Jan 4, 2024
Copy link
Contributor

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 25, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Compliance Compliance with applicable specifications
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants