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

pem-rfc7468: add detect_base64_line_width and new_detect_wrap #1464

Merged
merged 1 commit into from
Jul 28, 2024

Conversation

tarcieri
Copy link
Member

Adds the following new functions:

  • detect_base64_line_width: a toplevel free function similar to decode_label which outputs an autodetected line width for a given input PEM byte slice.
  • Decoder::new_detect_wrap: an alternative to Decoder::new_wrapped which attempts to autodetect the Base64 line width in order to flexibly handle inputs wrapped at any size.

For an initial implementation, empty space between the pre-encapsulation boundary and the start of the Base64 is not handled.

Adds the following new functions:

- `detect_base64_line_width`: a toplevel free function similar to
  `decode_label` which outputs an autodetected line width for a given
  input PEM byte slice.
- `Decoder::new_detect_wrap`: an alternative to `Decoder::new_wrapped`
  which attempts to autodetect the Base64 line width in order to
  flexibly handle inputs wrapped at any size.

For an initial implementation, empty space between the pre-encapsulation
boundary and the start of the Base64 is not handled.
@tarcieri tarcieri merged commit a2f59e9 into master Jul 28, 2024
38 checks passed
@tarcieri tarcieri deleted the pem-rfc7468/add-detect_base64_line_width branch July 28, 2024 18:41
tarcieri added a commit to RustCrypto/SSH that referenced this pull request Jul 28, 2024
Uses the line width detection support added to `pem-rfc7468` in
RustCrypto/formats#1464 to automatically detect the input line width and
parse PEM documents accordingly, which allows support for a wider range
of SSH keys which don't use the default 70 chars of line wrapping.

Closes #195
tarcieri added a commit to RustCrypto/SSH that referenced this pull request Jul 28, 2024
Uses the line width detection support added to `pem-rfc7468` in
RustCrypto/formats#1464 to automatically detect the input line width and
parse PEM documents accordingly, which allows support for a wider range
of SSH keys which don't use the default 70 chars of line wrapping.

Fixes #195
tarcieri added a commit to RustCrypto/SSH that referenced this pull request Jul 28, 2024
Uses the line width detection support added to `pem-rfc7468` in
RustCrypto/formats#1464 to automatically detect the input line width and
parse PEM documents accordingly, which allows support for a wider range
of SSH keys which don't use the default 70 chars of line wrapping.

Fixes #195
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

Successfully merging this pull request may close these issues.

1 participant