From ac3e5bbf3eb6278973c7f417c56d69bfe2074920 Mon Sep 17 00:00:00 2001 From: Paul Kehrer Date: Thu, 2 Apr 2015 23:07:10 -0500 Subject: add repr to KeyUsage --- src/cryptography/x509.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'src') diff --git a/src/cryptography/x509.py b/src/cryptography/x509.py index 63c8767d..17ef6ddd 100644 --- a/src/cryptography/x509.py +++ b/src/cryptography/x509.py @@ -312,6 +312,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 ("").format( + self, encipher_only, decipher_only) + OID_COMMON_NAME = ObjectIdentifier("2.5.4.3") OID_COUNTRY_NAME = ObjectIdentifier("2.5.4.6") -- cgit v1.2.3