'A certificate matches the private key it is meant to
be paired with.'

def test_certificate_matches_private_key(self):

    path = FilePath(self.mktemp())
    path.makedirs()
    ca = RootCredential.initialize(path, 'mycluster')
    priv = ca.credential.keypair.keypair.original
    pub = ca.credential.certificate.getPublicKey().original
    pub_asn1 = crypto.dump_privatekey(crypto.FILETYPE_ASN1, pub)
    priv_asn1 = crypto.dump_privatekey(crypto.FILETYPE_ASN1, priv)
    pub_der = asn1.DerSequence()
    pub_der.decode(pub_asn1)
    priv_der = asn1.DerSequence()
    priv_der.decode(priv_asn1)
    pub_modulus = pub_der[1]
    priv_modulus = priv_der[1]
    self.assertEqual(pub_modulus, priv_modulus)
