Skip to content

Commit 1648fc2

Browse files
fixing PyOpenSSL dependencies
1 parent c75d709 commit 1648fc2

File tree

9 files changed

+18
-20
lines changed

9 files changed

+18
-20
lines changed

oauth1/authenticationutils.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,7 @@
2626
# SUCH DAMAGE.
2727
#
2828

29-
from cryptography.hazmat.primitives.serialization import pkcs12
30-
from cryptography.hazmat.primitives import serialization
29+
from cryptography.hazmat.primitives.serialization import pkcs12
3130

3231

3332
def load_signing_key(pkcs12_filename, password):

oauth1/coreutils.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,11 @@
2828
"""
2929
Utility file having common functions
3030
"""
31-
import hashlib
3231
import base64
33-
import urllib
32+
import hashlib
3433
import time
34+
import urllib
3535
from random import SystemRandom
36-
3736
from urllib.parse import urlparse, parse_qsl
3837

3938

oauth1/oauth.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,12 @@
2626
# SUCH DAMAGE.
2727
#
2828
import json
29-
import oauth1.coreutils as util
30-
from OpenSSL import crypto
29+
3130
from cryptography.hazmat.primitives import hashes
3231
from cryptography.hazmat.primitives.asymmetric import padding
3332

33+
import oauth1.coreutils as util
34+
3435

3536
class OAuth:
3637
EMPTY_STRING = ""
@@ -87,9 +88,9 @@ def get_base_string(url, method, oauth_parameters):
8788
def sign_message(message, signing_key):
8889
# Signs the message using the private signing key
8990
signature = signing_key.sign(message.encode("utf-8"),
90-
padding.PKCS1v15(),
91-
hashes.SHA256())
92-
91+
padding.PKCS1v15(),
92+
hashes.SHA256())
93+
9394
return util.base64_encode(signature)
9495

9596

oauth1/oauth_ext.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
# IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2626
# SUCH DAMAGE.
2727
#
28-
from OpenSSL.crypto import PKey
2928
from requests import PreparedRequest
3029
from requests.auth import AuthBase
3130

@@ -44,7 +43,7 @@ class OAuth1RSA(AuthBase):
4443
>>> requests.post('https://endpoint.com/the/route', data={'foo': 'bar'}, auth=oauth)
4544
"""
4645

47-
def __init__(self, consumer_key: str, signing_key: PKey):
46+
def __init__(self, consumer_key: str, signing_key: bytes):
4847
self.consumer_key = consumer_key
4948
self.signing_key = signing_key
5049

oauth1/signer_interceptor.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,13 @@
2626
# SUCH DAMAGE.
2727
#
2828
from functools import wraps
29-
from oauth1.oauth import OAuth
30-
from oauth1 import authenticationutils
3129
from urllib.parse import urlencode
30+
3231
from deprecated import deprecated
3332

33+
from oauth1 import authenticationutils
34+
from oauth1.oauth import OAuth
35+
3436

3537
class SignerInterceptor(object):
3638

oauth1/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
# -*- coding: utf-8 -*-
2-
__version__ = '1.8.0'
2+
__version__ = '1.9.0'

requirements.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
requests==2.27.1
22
Deprecated==1.2.5
3-
cryptography>=42.0.0
4-
pyOpenSSL>=23.3.0
3+
cryptography>=42.0.0

setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#
2-
# Copyright 2019-2021 Mastercard
2+
# Copyright 2019-2024 Mastercard
33
#
44
# Redistribution and use in source and binary forms, with or without modification, are
55
# permitted provided that the following conditions are met:
@@ -46,5 +46,5 @@
4646
'Topic :: Software Development :: Libraries :: Python Modules'
4747
],
4848
tests_require=['coverage'],
49-
install_requires=['requests','pyOpenSSL>=22.1.0,<=23.2.0','urllib3', 'Deprecated']
49+
install_requires=['requests','cryptography>=42.0.0','urllib3', 'Deprecated']
5050
)

tests/test_utils.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
#
2929
import unittest
3030
import oauth1.authenticationutils as authenticationutils
31-
from OpenSSL import crypto
3231
from cryptography.hazmat.primitives import serialization
3332

3433

0 commit comments

Comments
 (0)