Is it possible to work with x509 certificates in a pkcs7 bundle file?
I need to sign all certificates in a bundle with extra x509 extensions. e.g. (if they were a single x509 crt file) openssl x509 -CA corp-ca.crt -CAkey corp-ca.key -randserial -sha256 -extensions sub_ca -extfile sub_ca.cfg -in sub-ca.crt -out with-extensions-ca.crt
the p7b file have dozens of certificates, but they are not chained. Just a bundle.
openssl x509subcommand only supports PEM and DER formats and I think that means that you'll first need to extract the PKCS #7 bundle , do what needs to be done and recreate the bundle.-in file.p7b -inform DERopenssl x509does not support p7b either input or output. Expanding on what @HBruijn says:openssl pkcs7 -in p7b -inform der -print_certsto extract the certs and a text tool like awk or perl to split them apart; process each; then concatenate and use the oxymoronicopenssl crl2pkcs7 -nocrl -certfile xto convert back to p7b.openssl crl2pkcs7 -nocrl -certfile concatenated_pem_certs -outform der [-out p7bfile].