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

tag "c=" without "/..." == part with "/..." Optional part at rfc! #10

Open
jetsam729 opened this issue Mar 7, 2021 · 1 comment
Open

Comments

@jetsam729
Copy link

jetsam729 commented Mar 7, 2021

Warning: Undefined array key 1 Validator.php on line...
...
Fatal error: Uncaught TypeError: ...::canonicalizeBody(): Argument #2 ($style) must be of type string, null given, 

error at:
line 87: [$headerCA, $bodyCA] = explode('/', $dkimTags['c']);

rfc4871-dkimbase.html#dkim-sig-hdr
rfc6376#section-3.5
..If only one algorithm is named, that algorithm is used for the header and "simple" is used for the body. For example, "c=relaxed" is treated the same as "c=relaxed/simple"...

maybe add before as:
if(empty($dkimTags['c'])) $dkimTags['c'] = 'simple/simple';
if(!str_contains($dkimTags['c'],'/')) $dkimTags['c'] .='/simple';

example - email from phpclasses.org as "DKIM-Signature: v=1; a=rsa-sha256; c=simple; d=phpclasses.org;..."
AND - tag maybe not exists :) :
rfc6376#section-3.5 :
c= Message canonicalization (plain-text; OPTIONAL, default is "simple/simple").

@LeonMelis
Copy link

It would be much cleaner to use the union array operator, like this:

[$headerCA, $bodyCA] = explode('/', $dkimTags['c']) + ['simple', 'simple'];

geek-merlin pushed a commit to geek-merlin/DKIMValidator that referenced this issue Dec 24, 2022
geek-merlin pushed a commit to geek-merlin/DKIMValidator that referenced this issue Dec 24, 2022
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

No branches or pull requests

2 participants