Skip to content

Commit d561eca

Browse files
committed
WSAA: fix issue reingart#131
1 parent 91661db commit d561eca

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

wsaa.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,10 @@ def create_tra(service=SERVICE, ttl=2400):
112112
def sign_tra_new(tra, cert=CERT, privatekey=PRIVATEKEY, passphrase=""):
113113
"Sign Digital transactions with cryptography versions >= 39 in python 3"
114114
# Leer privatekey y cert
115-
if not privatekey.startswith(b"-----BEGIN RSA PRIVATE KEY-----"):
115+
if not privatekey.startswith((
116+
b"-----BEGIN RSA PRIVATE KEY-----",
117+
b"-----BEGIN PRIVATE KEY-----",
118+
b"-----BEGIN ENCRYPTED PRIVATE KEY-----")):
116119
privatekey = open(privatekey).read()
117120
if isinstance(privatekey, str):
118121
privatekey = privatekey.encode("utf-8")
@@ -155,7 +158,10 @@ def sign_tra_old(tra, cert=CERT, privatekey=PRIVATEKEY, passphrase=""):
155158
"Legacy method for signing python 2.7 digital transactions on python 2.7"
156159

157160
# Leer privatekey y cert
158-
if not privatekey.startswith(b"-----BEGIN RSA PRIVATE KEY-----"):
161+
if not privatekey.startswith((
162+
b"-----BEGIN RSA PRIVATE KEY-----",
163+
b"-----BEGIN PRIVATE KEY-----",
164+
b"-----BEGIN ENCRYPTED PRIVATE KEY-----")):
159165
privatekey = open(privatekey).read()
160166
if isinstance(privatekey, str):
161167
privatekey = privatekey.encode("utf-8")

0 commit comments

Comments
 (0)