Download EJBCA certificate with powershell


i came up with this today

add-type @"
using System.Net;
using System.Security.Cryptography.X509Certificates;
public class TrustAllCertsPolicy : ICertificatePolicy {
    public bool CheckValidationResult(
        ServicePoint srvPoint, X509Certificate certificate,
        WebRequest request, int certificateProblem) {
        return true;
    }
}
"@
[System.Net.ServicePointManager]::CertificatePolicy = New-Object TrustAllCertsPolicy

you can look up the thumbprint to compare which one it is
get-childitem Cert:\CurrentUser\My

$superadmin = get-childitem Cert:\CurrentUser\My\YOUR_SUPERADMIN_CERT_HASH
invoke-webrequest -Uri "https://infralab.local:32768/ejbca/publicweb/webdist/certdist?cmd=lastcert&installtobrowser=&subject=CN%3dgregu.host.com&format=chain&hidemenu=false" -method "Get" -Certificate $superadmin

what's left is to generate the cert order via csr. this just just downloading the already made cert.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s