-
Notifications
You must be signed in to change notification settings - Fork 2
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
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Fix parse bugs
Also fix all failing tests and use extensions in OCSP
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Large refactor into new
CryptoParser
extending pydantic models created by parsing cryptography x509 objects for:Certificate
Certificates
(list ofCertificate
)Chain
(extendingCertificates
)CertificateRevocationList
Extension
(including allx509.Extension
implementations)Name
(previously calledSubject
)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:
pki_tools.cert_from_pem
moved toCertificate.from_pem_string
static class methodpki_tools.get_cert_serial
moved toCertificate.serial_number
class propertypki_tools.parse_subject
moved toCertificate.from_cryptography
static class method and once loaded theCertificate.subject
class property, returning aName
model, can be used insteadpki_tools.pem_from_cert
moved toCertificate.pem_string
class propertypki_tools.read_from_file
moved toCertificate.from_file
static class methodpki_tools.read_many_from_file
moved toCertificates.from_file
static class methodpki_tools.save_to_file
moved toCertificate.to_file
class methodpki_tools.verify_signature
now requires the newCertificate
,CertificateRevocationList
orOCSPResponse
models forsigned
parameter andCertificate
for the issuerpki_tools.is_revoked
andpki_tools.is_revoked_multiple_issuers
now requires the newCertificate
andChain
models for the cert and chain parameterspki_tools
can now be imported using just the rootpki_tools
package. Meaning e.g. the oldfrom pki_tools.types import Chain
should now be changed tofrom pki_tools import Chain
insteadPemCert
type has been removed, instead use thefrom_pem_string
static class methods