Skip to content

Commit 60e7119

Browse files
committed
Add a warning to the cryptography backend to keep it consistent with the other backends
1 parent ee760fc commit 60e7119

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

jose/backends/cryptography_backend.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from __future__ import division
22

33
import math
4+
import warnings
45

56
import six
67

@@ -294,8 +295,12 @@ def sign(self, msg):
294295
return signature
295296

296297
def verify(self, msg, sig):
298+
if not self.is_public():
299+
warnings.warn("Attempting to verify a message with a private key. "
300+
"This is not recommended.")
301+
297302
try:
298-
self.prepared_key.verify(
303+
self.public_key().prepared_key.verify(
299304
sig,
300305
msg,
301306
padding.PKCS1v15(),

0 commit comments

Comments
 (0)