So I have been tasked with automating getting certs for 1000 devices. And have been working though converting a Linux script to windows to match up with other scripts we have for other sections for this automation. To that end I have been able to download the cert with the command below into what I believe is a base64 (if I am reading the Linux script correctly) file but all attempts to decode it have failed.
curl --connect-timeout 30 --max-time 60 -sk <redacted) -X POST -d @cert-retrieve-testtop10.gc.com.json -H "Accept: application/json" -H "Content-Type: application/json" -H "Authorization: Bearer <redacted>" > NAME.b64
The Linux script is using the below command to do this
# extract the combined cert from it base64 file
jq .CertificateData $CERT_NAME.b64 | sed -es/\"//g | base64 --decode > $CERT_NAME.out
I have tried using the windows command
certutil -decode output.txt decoded.txt
but got the following error
DecodeFile returned The data is invalid. 0x8007000d (WIN32: 13 ERROR_INVALID_DATA) CertUtil: -decode command FAILED: 0x8007000d (WIN32: 13 ERROR_INVALID_DATA) CertUtil: The data is invalid.