mirror of
https://github.com/openkmip/pykmip
synced 2025-12-16 00:04:26 +00:00
Update how private keys are handled when signing data
This change updates how private key bytes are loaded when signing data. The prior approach required binascii to unhexlify the byte string. The current approach removes this requirement, matching the rest of the library. All unit tests have been updated to reflect this change.
This commit is contained in:
@@ -13,7 +13,6 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import binascii
|
||||
import logging
|
||||
import os
|
||||
|
||||
@@ -1204,14 +1203,14 @@ class CryptographyEngine(api.CryptographicEngine):
|
||||
|
||||
try:
|
||||
private_key = serialization.load_pem_private_key(
|
||||
binascii.unhexlify(bytes),
|
||||
bytes,
|
||||
password=None,
|
||||
backend=default_backend()
|
||||
)
|
||||
return private_key
|
||||
except:
|
||||
private_key = serialization.load_der_private_key(
|
||||
binascii.unhexlify(bytes),
|
||||
bytes,
|
||||
password=None,
|
||||
backend=default_backend()
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user