{"library":"pyjks","title":"PyJKS","description":"PyJKS is a pure-Python library for reading and writing Java KeyStore (JKS) files. It provides programmatic access to key entries, certificate entries, and trusted certificate entries within a JKS file. The current version is 20.0.0, and it is actively maintained with releases tied to significant updates and improvements.","language":"python","status":"active","last_verified":"Fri May 15","install":{"commands":["pip install pyjks"],"cli":null},"imports":["from jks import KeyStore","from jks.util import KeystoreException"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import jks\nimport os\n\n# --- Configuration ---\n# Replace 'path/to/your/keystore.jks' with the actual path to your JKS file.\n# For a runnable example, ensure this file exists or temporarily create an empty one.\nkeystore_path = os.environ.get('PYJKS_KEYSTORE_PATH', 'my_keystore.jks')\n\n# Replace 'your_keystore_password' with the actual password for your JKS file.\n# For security, avoid hardcoding passwords in production; use environment variables or a secret management system.\nkeystore_password = os.environ.get('PYJKS_KEYSTORE_PASSWORD', 'changeit')\n\n# --- Quickstart Code ---\ntry:\n    # Attempt to load the keystore from the specified path and password\n    with open(keystore_path, \"rb\") as f:\n        ks = jks.KeyStore.load(f, keystore_password)\n\n    print(f\"Successfully loaded keystore from: {keystore_path}\")\n    print(f\"Keystore type: {ks.ks_type}\")\n    print(f\"Number of entries: {len(ks.entries)}\")\n\n    if not ks.entries:\n        print(\"No entries found in the keystore.\")\n    else:\n        print(\"\\nKeystore Entries:\")\n        for alias, entry in ks.entries.items():\n            print(f\"  Alias: {alias}\")\n            print(f\"    Type: {entry.entry_type}\")\n            if entry.entry_type == 'key':\n                print(f\"    Key Algorithm: {entry.algorithm}\")\n                # Further details like certificate chain can be accessed via entry.cert_chain\n            elif entry.entry_type == 'cert':\n                print(f\"    Certificate Subject: {entry.cert.subject.human_friendly}\")\n                # Further details like issuer, validity, etc., are available on entry.cert\n\nexcept FileNotFoundError:\n    print(f\"Error: Keystore file not found at '{keystore_path}'.\")\n    print(\"Please replace 'my_keystore.jks' with an actual path or create a dummy JKS file for testing.\")\nexcept jks.util.KeystoreException as e:\n    print(f\"Error loading keystore: {e}\")\n    print(\"This often indicates an incorrect password or a corrupted/unsupported JKS format.\")\nexcept Exception as e:\n    print(f\"An unexpected error occurred: {e}\")","lang":"python","description":"This quickstart demonstrates how to load a Java KeyStore (JKS) file, authenticate with a password, and iterate through its entries. It uses `os.environ.get` for `KEYSTORE_PATH` and `KEYSTORE_PASSWORD` to allow easy configuration via environment variables or fall back to default placeholders. Error handling for `FileNotFoundError` and `jks.util.KeystoreException` is included for common issues like incorrect paths or passwords.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":{"tag":null,"tag_description":null,"last_tested":"2026-05-15","installed_version":null,"pypi_latest":"20.0.0","is_stale":null,"summary":{"python_range":"3.10–3.9","success_rate":0,"avg_install_s":null,"avg_import_s":null,"wheel_type":null},"results":[{"runtime":"python:3.10-alpine","python_version":"3.10","os_libc":"alpine (musl)","variant":"pyjks","exit_code":1,"wheel_type":null,"failure_reason":"build_error","import_side_effects":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.10-slim","python_version":"3.10","os_libc":"slim (glibc)","variant":"pyjks","exit_code":1,"wheel_type":null,"failure_reason":"build_error","import_side_effects":null,"install_time_s":2.6,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.11-alpine","python_version":"3.11","os_libc":"alpine (musl)","variant":"pyjks","exit_code":1,"wheel_type":null,"failure_reason":"build_error","import_side_effects":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.11-slim","python_version":"3.11","os_libc":"slim (glibc)","variant":"pyjks","exit_code":1,"wheel_type":null,"failure_reason":"build_error","import_side_effects":null,"install_time_s":2.4,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.12-alpine","python_version":"3.12","os_libc":"alpine (musl)","variant":"pyjks","exit_code":1,"wheel_type":null,"failure_reason":"build_error","import_side_effects":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.12-slim","python_version":"3.12","os_libc":"slim (glibc)","variant":"pyjks","exit_code":1,"wheel_type":null,"failure_reason":"build_error","import_side_effects":null,"install_time_s":3.3,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.13-alpine","python_version":"3.13","os_libc":"alpine (musl)","variant":"pyjks","exit_code":1,"wheel_type":null,"failure_reason":"build_error","import_side_effects":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.13-slim","python_version":"3.13","os_libc":"slim (glibc)","variant":"pyjks","exit_code":1,"wheel_type":null,"failure_reason":"build_error","import_side_effects":null,"install_time_s":2.9,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.9-alpine","python_version":"3.9","os_libc":"alpine (musl)","variant":"pyjks","exit_code":1,"wheel_type":null,"failure_reason":"build_error","import_side_effects":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.9-slim","python_version":"3.9","os_libc":"slim (glibc)","variant":"pyjks","exit_code":1,"wheel_type":null,"failure_reason":"build_error","import_side_effects":null,"install_time_s":3,"import_time_s":null,"mem_mb":null,"disk_size":null}]}}