extend X509 and PKey object with modulus function

Bug #735449 reported by Wouter van Bommel
14
This bug affects 3 people
Affects Status Importance Assigned to Milestone
pyOpenSSL
Confirmed
Undecided
Wouter van Bommel

Bug Description

The current X509 and PKey objects lack an interface to the modulus function.
This function can be used to determine if an private key and a public key form a pair

Revision history for this message
Wouter van Bommel (woutervb) wrote :

The attached patch implements the modulus function in both X509 & PKey objects.
Patch is developed against 0.10 release of pyOpenSSL

Revision history for this message
Jean-Paul Calderone (exarkun) wrote :

Thanks for the patch. Are you interested in writing some unit tests for these two new methods as well?

Changed in pyopenssl:
assignee: nobody → Wouter van Bommel (woutervb)
status: New → Confirmed
Revision history for this message
Wouter van Bommel (woutervb) wrote :

Adding the following code to test_crypto.py in the class X509ExtTests will perform a minimal self unittest of the modulus function.

    def test_modulus(self):
        """
        The modulus of the certificate and the private key should
        match
        """
        self.assertEqual(self.pkey.modulus(), self.x509.modulus())

Revision history for this message
Stefan Reinhard (guetux) wrote :

I would love to see this patch accepted in the mainline. Do we need to test this any further?

Revision history for this message
Wouter van Bommel (woutervb) wrote :

I have no idea to be honest, the patch is running in productions since it was created (or actually before). There should be little issues with it, as it really is a wrapper around libssl.
So unittest are hard, as you want to test the function and not the libssl library.

That is way (in my opinion) a simple call test is sufficient

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.