O'Reilly logo

PowerShell for Office 365 by Prashant G Bhoyar, Martin Machado

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Creating a CA certificate

The New-SelfSignedCertificate command packages a lot of functionality. In the following sample, we are creating a self-signed certificate authority certificate:

$enforceLevels = $true$levelOfSubCertsAllowed = 0;$isCa = $true;$isCritical = $true;$caConstraint = New-Object System.Security.Cryptography.X509Certificates.X509BasicConstraintsExtension ` -ArgumentList @($isCa, $enforceLevels, $levelOfSubCertsAllowed, $isCritical)$caCert = New-SelfSignedCertificate -CertStoreLocation 'Cert:\CurrentUser\MY' -Subject "My Certificate Authority" -Extension @($caConstraint) -NotAfter (Get-Date).AddYears(20) -KeyLength 4096  -KeyAlgorithm RSA -FriendlyName 'MyCA' -Type Custom -KeyUsage DigitalSignature, CRLSign, CertSign

Let's ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required