-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCreate-CASignedCert.ps1
More file actions
20 lines (16 loc) · 889 Bytes
/
Create-CASignedCert.ps1
File metadata and controls
20 lines (16 loc) · 889 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
$ErrorActionPreference = 'Stop';
$CommonScriptLocation = (Split-Path -Path $MyInvocation.MyCommand.Path -Parent)
. "$CommonScriptLocation\Create-Cert.ps1"
. "$CommonScriptLocation\Sign-Cert.ps1"
function Create-CASignedCert {
[CmdletBinding()]
param(
[Parameter(Mandatory=$False, ValueFromPipeline=$True, ValueFromPipelineByPropertyName=$True, Position=0, HelpMessage="Common Name of the certificate")]
[string]$CN = "localhost"
)
$OutputFolder = "Certificates"
$AbsoluteOutputFolderPath = (Join-Path $CommonScriptLocation $OutputFolder)
$Password = "Password01"
Create-Cert -SUBJ "/C=AU/ST=NSW/L=Sydney/CN=$CN" -FileName $CN -OutputFolder $OutputFolder -Password $Password -IsCA $False | `
Sign-Cert -CAPath (Join-Path $AbsoluteOutputFolderPath "CACert.pem") -CAKeyPath (Join-Path $AbsoluteOutputFolderPath "CACert.key") -CAPassword $Password
}