Skip to content

Instantly share code, notes, and snippets.

@StevePlace68
StevePlace68 / cert-splitter.sh
Created February 2, 2024 18:14
Split certificates from a certificate chain
#!/bin/bash
# Define file locations/password, change to match your machine
CA_BUNDLE="/etc/ssl/certs/ca-bundle.crt"
TRUSTSTORE="/path/to/my-truststore.jks"
TRUSTSTORE_PASS="changeit"
# Split the ca-bundle.crt into individual certificates
csplit -sz "$CA_BUNDLE" '/-----BEGIN CERTIFICATE-----/' '{*}'