2019-04-29 16:05:43 +02:00
|
|
|
function New-CSCertAttribute {
|
2019-01-16 12:55:29 +01:00
|
|
|
<#
|
|
|
|
.SYNOPSIS
|
2019-04-29 16:05:43 +02:00
|
|
|
Creates required data for a certificate signing request.
|
2019-01-16 12:55:29 +01:00
|
|
|
|
|
|
|
.DESCRIPTION
|
|
|
|
Defines the certificate related properties for an upcoming New-PfxCertificate execution.
|
|
|
|
|
|
|
|
.PARAMETER Country
|
2019-04-29 16:05:43 +02:00
|
|
|
County code like EN, DE, IT, FR...
|
2019-01-16 12:55:29 +01:00
|
|
|
|
|
|
|
.PARAMETER State
|
|
|
|
Certificate state value.
|
|
|
|
|
|
|
|
.PARAMETER City
|
|
|
|
Certificate city value.
|
|
|
|
|
|
|
|
.PARAMETER Organization
|
|
|
|
Certificate organization value.
|
|
|
|
|
|
|
|
.PARAMETER OrganizationalUnitName
|
|
|
|
Certificate OrganizationalUnitName value.
|
|
|
|
|
|
|
|
.PARAMETER CommonName
|
|
|
|
The certificate common name.
|
|
|
|
|
2019-04-29 16:05:43 +02:00
|
|
|
.PARAMETER Days
|
|
|
|
The validation time itself.
|
2019-01-16 12:55:29 +01:00
|
|
|
|
|
|
|
.INPUTS
|
|
|
|
[None]
|
|
|
|
|
|
|
|
.OUTPUTS
|
2019-04-29 16:05:43 +02:00
|
|
|
[PSCredentialStore.Certificate.CSRDetails]
|
2019-01-16 12:55:29 +01:00
|
|
|
|
|
|
|
.EXAMPLE
|
2019-04-29 16:05:43 +02:00
|
|
|
New-CSCertAttribute -Country 'DE' -State 'BW' -City 'Karlsruhe' -Organization 'AwesomeIT' -OrganizationalUnitName '' -CommonName 'MyPrivateCert'
|
2019-01-16 12:55:29 +01:00
|
|
|
#>
|
2022-06-28 08:56:33 +02:00
|
|
|
|
2019-01-16 12:55:29 +01:00
|
|
|
[CmdletBinding()]
|
|
|
|
[OutputType('PSCredentialStore.Certificate.Attribute')]
|
2022-06-28 08:56:33 +02:00
|
|
|
param (
|
2019-01-16 12:55:29 +01:00
|
|
|
[Parameter(Mandatory = $true)]
|
|
|
|
[ValidateLength(2, 2)]
|
|
|
|
[ValidateNotNull()]
|
|
|
|
[string]$Country,
|
|
|
|
|
|
|
|
[Parameter(Mandatory = $true)]
|
|
|
|
[ValidateNotNull()]
|
|
|
|
[string]$State,
|
|
|
|
|
|
|
|
[Parameter(Mandatory = $true)]
|
|
|
|
[ValidateNotNull()]
|
|
|
|
[string]$City,
|
|
|
|
|
|
|
|
[Parameter(Mandatory = $true)]
|
|
|
|
[ValidateNotNull()]
|
|
|
|
[string]$Organization,
|
|
|
|
|
|
|
|
[Parameter(Mandatory = $true)]
|
|
|
|
[ValidateNotNull()]
|
|
|
|
[string]$OrganizationalUnitName,
|
|
|
|
|
|
|
|
[Parameter(Mandatory = $true)]
|
|
|
|
[ValidateNotNull()]
|
|
|
|
[string]$CommonName,
|
|
|
|
|
|
|
|
[Parameter(Mandatory = $false)]
|
|
|
|
[ValidateNotNull()]
|
|
|
|
[int]$Days = 365
|
|
|
|
)
|
2022-06-28 08:56:33 +02:00
|
|
|
begin {}
|
2019-01-16 12:55:29 +01:00
|
|
|
|
|
|
|
process {
|
|
|
|
return [PSCustomObject]@{
|
|
|
|
PSTypeName = 'PSCredentialStore.Certificate.Attribute'
|
|
|
|
Subject = [PSCustomObject]@{
|
|
|
|
PSTypeName = 'PSCredentialStore.Certificate.Attribute.Subject'
|
|
|
|
Country = $Country
|
|
|
|
State = $State
|
|
|
|
City = $City
|
|
|
|
Organization = $Organization
|
|
|
|
OrganizationalUnitName = $OrganizationalUnitName
|
|
|
|
CommonName = $CommonName
|
|
|
|
}
|
|
|
|
Days = $Days
|
|
|
|
}
|
|
|
|
}
|
2022-06-28 08:56:33 +02:00
|
|
|
end {}
|
2019-01-16 12:55:29 +01:00
|
|
|
}
|