Created
October 13, 2016 20:31
-
-
Save maurostorch/c24b4f2f31efe17d4d86318e221534d0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from OpenSSL import crypto | |
import os | |
fk = open('security/server.key','r') | |
k = crypto.load_privatekey(crypto.FILETYPE_PEM, fk.read()) | |
fcert = open('security/server.crt','r') | |
cert = crypto.load_certificate(crypto.FILETYPE_PEM, fcert.read()) | |
signature = crypto.sign(k, 'data', 'sha1') | |
try: | |
crypto.verify(cert, signature, 'data', 'sha1') | |
print('good signature') | |
except: | |
print('wrong signature') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment