Skip to content

Key::parse_from_bind() cannot parse a file that ends with a line break. #466

@ximon18

Description

@ximon18

Given the following .key file Key::parse_from_bind() is able to parse it successfully:

example.org. IN DNSKEY 257 3 15 6VdB0mk5qwjHWNC5TTOw1uHTzA0m3Xadg7aYVbcRn8Y= ;{id = 38873 (ksk), size = 256b}

Change it by adding a line break at the end however and Key::parse_from_bind() fails with error ParseDnskeyTextError::Misformatted.

One can argue "but tools only generate valid files" so this isn't an issue but if it must be strict I would prefer a more useful error (I spent >10 minutes investigating this as I assumed some other part of the input was incorrect).

Yes I hit this issue because I didn't generate the file using a tool like ldns-keygen but instead copied a .key file content from test code into an actual file on disk and accidentally added a trailing line break while doing so, so one can attribute this to user error, but this poor user would appreciate a better error message...

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions