bikram990 / PyScep

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

ValueError: Error parsing asn1crypto.core.OctetString - method should have been primitive, but constructed was found while parsing asn1crypto.cms.EncryptedContentInfo #17

Open birdie1 opened 6 months ago

birdie1 commented 6 months ago

Hello, I get the following error:

Traceback (most recent call last):
  File "./main.py", line 27, in <module>
    res = client.enrol(
          ^^^^^^^^^^^^^
  File "/home/jonas/.local/lib/python3.11/site-packages/scep/Client/client.py", line 123, in enrol
    return self._pki_operation(identity=identity, identity_private_key=identity_private_key, envelope=envelope, message_type=MessageType.PKCSReq, cacaps=cacaps, ca_certs=ca_certs, transaction_id=transaction_id)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/jonas/.local/lib/python3.11/site-packages/scep/Client/client.py", line 154, in _pki_operation
    decrypted_bytes = cert_rep.get_decrypted_envelope_data(identity, identity_private_key)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/jonas/.local/lib/python3.11/site-packages/scep/Client/message.py", line 232, in get_decrypted_envelope_data
    encrypted_content_bytes = encrypted_contentinfo['encrypted_content'].native
                              ~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/asn1crypto/core.py", line 3536, in __getitem__
    raise e
  File "/usr/lib/python3.11/site-packages/asn1crypto/core.py", line 3531, in __getitem__
    return self._lazy_child(key)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/asn1crypto/core.py", line 3478, in _lazy_child
    child = self.children[index] = _build(*child)
                                   ^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/asn1crypto/core.py", line 5555, in _build
    raise ValueError(unwrap(
ValueError: Error parsing asn1crypto.core.OctetString - method should have been primitive, but constructed was found
    while parsing asn1crypto.cms.EncryptedContentInfo

The SCEP provider send out the certificate, but it looks like PyScep is not able to parse it.

Any idea what I can change to get the certificate?

pegahnikbakht commented 2 weeks ago

any fix on this?