Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8466387
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T15:19:36+00:00 2026-06-10T15:19:36+00:00

I believe that since this question , pyOpenSSL has started supporting the verification of

  • 0

I believe that since this question, pyOpenSSL has started supporting the verification of signatures (as of pyOpenSSL 0.11.

I am working on a project which was started by someone else using M2Crypto. M2Crypto is really painful to include on platforms such as Heroku as it requires the use of SWIG. Consequently I am trying to remove the dependency on M2Crypto and replace with pyOpenSSL which is easy to install via Pip, and doesn’t require custom buildpacks and more which SWIG-related things do.

The issue I’m having is replacing a bit of code:

key = cert.get_pubkey() # Cert is an M2Crypto X509 object
key = key.get_rsa()
ret = key.verify(hashed, self.sig)
if ret != 1:
    # Cert invalid ... etc.

Ideally I’d like to implement the same functionality via pyOpenSSL, but feel I might have got the wrong end of the stick – I’ve tried using:

crypto.verify(cert, self.sig, hashed, 'sha1')

But this fails –

[('rsa routines', 'RSA_verify', 'bad signature')]

I can’t work out whether it is failing because the signature is actually bad, or because the values I’m providing crypto.verify are actually not what it is supposed to be used for!

The original code I’ve been playing with is here and needs quite a bit of work to tidy up, but was trying to do it one step at a time replacing functionality before a total refactoring. Any pointers would be much appreciated! Does pyOpenSSL have the capability to replace the M2Crypto functionality here, and am I going about it the right way?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T15:19:38+00:00Added an answer on June 10, 2026 at 3:19 pm

    So the answer comes from reading a bit more of the source of pyOpenSSL, with a pointer from exarkun. pyOpenSSL can indeed replace the M2Crypto dependency here, with very minor changes to the underlying code.

    The unittest for the crypto.verify() function here shows the call taking:

    verify(good_cert, sig, content, digest)
    

    Consequently there was an error in my above code:

    crypto.verify(cert, self.sig, hashed, 'sha1')
    

    Which should have simply taken ‘data’, rather than hashed, as the signature was applied to the raw data string:

    # N.B. cert = X509 object (from crypto.load_certificate())
    crypto.verify(cert, self.sig, data, 'sha1')
    

    This behaviour appears different to that of M2Crypto’s verify which takes the hashed data string to perform its verification. Note I haven’t dug particularly deep into M2Crypto’s functions to work out what is going on.

    Thanks to exarkun for his response on the pyOpenSSL mailing list which pointed me to the error being in my call to verify(), rather than my understanding of what verify() was doing.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This question has one major question, and one minor question. I believe I am
I see that this question has been asked before but the context around the
From this question one could start to believe that alignment of a union is
I believe this question is related to this one also, since I'm trying to
NOTE: I do believe that this is not an openCV related problem but since
I am beginning to believe that unit testing high level, well-written code, which requires
THIRD EDIT: I now believe that this problem is due to a SOAP version
PUBLIC SERVICE UPDATE: I've learned a lot since I originally posed this question. If
I'm not sure if this question has been answered in full or if my
Since this question is about the increment operator and speed differences with prefix/postfix notation,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.