bikram990 / PyScep

A Python SCEP client and server
MIT License
8 stars 6 forks source link

failed loading csr using from_pem_file() and a feature request #5

Closed yhshin closed 2 years ago

yhshin commented 2 years ago

Thanks a lot for this wonderful package. Now I can try to simplify my scripts which is using OpenSSL and SSCEP.

So far, with my derived class, I can generate csr and key pair with DN and Subject Alternative Names =)

To test enrollment with SCEPy, thanks again to introduce it, I tried to load csr from_pem_file but got the following exception

AttributeError: 'bytes' object has no attribute 'keys'

It turned out that __init__() has to be modified to load instead of initializing

if request is None:
    # self._csr = csr.CertificationRequest(der_string)
    self._csr = csr.CertificationRequest.load(der_string)

Now I'm having another issue from SCEPy

AttributeError: '_RSAPublicKey' object has no attribute 'verifier'

Finally, could you update SigningRequest.generate_csr to allow other parameters for DN and Subject Alternative Name? I made a simple derived class for it but it would be useful to have the feature in there.

bikram990 commented 2 years ago

@yhshin Thanks for reporting the issue.

I've fixed the exception during loading CSR from a file.

For the SCEPy issue, Could you please report it on the SCEPy repo? I've taken the base implementation of this client from SCEPy. I'm in no way associated with SCEPy.

As for your last suggestion, generate_csr is a helper method to quickly generate CSRs without much customization. Ideally, you should be using ScepCSRBuilder to customize your CSR.

yhshin commented 2 years ago

Thanks a lot for kind reply and suggestions !