Skip to main content

Python CMC

Project description

Extends asn1crypto with CMC and CRMF - https://www.rfc-editor.org/rfc/rfc5272

Installation

pip3 install python_cmc

To run, deploy, test and everything run

bash dev-run.sh
import base64
from asn1crypto import cms as asn1_cms
from python_cmc.cmc import PKIData

request = "MIIFTgYJKoZIhvcNAQcCoIIFPzCCBTsCAQMxDTALBglghkgBZQMEAgEwggLUBggrBgEFBQcMAqCCAsYEggLCMIICvjCB1zCBlgIEDgTXoQYIKwYBBQUHBwYxgYMEgYC3Rw6WmoJA8VQOnb8uzODY+og6LIMWTMIiRkwPyZdje3UQ3OZ4C5dN220IFHo9r+/rzrS3M3q0xQUZwOXltkLYNYKZqrDLVbh79VwkdY2JtA304RvjeH3S5AMpJvsW4XT70MTAQ6HCwrpunIWE9epfOe3p1z2NC0MRfDfC9Qg1XjAYAgQeYyg3BggrBgEFBQcHEjEGBARjcm1mMCICBFz3WzAGCCsGAQUFBwcLMRAwDgIELp/WpzAGAgR/4SGvMIIB3KGCAdgwggHUAgR/4SGvMIIByqVzMHExCzAJBgNVBAYTAlNFMSYwJAYDVQQDDB1EYXRlIE5hbWUgMjAyMy0wMS0zMCAxNzoxMTo0MjETMBEGA1UEBRMKMTIzNDU2Nzg5MDEPMA0GA1UECgwGQVAgT3JnMRQwEgYDVQQLDAtBUCBPcmcgVW5pdKZZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABBiMSIFZZg8e4K7H0opmZAKd4cNrD4WX64208PHitkfTfu0oa5n8zB/zcV20IMuzJiY0TlTVlOjijxdF/3+57YapgfcwCQYDVR0TBAIwADAfBgNVHSMEGDAWgBRLk79GlfrsxADdYc7cnJitGY1BlDApBgNVHQ4EIgQgFODwYpm21NCZsPjcRDyjpEjdo4Lv4iQL1of0RHScqOQwDgYDVR0PAQH/BAQDAgOIMDUGA1UdHwQuMCwwKqAooCaGJGh0dHA6Ly9wa2NzMTEtY2Euc3VuZXQuc2U6ODAwNS9jcmwwMTBABggrBgEFBQcBAQQ0MDIwMAYIKwYBBQUHMAGGJGh0dHA6Ly9wa2NzMTEtY2Euc3VuZXQuc2U6ODAwNS9vY3NwLzAVBgNVHSAEDjAMMAoGCCqFcAECAWQBMAAwAKCCASgwggEkMIHKoAMCAQICBGF8NSowCgYIKoZIzj0EAwIwGjEYMBYGA1UEAwwPVGVzdCBDTUMgQ2xpZW50MB4XDTIxMTAyOTE3NTM0NloXDTI2MTAyOTE3NTM0NlowGjEYMBYGA1UEAwwPVGVzdCBDTUMgQ2xpZW50MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEm5YZkVj1TwoPxGwgAsIlgSVIfgaAjr+djovlFM8Z1iXnHMXbJgpGUVAE1VsHfn0cGZpW6G4ptOQuIqxNPLSpEzAKBggqhkjOPQQDAgNJADBGAiEAiK1uTHrROyodlseT2Sj6iMVDddYnTNNooZBx+CWtNT8CIQCMmzcu47UXobEOOCktVWn67vnStULCxQnMirDyTjK0hjGCASEwggEdAgEBMCIwGjEYMBYGA1UEAwwPVGVzdCBDTUMgQ2xpZW50AgRhfDUqMAsGCWCGSAFlAwQCAaCBkjAXBgkqhkiG9w0BCQMxCgYIKwYBBQUHDAIwHAYJKoZIhvcNAQkFMQ8XDTIzMDEzMDE2MTE0MlowKAYJKoZIhvcNAQk0MRswGTALBglghkgBZQMEAgGhCgYIKoZIzj0EAwIwLwYJKoZIhvcNAQkEMSIEIK4iaq8/Q2BYFaGVnublUQWsnyn0RWf0o5xDi/fKUjmNMAoGCCqGSM49BAMCBEYwRAIgfFrYzIk2oCHJGc/NCM7i95pORUVQLcdToEYXhtZRKSUCIBWj3rMXblpGmCJV7TpjrHzf9KYhNZOGiwJcJXfB60xi"
data = base64.b64decode(request)
info = asn1_cms.ContentInfo.load(data)
pkidata = PKIData.load(info["content"]["encap_content_info"]["content"].parsed.dump())
print(pkidata.native)

Coming soon

  • Complete implementation
  • More and better tests

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

python_cmc-1.1.tar.gz (11.5 kB view details)

Uploaded Source

Built Distribution

python_cmc-1.1-py3-none-any.whl (7.0 kB view details)

Uploaded Python 3

File details

Details for the file python_cmc-1.1.tar.gz.

File metadata

  • Download URL: python_cmc-1.1.tar.gz
  • Upload date:
  • Size: 11.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.1

File hashes

Hashes for python_cmc-1.1.tar.gz
Algorithm Hash digest
SHA256 2aadfefa293d39f94d8ae9cc53e0c42a3a36ae3e5ab95f6ca62f4028cb3c6b4c
MD5 9c002564fe1c180466bf55a871cfcb6c
BLAKE2b-256 bc70c39dab8fb24853ef6387d78cdbdc197a6074c78d6ff009f5fad4b7fe5b96

See more details on using hashes here.

File details

Details for the file python_cmc-1.1-py3-none-any.whl.

File metadata

  • Download URL: python_cmc-1.1-py3-none-any.whl
  • Upload date:
  • Size: 7.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.1

File hashes

Hashes for python_cmc-1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 37a64003ab8447cdb41edb695675b29844a0bf585b9fc6eb008c69bf749f6d2c
MD5 0444b1f090fc4d9b312a385bb9c7137d
BLAKE2b-256 af876013462dfa47bd2db062db116f8fe6fcdab9c34e615d972c648e5c2d6a2f

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page