2
0
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:
Peter Hamilton
2017-09-26 16:07:52 -04:00
parent 833b936603
commit 98db0dfe73
3 changed files with 274 additions and 160 deletions

View File

@@ -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()
)