Skip to content

Feature needed for letsencrypt to use us instead of M2Crypto #1957

Closed

Description

@alex
  • x509.Certificate
    • public_bytes()
      • Encoding.DER
      • Encoding.PEM
    • check validty
  • x509.CertificateBuilder
    • RSA public key
    • serial number
    • version
    • not after
    • not before
    • subject
    • issuer
    • extensions
      • basic constraints
      • SAN
    • SHA256 signature
  • x509.CSR
    • public_bytes()
      • Encoding.DER
      • Encoding.PEM
    • check validty
  • x509.CSRBuilder
    • RSA Public Key
    • subject
    • extensions
      • SAN
    • SHA256 signature

Activity

  1. added this to the Tenth Release milestone on May 14, 2015
  2. AndreLouisCaron commented on May 19, 2015

    @AndreLouisCaron
    Contributor

    Note that I'm working on most of these ATM.

    Some of the work has already landed:

    • x509.CSR.public_bytes()

    Some of the work is in open PRs:

    • x509.CSRBuilder (everything except SAN extension and SHA256 signature)
    • x509.CertificateBuilder (everything except SAN extension and SHA256 signature)
    • x509.Certificate.public_bytes()
  3. AndreLouisCaron commented on May 19, 2015

    @AndreLouisCaron
    Contributor

    Out of curiosity, where does this list come from? From Let's Encrypt's website and GitHub repository, it looks like the server-side code is written in Go...

  4. alex commented on May 19, 2015

    @alex
    MemberAuthor

    It's based on me manually reading through:
    github.com/letsencrypt/lets-encrypt-preview

    On Mon, May 18, 2015 at 10:00 PM, André Caron [email protected]
    wrote:

    Out of curiosity, where does this list come from? From Let's Encrypt's
    website and GitHub repository, it looks like the server-side code is
    written in Go...

    —
    Reply to this email directly or view it on GitHub
    #1957 (comment).

    "I disapprove of what you say, but I will defend to the death your right to
    say it." -- Evelyn Beatrice Hall (summarizing Voltaire)
    "The people's good is the highest law." -- Cicero
    GPG Key fingerprint: 125F 5C67 DFE9 4084

  5. AndreLouisCaron commented on May 20, 2015

    @AndreLouisCaron
    Contributor

    Since I'm expecting for it to take a few days before the CSR builder is reviewed and suitably prepared for final submission, I might tackle the few remaining things in this list. In order to accelerate the process, you might be able to give me a bit of insight on how you see this added to the library.

    What's missing for SHA256 support? I suspect this might already be supported out of the box. Should I just add some tests and see if it works?

    For the CSR and certificate validity checks, would the following interface be correct?

    class Certificate:
        def verify(self, public_key):
            """
            Verify the certificate's signature using the issuer's public key.
            """
    
    class CertificateSigningRequest:
        def verify(self, public_key):
            """
            Verify the request's signature using the subject's public key.
            """
    
  6. reaperhulk commented on May 20, 2015

    @reaperhulk
    Member

    SHA256 will Just Work™ when your PR lands so yeah, that'll be fine. You're welcome to add a test (more tests never bad) though!

    The interface for CSR validity looks likely to be good as that's a simple problem.

    Certificate validity is a rabbit hole I'm terrified to go down right now... It involves chain resolution (which can generate multiple trusted chains and there's an RFC for that and browsers are dealing with some bad things related to the deprecation of SHA1 and 1024 bit roots), revocation checks (CRL, OCSP), etc. We need to know more about what validity means in the context of letsencrypt before we can determine what to do...

  7. AndreLouisCaron commented on May 20, 2015

    @AndreLouisCaron
    Contributor

    @reaperhulk Yikes, I probably don't want to go down that rabbit hole right away either... I have a few things on my own list after the 3 builders that are already in queue :-)

    OK, I'll see if I can add the CSR validity. When my CSR builder PR is merged, I'll add some extra tests for SHA256 signatures too.

  8. kuba commented on Jul 6, 2015

    @kuba

    Note to self: we also need x509.CSR.extensions (in particular .get_extension_for_oid(x509.OID_SUBJECT_ALTERNATIVE_NAME). Luckily, it's fixed in 37b82df. Thanks, @alex :)

  9. alex commented on Aug 13, 2015

    @alex
    MemberAuthor

    So the remaining open tickets are about signature validation. This is a Hard Problem ™️

  10. dainnilsson commented on Aug 21, 2015

    @dainnilsson
    Contributor

    I'm looking for something that's perhaps a bit simpler than doing full chain validation (which I would also like, but this would allow me to completely get rid of M2Crypto): I want to verify the signature of cert_a using the public key in cert_b. With M2 I'm currently doing this:

    if cert_a.verify(cert_b.get_pubkey()) == 1:

    Would supporting that in Cryptography be easier to do?

  11. reaperhulk commented on Aug 21, 2015

    @reaperhulk
    Member

    Yes, that is definitely a simpler problem (as it only requires validating the signature at one level rather than attempting to resolve a full chain and do all checks).

  12. reaperhulk commented on Jan 1, 2016

    @reaperhulk
    Member

    @dainnilsson Verification of the type you requested is now possible (in master). It looks like this for an RSA certificate:

            verifier = cert.public_key().verifier(
                cert.signature,
                padding.PKCS1v15(),
                cert.signature_hash_algorithm
            )
            verifier.update(request.tbs_certificate_bytes)
            verifier.verify()

    A bit ugly as we decided we wanted to keep the X509 objects "data only", but easy enough to wrap.

    That just leaves "full" x509 certificate validation, which we're tracking with issue #2381, so I'll close this. If I'm mistaken let me know and I can reopen.

  13. locked as resolved and limited conversation to collaborators on Aug 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions