-
Notifications
You must be signed in to change notification settings - Fork 0
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
Refactor into class. #8
base: master
Are you sure you want to change the base?
Conversation
@Ryanb58 Wow, this looks excellent Taylor! |
), | ||
critical=True | ||
) | ||
cert = cert.sign(key, hashes.SHA256(), default_backend()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Signing the certificate with it's own key should probably be an option (self_sign=True
) since it is not always desirable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I made the proper modifications to meet this need. LMK what you think of my implementation.
main.py
Outdated
'org', | ||
'org_name', | ||
'common' | ||
]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are two places that you transfer these attributes to x509.NameAttribute
instances. You can make that a method on this class. You can actually inherit from a namedtuple
class, and add properties / methods to it, like this:
class CertAttributes(namedtuple(...)):
def to_x509(self):
pass
main.py
Outdated
LOGGER.debug('Writing PEM encoded CSR to %s', fobj.name) | ||
fobj.write(csr.public_bytes(serialization.Encoding.PEM)) | ||
fobj.write(b'\n') | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All of these save functions should probably assert
that the format parameter is 'pem'
and raise otherwise, like:
if format != 'pem':
raise NotImplementedError('%s format unsupported, use pem' % format)
No description provided.