File tree Expand file tree Collapse file tree 3 files changed +5
-32
lines changed
Expand file tree Collapse file tree 3 files changed +5
-32
lines changed Original file line number Diff line number Diff line change 77from binascii import hexlify
88from functools import cached_property
99
10- import chardet
11-
1210from pkcs11 import CancelStrategy
1311from pkcs11 .constants import (
1412 Attribute ,
@@ -43,17 +41,8 @@ def __hash__(self):
4341
4442
4543def _CK_UTF8CHAR_to_str (data ):
46- """Convert _CK_UTF8CHAR_to_str to string using chardet for encoding detection."""
47- cleaned_data = data .rstrip (b"\0 " )
48-
49- detected_encoding = chardet .detect (cleaned_data )
50- encoding = detected_encoding ["encoding" ] or "utf-8"
51-
52- try :
53- return cleaned_data .decode (encoding ).rstrip ()
54- except UnicodeDecodeError :
55- # If decoding fails, try utf-8 with default error replacement character as a last resort
56- return cleaned_data .decode ("utf-8" , errors = "replace" ).rstrip ()
44+ """Convert CK_UTF8CHAR to string."""
45+ return data .rstrip (b"\0 " ).decode ("utf-8" ).rstrip ()
5746
5847
5948def _CK_VERSION_to_tuple (data ):
Original file line number Diff line number Diff line change @@ -23,10 +23,7 @@ classifiers = [
2323 " Programming Language :: Python :: 3.13" ,
2424 " Topic :: Security :: Cryptography" ,
2525]
26- dependencies = [
27- " asn1crypto>=1.5.1" ,
28- " chardet>=5.2.0" ,
29- ]
26+ dependencies = [" asn1crypto>=1.5.1" ]
3027license = " MIT"
3128requires-python = " >=3.9"
3229dynamic = [" version" ]
@@ -122,4 +119,4 @@ dev = [
122119 { include-group = " release" },
123120]
124121
125- [tool .setuptools_scm ]
122+ [tool .setuptools_scm ]
You can’t perform that action at this time.
0 commit comments