{% extends 'generic/object_list.html' %} {% load helpers %} {% load i18n %} {% block title %}Bulk Import Certificates (CSV/JSON){% endblock %} {% block tabs %}{% endblock %} {% block table %}{% endblock %} {% block content %}
{% if step == "preview" %} {# ── Preview step ── #}
Import Preview

{{ new_count }} certificate(s) ready to import. {% if duplicates %} {{ duplicates|length }} duplicate(s) skipped: {{ duplicates|join:", " }} {% endif %}

{% if errors %}
Validation warnings ({{ errors|length }}):
    {% for err in errors %}
  • Row {{ err.row }}{% if err.field %}, field {{ err.field }}{% endif %}: {{ err.message }}
  • {% endfor %}
{% endif %} {% if rows %}
{% for row in rows %} {% endfor %}
# Common Name Issuer Valid To Algorithm Status
{{ forloop.counter }} {{ row.common_name }} {{ row.issuer|truncatechars:40 }} {{ row.valid_to|date:"Y-m-d" }} {{ row.algorithm|upper }} {{ row.status|default:"active" }}
{% csrf_token %} Cancel
{% endif %}
{% else %} {# ── Input step ── #}
Bulk Import Certificates
{% if errors %}
Parsing errors:
    {% for err in errors %}
  • Row {{ err.row }}{% if err.field %}, field {{ err.field }}{% endif %}: {{ err.message }}
  • {% endfor %}
{% endif %}
{% csrf_token %}
Upload a CSV or JSON file.
Format Reference
CSV
common_name,serial_number,issuer,valid_from,valid_to,fingerprint_sha256,algorithm,key_size,status,sans
example.com,01:AB:CD,DigiCert Inc,2025-01-01,2026-01-01,AA:BB:CC:...,rsa,2048,active,www.example.com;api.example.com
JSON
[
  {
    "common_name": "example.com",
    "serial_number": "01:AB:CD",
    "issuer": "DigiCert Inc",
    "valid_from": "2025-01-01",
    "valid_to": "2026-01-01",
    "fingerprint_sha256": "AA:BB:CC:...",
    "algorithm": "rsa",
    "key_size": 2048,
    "status": "active",
    "sans": ["www.example.com", "api.example.com"]
  }
]
Required Fields

common_name, serial_number, issuer, valid_from, valid_to, fingerprint_sha256, algorithm

Optional Fields

key_size, status, sans (semicolon-separated in CSV), tenant (name or ID), private_key_location, pem_content, issuer_chain

{% endif %}
{% endblock content %}