Skip to content

Instantly share code, notes, and snippets.

@nordineb
Created October 24, 2017 19:17
Show Gist options
  • Save nordineb/81ac24e73be39e0efe315228799558ba to your computer and use it in GitHub Desktop.
Save nordineb/81ac24e73be39e0efe315228799558ba to your computer and use it in GitHub Desktop.
Create p2S certificates
# if you already have a root certificate
$cert= Get-ChildItem -Path “Cert:\CurrentUser\My” | where { $_.subject -eq "CN=NordineRootCertForP2SVPN" }
# otherwise create a self-signed root certificate
$cert = New-SelfSignedCertificate -Type Custom -KeySpec Signature `
-Subject "CN=RootCertForP2SVPN" -KeyExportPolicy Exportable `
-HashAlgorithm sha256 -KeyLength 2048 `
-CertStoreLocation "Cert:\CurrentUser\My" -KeyUsageProperty Sign -KeyUsage CertSign
#Create a certificate
New-SelfSignedCertificate -Type Custom -KeySpec Signature `
-Subject "CN=RootCertForP2SVPN_2" -KeyExportPolicy Exportable `
-HashAlgorithm sha256 -KeyLength 2048 `
-CertStoreLocation "Cert:\CurrentUser\My" `
-Signer $cert -TextExtension @("2.5.29.37={text}1.3.6.1.5.5.7.3.2")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment