Skip to content

Commit 408596b

Browse files
committed
Remove unused and broken RSA code
commit afdf5b4 broke the RSA type that was provided by Cryptodome.PublicKey. This breakage did not seem to break tests or existing setups - I believe it is safe to remove the code altogether. Signed-off-by: Ivan Kanakarakis <[email protected]>
1 parent f06a327 commit 408596b

File tree

1 file changed

+0
-48
lines changed

1 file changed

+0
-48
lines changed

src/saml2/sigver.py

Lines changed: 0 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -488,54 +488,6 @@ def base64_to_long(data):
488488
return intarr2long(dehexlify(_d))
489489

490490

491-
def key_from_key_value(key_info):
492-
res = []
493-
for value in key_info.key_value:
494-
if value.rsa_key_value:
495-
e = base64_to_long(value.rsa_key_value.exponent)
496-
m = base64_to_long(value.rsa_key_value.modulus)
497-
key = RSA.construct((m, e))
498-
res.append(key)
499-
return res
500-
501-
502-
def key_from_key_value_dict(key_info):
503-
res = []
504-
if not "key_value" in key_info:
505-
return res
506-
507-
for value in key_info["key_value"]:
508-
if "rsa_key_value" in value:
509-
e = base64_to_long(value["rsa_key_value"]["exponent"])
510-
m = base64_to_long(value["rsa_key_value"]["modulus"])
511-
key = RSA.construct((m, e))
512-
res.append(key)
513-
return res
514-
515-
516-
# =============================================================================
517-
518-
519-
# def rsa_load(filename):
520-
# """Read a PEM-encoded RSA key pair from a file."""
521-
# return M2Crypto.RSA.load_key(filename, M2Crypto.util
522-
# .no_passphrase_callback)
523-
#
524-
#
525-
# def rsa_loads(key):
526-
# """Read a PEM-encoded RSA key pair from a string."""
527-
# return M2Crypto.RSA.load_key_string(key,
528-
# M2Crypto.util.no_passphrase_callback)
529-
530-
531-
def rsa_eq(key1, key2):
532-
# Check if two RSA keys are in fact the same
533-
if key1.n == key2.n and key1.e == key2.e:
534-
return True
535-
else:
536-
return False
537-
538-
539491
def extract_rsa_key_from_x509_cert(pem):
540492
cert = load_pem_x509_certificate(pem, backend)
541493
return cert.public_key()

0 commit comments

Comments
 (0)