2828from cryptography .hazmat .primitives .asymmetric import ec
2929from cryptography .hazmat .primitives .asymmetric import rsa
3030from cryptography .x509 .oid import NameOID , ExtensionOID
31- from six import string_types , binary_type
3231
3332from .errors import VenafiConnectionError , ServerUnexptedBehavior , BadData , ClientBadData
3433from .http_status import HTTPStatus
@@ -346,16 +345,16 @@ def __init__(self, cert_id=None,
346345
347346 def __setattr__ (self , key , value ):
348347 if key == "key_password" :
349- if isinstance (value , string_types ):
348+ if isinstance (value , str ):
350349 value = value .encode ()
351350 elif key == "common_name" :
352- if isinstance (value , binary_type ):
351+ if isinstance (value , bytes ):
353352 value = value .decode ()
354353 elif key == "key_type" :
355354 if value is not None and not isinstance (value , KeyType ):
356355 raise ClientBadData ("key_type should be instance of vcert.KeyType" )
357356 elif key == "private_key" :
358- if isinstance (value , string_types ):
357+ if isinstance (value , str ):
359358 value = serialization .load_pem_private_key (value .encode (),
360359 password = self .key_password , backend = default_backend ())
361360 if isinstance (value , rsa .RSAPrivateKey ):
@@ -368,9 +367,9 @@ def __setattr__(self, key, value):
368367 raise ClientBadData (f"invalid private key type { type (value )} " )
369368 elif key == "csr" :
370369 self .csr_origin = CSR_ORIGIN_PROVIDED
371- if isinstance (value , binary_type ):
370+ if isinstance (value , bytes ):
372371 value = value .decode ()
373- elif not (isinstance (value , string_types ) or value is None ):
372+ elif not (isinstance (value , str ) or value is None ):
374373 raise ClientBadData (f"invalid csr type { type (value )} " )
375374 if value :
376375 csr = x509 .load_pem_x509_csr (value .encode (), default_backend ())
@@ -433,7 +432,7 @@ def build_csr(self):
433432 if self .organization :
434433 subject .append (x509 .NameAttribute (NameOID .ORGANIZATION_NAME , self .organization ))
435434 if self .organizational_unit :
436- if isinstance (self .organizational_unit , string_types ):
435+ if isinstance (self .organizational_unit , str ):
437436 subject .append (x509 .NameAttribute (NameOID .ORGANIZATIONAL_UNIT_NAME , self .organizational_unit ))
438437 elif isinstance (self .organizational_unit , list ):
439438 for u in self .organizational_unit :
0 commit comments