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

Add support for binary DER format cert files #974

Merged
merged 1 commit into from
Oct 4, 2024

Conversation

atc0005
Copy link
Owner

@atc0005 atc0005 commented Oct 4, 2024

Changes

  • update README file to list additional supported cert file input format
  • internal/textutils package
    • add EOL constants
    • add "normalize" functions
    • NormalizeNewlines
    • StripBlankLines
    • StripBlankAndNormalize
  • internal/certs package
    • add new sentinel errors
      • ErrUnsupportedFileFormat
      • ErrEmptyCertificateFile
      • ErrPEMParseFailureMalformedCertificate
      • ErrPEMParseFailureEmptyCertificateBlock
    • add (24) new PEM block type contants
      • e.g., PEMBlockTypeCRTBegin
    • update GetCertsFromFile function to act as an entry point for loading certificates from a given file for all supported formats instead of being dedicated strictly to PEM formatted certificate files
      • continue to support importing (text) PEM encoded format
      • add support for importing binary DER encoded format
      • detect common unsupported PEM encoded file formats so that we can list the given file as being of a specific unsupported file format
    • refactor bulk of PEM handling logic originally contained in GetCertsFromFile to separate functions
      • GetCertsFromPEMFile
      • ParsePEMCertificates

References

CHANGES

- update README file to list additional supported cert
  file input format
- `internal/textutils` package
  - add EOL constants
  - add "normalize" functions
  - `NormalizeNewlines`
  - `StripBlankLines`
  - `StripBlankAndNormalize`
- `internal/certs` package
  - add new sentinel errors
    - `ErrUnsupportedFileFormat`
    - `ErrEmptyCertificateFile`
    - `ErrPEMParseFailureMalformedCertificate`
    - `ErrPEMParseFailureEmptyCertificateBlock`
  - add (24) new PEM block type contants
    - e.g., `PEMBlockTypeCRTBegin`
  - update `GetCertsFromFile` function to act as an entry point for
    loading certificates from a given file for all supported formats
    instead of being dedicated strictly to PEM formatted certificate
    files
    - continue to support importing (text) PEM encoded format
    - add support for importing binary DER encoded format
    - detect common unsupported PEM encoded file formats so that we
      can list the given file as being of a specific unsupported file
      format
  - refactor bulk of PEM handling logic originally contained in
    `GetCertsFromFile` to separate functions
    - `GetCertsFromPEMFile`
    - `ParsePEMCertificates`

REFERENCES

refs GH-862
@atc0005 atc0005 added documentation Improvements or additions to documentation enhancement New feature or request plugin/check_cert app/lscert labels Oct 4, 2024
@atc0005 atc0005 added this to the v0.19.0 milestone Oct 4, 2024
@atc0005 atc0005 self-assigned this Oct 4, 2024
@atc0005 atc0005 merged commit bd0254c into master Oct 4, 2024
27 of 31 checks passed
@atc0005 atc0005 deleted the i862-add-support-for-der-encoded-cert-files branch October 4, 2024 15:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
app/lscert documentation Improvements or additions to documentation enhancement New feature or request plugin/check_cert
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add support for evaluating certificate files in DER format
1 participant