Revert a bunch of rsafp stuff now that DCRUP isn't going to do rsafp

This commit is contained in:
Scott Kitterman
2017-11-18 20:17:35 -05:00
parent 939c3f8bba
commit 01a2f77481
10 changed files with 32 additions and 163 deletions
-10
View File
@@ -25,7 +25,6 @@ __all__ = [
'parse_pem_private_key',
'parse_private_key',
'parse_public_key',
'get_rsa_pubkey',
'RSASSA_PKCS1_v1_5_sign',
'RSASSA_PKCS1_v1_5_verify',
'UnparsableKeyError',
@@ -34,7 +33,6 @@ __all__ = [
import base64
import hashlib
import re
import rsa
from dkim.asn1 import (
ASN1FormatError,
@@ -235,14 +233,6 @@ def rsa_decrypt(message, pk, mlen):
return int2str(m2 + h * pk['prime2'], mlen)
def get_rsa_pubkey(privkey):
"""Extract RSA public key from PEM encoded RSA private key for use with
rsafp. Returns base64 encoded public key suitable for use in DKIM key
records. Using python-rsa instead of making a stack of custom code.
@since: 0.7"""
pkobj = rsa.PrivateKey.load_pkcs1(privkey, 'PEM')
pubobj = rsa.key.PublicKey(pkobj.n, pkobj.e)
return(base64.b64encode(rsa.PublicKey.save_pkcs1(pubobj, 'DER')))
def rsa_encrypt(message, pk, mlen):
"""Perform RSA encryption/verification