Skip to content

Commit 4043abd

Browse files
committed
Accept PyOpenSSL cert input, add deprecation warning
1 parent 40a6674 commit 4043abd

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

signxml/verifier.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from base64 import b64decode
22
from dataclasses import dataclass, replace
33
from typing import Callable, FrozenSet, List, Optional, Union
4+
from warnings import warn
45

56
import cryptography.exceptions
67
from cryptography import x509
@@ -371,6 +372,13 @@ def verify(
371372
if x509_cert or cert_resolver:
372373
self.config = replace(self.config, require_x509=True)
373374

375+
if x509_cert and str(type(x509_cert)) == "<class 'OpenSSL.crypto.X509'>":
376+
warn(
377+
"SignXML received a PyOpenSSL object as x509_cert input. Please pass a Cryptography.X509 object instead.",
378+
DeprecationWarning
379+
)
380+
x509_cert = x509_cert.to_cryptography()
381+
374382
if id_attribute is not None:
375383
self.id_attributes = (id_attribute,)
376384

0 commit comments

Comments
 (0)