Created
February 19, 2021 09:04
-
-
Save pkutaj/41c23b03df9c4e5a379f8e3904051cde to your computer and use it in GitHub Desktop.
test-certificate.ps1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function test-certificate($domain, $contextLength = 10) { | |
$cacertPath = "c:\cacert.pem" | |
$domain += ":443" | |
echo "q" | openssl s_client -connect $domain -CAfile $cacertPath | openssl x509 -noout -enddate | sls "notAfter.*" | |
echo "q" | openssl s_client -connect $domain -CAfile $cacertPath | sls "certificate chain" -Context $contextLength | |
Write-Host "~~~" -ForegroundColor darkcyan | |
Write-Host "→ If needed, pass a desired output length after domainname" -ForegroundColor darkcyan | |
Write-Host "→ To update the list of trusted Certificates, run:" -ForegroundColor darkcyan | |
Write-Host "→ Invoke-WebRequest https://curl.se/ca/cacert.pem -OutFile 'c:\cacert.pem'" -ForegroundColor darkcyan | |
Write-Host "~~~" -ForegroundColor darkcyan | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment