diff options
author | Alex Gaynor <alex.gaynor@gmail.com> | 2015-04-12 09:20:43 -0400 |
---|---|---|
committer | Alex Gaynor <alex.gaynor@gmail.com> | 2015-04-12 09:20:43 -0400 |
commit | d459a8a16c417e0db59de0a643aeb9079b45b9bb (patch) | |
tree | 4781fed44bdbdb6d83084e741ee8d2cdc51eb7bd /src | |
parent | b8d29e0dcbfea18cac85e41b13391ddd481be816 (diff) | |
parent | ac3e5bbf3eb6278973c7f417c56d69bfe2074920 (diff) | |
download | cryptography-d459a8a16c417e0db59de0a643aeb9079b45b9bb.tar.gz cryptography-d459a8a16c417e0db59de0a643aeb9079b45b9bb.tar.bz2 cryptography-d459a8a16c417e0db59de0a643aeb9079b45b9bb.zip |
Merge pull request #1814 from reaperhulk/keyusage-repr
add repr to KeyUsage
Diffstat (limited to 'src')
-rw-r--r-- | src/cryptography/x509.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/cryptography/x509.py b/src/cryptography/x509.py index 8554aeab..a9b6f8bd 100644 --- a/src/cryptography/x509.py +++ b/src/cryptography/x509.py @@ -348,6 +348,23 @@ class KeyUsage(object): else: return self._decipher_only + def __repr__(self): + try: + encipher_only = self.encipher_only + decipher_only = self.decipher_only + except ValueError: + encipher_only = "N/A" + decipher_only = "N/A" + + return ("<KeyUsage(digital_signature={0.digital_signature}, " + "content_commitment={0.content_commitment}, " + "key_encipherment={0.key_encipherment}, " + "data_encipherment={0.data_encipherment}, " + "key_agreement={0.key_agreement}, " + "key_cert_sign={0.key_cert_sign}, crl_sign={0.crl_sign}, " + "encipher_only={1}, decipher_only={2})>").format( + self, encipher_only, decipher_only) + class SubjectKeyIdentifier(object): def __init__(self, digest): |