{"library":"pysnmpcrypto","title":"PySNMP Crypto Extensions","description":"pysnmpcrypto provides strong cryptographic support for the PySNMP library, enhancing security for SNMPv3 operations. It integrates seamlessly with PySNMP's security framework by leveraging PyCryptodome. The current version is 0.1.0, with releases typically tied to updates in its core dependencies, PySNMP and PyCryptodome.","language":"python","status":"active","last_verified":"Sun May 17","install":{"commands":["pip install pysnmpcrypto"],"cli":null},"imports":["import pysnmpcrypto.hl.api"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"from pysnmp.hlapi import *\nimport pysnmpcrypto.hl.api # This import enables strong crypto support\n\n# 1. SNMP Engine and User Definition\nsnmp_engine = SnmpEngine()\n\n# Define an SNMPv3 user with strong authentication (SHA512) and privacy (AES256).\n# These protocols are enabled by 'pysnmpcrypto'.\n# In a real scenario, 'authKey' and 'privKey' should be strong, unique values.\nauth_key = b'myAuthPassword123'\npriv_key = b'myPrivPassword456'\n\nuser_data = UsmUserData(\n    userName='testUser',\n    authKey=auth_key,\n    privKey=priv_key,\n    authProtocol=usmHMACSHA512AuthProtocol, # Requires pysnmpcrypto\n    privProtocol=usmAES256PrivProtocol      # Requires pysnmpcrypto\n)\n\n# 2. Target Agent Definition (using a public test server for demonstration)\n# Note: 'testUser' must be configured on the target agent with matching keys/protocols.\ntarget = UdpTransportTarget(('demo.snmplabs.com', 161), timeout=1, retries=0)\n\n# 3. Context Data\ncontext = ContextData()\n\n# 4. Object to query (e.g., sysDescr.0)\noid = ObjectType(ObjectIdentity('SNMPv2-MIB', 'sysDescr', 0))\n\n# 5. Perform the SNMP GET operation\nprint(f\"Attempting to query {oid} using SNMPv3 with SHA512/AES256 (requires pysnmpcrypto)...\")\nerror_indication, error_status, error_index, var_binds = next(\n    getCmd(snmp_engine, user_data, target, context, oid)\n)\n\n# 6. Process the response\nif error_indication:\n    print(f\"Error: {error_indication}\")\nelif error_status:\n    print(f\"Error: {error_status.prettyPrint()} at {error_index and var_binds[int(error_index) - 1][0] or '?'}\")\nelse:\n    for var_bind in var_binds:\n        print(f\"{var_bind.prettyPrint()}\")\n\n# The key takeaway is that usmHMACSHA512AuthProtocol and usmAES256PrivProtocol\n# become available for use after 'import pysnmpcrypto.hl.api'.\n# A successful connection depends on the target agent supporting the user and protocols.","lang":"python","description":"This quickstart demonstrates how to enable and use strong cryptographic protocols (like SHA512 for authentication and AES256 for privacy) for SNMPv3 within PySNMP by simply importing `pysnmpcrypto.hl.api`. It sets up an SNMPv3 user with these protocols and attempts to perform a GET operation against a public test agent. For this to fully succeed, the target agent must be configured with a matching user and supported security levels.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":{"tag":null,"tag_description":null,"last_tested":"2026-05-17","installed_version":"0.1.0","pypi_latest":"0.1.0","is_stale":false,"summary":{"python_range":"3.10–3.9","success_rate":100,"avg_install_s":2.3,"avg_import_s":null,"wheel_type":"wheel"},"results":[{"runtime":"python:3.10-alpine","python_version":"3.10","os_libc":"alpine (musl)","variant":"pysnmpcrypto","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":"34.4M"},{"runtime":"python:3.10-slim","python_version":"3.10","os_libc":"slim (glibc)","variant":"pysnmpcrypto","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":2.5,"import_time_s":null,"mem_mb":null,"disk_size":"35M"},{"runtime":"python:3.11-alpine","python_version":"3.11","os_libc":"alpine (musl)","variant":"pysnmpcrypto","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":"36.4M"},{"runtime":"python:3.11-slim","python_version":"3.11","os_libc":"slim (glibc)","variant":"pysnmpcrypto","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":2.2,"import_time_s":null,"mem_mb":null,"disk_size":"37M"},{"runtime":"python:3.12-alpine","python_version":"3.12","os_libc":"alpine (musl)","variant":"pysnmpcrypto","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":"28.2M"},{"runtime":"python:3.12-slim","python_version":"3.12","os_libc":"slim (glibc)","variant":"pysnmpcrypto","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":2,"import_time_s":null,"mem_mb":null,"disk_size":"29M"},{"runtime":"python:3.13-alpine","python_version":"3.13","os_libc":"alpine (musl)","variant":"pysnmpcrypto","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":"28.0M"},{"runtime":"python:3.13-slim","python_version":"3.13","os_libc":"slim (glibc)","variant":"pysnmpcrypto","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":2,"import_time_s":null,"mem_mb":null,"disk_size":"28M"},{"runtime":"python:3.9-alpine","python_version":"3.9","os_libc":"alpine (musl)","variant":"pysnmpcrypto","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":"34.6M"},{"runtime":"python:3.9-slim","python_version":"3.9","os_libc":"slim (glibc)","variant":"pysnmpcrypto","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":3,"import_time_s":null,"mem_mb":null,"disk_size":"35M"}]}}