{"library":"sshpubkeys","title":"SSH Public Key Parser","type":"library","description":"sshpubkeys is a Python library for parsing SSH public keys. It supports various key types (RSA, DSA, ECDSA, Ed25519) and can handle authorized_keys file formats, including options like 'command=' or 'no-port-forwarding'. The current version is 3.3.1, and it maintains an active, feature-driven release cadence.","language":"python","status":"active","last_verified":"Fri May 15","install":{"commands":["pip install sshpubkeys"],"cli":null},"imports":["from sshpubkeys import SSHKey","from sshpubkeys import InvalidKeyException"],"auth":{"required":false,"env_vars":[]},"links":{"homepage":null,"github":"https://github.com/ojarva/python-sshpubkeys","docs":null,"changelog":null,"pypi":"https://pypi.org/project/sshpubkeys/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null},"quickstart":{"code":"from sshpubkeys import SSHKey, InvalidKeyException\nimport os\n\n# This is a dummy example key. Replace with a real key or load from a file.\n# For actual use, avoid hardcoding keys directly in code.\n# A real key might look like: 'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCq2z/t... user@example.com'\nexample_public_key_string = os.environ.get(\n    'SSH_PUBLIC_KEY', \n    'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCw0Y1c/tFk9k/N... dummy_key@example.com'\n)\n\ntry:\n    key = SSHKey(example_public_key_string)\n    print(f\"Key type: {key.key_type}\")\n    print(f\"Key length: {key.length}\")\n    print(f\"Fingerprint (MD5): {key.hash_md5}\")\n    print(f\"Fingerprint (SHA256): {key.hash_sha256}\")\n    print(f\"Comment: {key.comment}\")\n    key.verify_length() # Ensures key length is standard for its type\n    print(\"Key is valid and has standard length.\")\nexcept InvalidKeyException as e:\n    print(f\"Error parsing SSH key: {e}\")\nexcept Exception as e:\n    print(f\"An unexpected error occurred: {e}\")","lang":"python","description":"Initialize an SSHKey object from a public key string, retrieve its properties, and perform basic validation. Demonstrates handling of `InvalidKeyException`.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":{"tag":null,"tag_description":null,"last_tested":"2026-05-15","installed_version":"3.3.1","pypi_latest":"3.3.1","is_stale":false,"summary":{"python_range":"3.10–3.9","success_rate":100,"avg_install_s":2.6,"avg_import_s":0.07,"wheel_type":"wheel"},"results":[{"runtime":"python:3.10-alpine","python_version":"3.10","os_libc":"alpine (musl)","variant":"sshpubkeys","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":null,"import_time_s":0.06,"mem_mb":2.8,"disk_size":"35.7M"},{"runtime":"python:3.10-slim","python_version":"3.10","os_libc":"slim (glibc)","variant":"sshpubkeys","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":2.6,"import_time_s":0.05,"mem_mb":2.8,"disk_size":"36M"},{"runtime":"python:3.11-alpine","python_version":"3.11","os_libc":"alpine (musl)","variant":"sshpubkeys","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":null,"import_time_s":0.1,"mem_mb":3.1,"disk_size":"38.1M"},{"runtime":"python:3.11-slim","python_version":"3.11","os_libc":"slim (glibc)","variant":"sshpubkeys","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":2.6,"import_time_s":0.08,"mem_mb":3.1,"disk_size":"39M"},{"runtime":"python:3.12-alpine","python_version":"3.12","os_libc":"alpine (musl)","variant":"sshpubkeys","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":null,"import_time_s":0.08,"mem_mb":2.9,"disk_size":"29.8M"},{"runtime":"python:3.12-slim","python_version":"3.12","os_libc":"slim (glibc)","variant":"sshpubkeys","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":2.2,"import_time_s":0.07,"mem_mb":2.9,"disk_size":"30M"},{"runtime":"python:3.13-alpine","python_version":"3.13","os_libc":"alpine (musl)","variant":"sshpubkeys","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":null,"import_time_s":0.07,"mem_mb":2.8,"disk_size":"29.5M"},{"runtime":"python:3.13-slim","python_version":"3.13","os_libc":"slim (glibc)","variant":"sshpubkeys","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":2.4,"import_time_s":0.07,"mem_mb":2.6,"disk_size":"30M"},{"runtime":"python:3.9-alpine","python_version":"3.9","os_libc":"alpine (musl)","variant":"sshpubkeys","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":null,"import_time_s":0.06,"mem_mb":2.8,"disk_size":"35.9M"},{"runtime":"python:3.9-slim","python_version":"3.9","os_libc":"slim (glibc)","variant":"sshpubkeys","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":3.1,"import_time_s":0.07,"mem_mb":2.8,"disk_size":"36M"}]}}