13
13
lib as _lib ,
14
14
exception_from_error_queue as _exception_from_error_queue ,
15
15
byte_string as _byte_string ,
16
- native as _native ,
17
16
path_string as _path_string ,
18
17
UNSPECIFIED as _UNSPECIFIED ,
19
18
text_to_bytes_and_warn as _text_to_bytes_and_warn ,
@@ -672,7 +671,7 @@ def __repr__(self):
672
671
_openssl_assert (format_result != _ffi .NULL )
673
672
674
673
return "<X509Name object '%s'>" % (
675
- _native ( _ffi .string (result_buffer )),
674
+ _ffi .string (result_buffer ). decode ( "utf-8" ),
676
675
)
677
676
678
677
def hash (self ):
@@ -821,11 +820,11 @@ def _subjectAltNameString(self):
821
820
except KeyError :
822
821
bio = _new_mem_buf ()
823
822
_lib .GENERAL_NAME_print (bio , name )
824
- parts .append (_native ( _bio_to_string (bio )))
823
+ parts .append (_bio_to_string (bio ). decode ( "utf-8" ))
825
824
else :
826
- value = _native (
827
- _ffi . buffer ( name . d . ia5 . data , name . d . ia5 . length )[:]
828
- )
825
+ value = _ffi . buffer ( name . d . ia5 . data , name . d . ia5 . length )[
826
+ :
827
+ ]. decode ( "utf-8" )
829
828
parts .append (label + ":" + value )
830
829
return ", " .join (parts )
831
830
@@ -840,7 +839,7 @@ def __str__(self):
840
839
print_result = _lib .X509V3_EXT_print (bio , self ._extension , 0 , 0 )
841
840
_openssl_assert (print_result != 0 )
842
841
843
- return _native ( _bio_to_string (bio ))
842
+ return _bio_to_string (bio ). decode ( "utf-8" )
844
843
845
844
def get_critical (self ):
846
845
"""
@@ -1381,7 +1380,7 @@ def has_expired(self):
1381
1380
:return: ``True`` if the certificate has expired, ``False`` otherwise.
1382
1381
:rtype: bool
1383
1382
"""
1384
- time_string = _native ( self .get_notAfter ())
1383
+ time_string = self .get_notAfter (). decode ( "utf-8" )
1385
1384
not_after = datetime .datetime .strptime (time_string , "%Y%m%d%H%M%SZ" )
1386
1385
1387
1386
return not_after < datetime .datetime .utcnow ()
@@ -1850,13 +1849,11 @@ def _exception_from_context(self):
1850
1849
errors = [
1851
1850
_lib .X509_STORE_CTX_get_error (self ._store_ctx ),
1852
1851
_lib .X509_STORE_CTX_get_error_depth (self ._store_ctx ),
1853
- _native (
1854
- _ffi .string (
1855
- _lib .X509_verify_cert_error_string (
1856
- _lib .X509_STORE_CTX_get_error (self ._store_ctx )
1857
- )
1852
+ _ffi .string (
1853
+ _lib .X509_verify_cert_error_string (
1854
+ _lib .X509_STORE_CTX_get_error (self ._store_ctx )
1858
1855
)
1859
- ),
1856
+ ). decode ( "utf-8" ) ,
1860
1857
]
1861
1858
# A context error should always be associated with a certificate, so we
1862
1859
# expect this call to never return :class:`None`.
0 commit comments