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

feat: Parse certificate and extensions #52

Merged
merged 33 commits into from
Nov 5, 2023
Merged

feat: Parse certificate and extensions #52

merged 33 commits into from
Nov 5, 2023

Conversation

fulder
Copy link
Owner

@fulder fulder commented Nov 5, 2023

Large refactor into new CryptoParser extending pydantic models created by parsing cryptography x509 objects for:

  • Certificate
  • Certificates (list of Certificate)
  • Chain (extending Certificates)
  • CertificateRevocationList
  • Extension (including all x509.Extension implementations)
  • Name (previously called Subject)
  • OCSPResponse

All functions for e.g. revoke has been changed to use the new models and some root functions has been moved into the models:

  • [BREKING] pki_tools.cert_from_pem moved to Certificate.from_pem_string static class method
  • [BREKING] pki_tools.get_cert_serial moved to Certificate.serial_number class property
  • [BREKING] pki_tools.parse_subject moved to Certificate.from_cryptography static class method and once loaded the Certificate.subject class property, returning a Name model, can be used instead
  • [BREKING] pki_tools.pem_from_cert moved to Certificate.pem_string class property
  • [BREKING] pki_tools.read_from_file moved to Certificate.from_file static class method
  • [BREKING] pki_tools.read_many_from_file moved to Certificates.from_file static class method
  • [BREKING] pki_tools.save_to_file moved to Certificate.to_file class method
  • [BREKING] pki_tools.verify_signature now requires the new Certificate, CertificateRevocationList or OCSPResponse models for signed parameter and Certificate for the issuer
  • [BREKING] pki_tools.is_revoked and pki_tools.is_revoked_multiple_issuers now requires the new Certificate and Chain models for the cert and chain parameters
  • All imports from pki_tools can now be imported using just the root pki_tools package. Meaning e.g. the old from pki_tools.types import Chain should now be changed to from pki_tools import Chain instead
  • [BREKING] PemCert type has been removed, instead use the from_pem_string static class methods

@fulder fulder merged commit f1d1285 into main Nov 5, 2023
6 checks passed
@fulder fulder deleted the parse-certificate branch November 5, 2023 14:24
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