Created
December 14, 2013 21:56
-
-
Save MattHodge/7965434 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
Get-ChildItem Cert:\LocalMachine\Root | Where-Object {$_.Subject -eq 'CN=SubjectName'} | Foreach-Object { [system.IO.file]::WriteAllBytes("C:\SSL\SubjectName.pfx",($_.Export('PFX', 'p@ssw0rd')) ) } |
This file contains hidden or 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
Makecert -r -pe -n CN="www.website.com" -b 02/01/2014 -e 12/22/2099 -eku 1.3.6.1.5.5.7.3.1 -sky exchange -sp "Microsoft RSA SChannel Cryptographic Provider" -sy 12 -len 4096 -a sha1 website.cer |
This file contains hidden or 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
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 | |
$result = Invoke-WebRequest -Uri "https://IpAddress/resource" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment