Skip to content

Commit

Permalink
Merge pull request #189 from PowerShell/dev
Browse files Browse the repository at this point in the history
Release of version 4.5.0.0 of CertificateDsc
  • Loading branch information
kwirkykat authored Apr 3, 2019
2 parents 169854e + 3fc8694 commit c2b6774
Show file tree
Hide file tree
Showing 8 changed files with 47 additions and 29 deletions.
11 changes: 10 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,20 @@

## Unreleased

## 4.5.0.0

- Fix example publish to PowerShell Gallery by adding `gallery_api`
environment variable to `AppVeyor.yml` - fixes [Issue #187](https://github.com/PowerShell/CertificateDsc/issues/187).
- CertificateDsc.Common.psm1
- Exclude assemblies that set DefinedTypes to null instead of an empty array
to prevent failures on GetTypes(). This issue occurred with the
Microsoft.WindowsAzure.Storage.dll assembly.

## 4.4.0.0

- Minor style corrections from PR for
[Issue #161](https://github.com/PowerShell/CertificateDsc/issues/161)
that were missed.
that were missed.
- Opt-in to Example publishing to PowerShell Gallery - fixes
[Issue #177](https://github.com/PowerShell/CertificateDsc/issues/177).
- Changed Test-CertificateAuthority to return the template name if it finds the
Expand Down
17 changes: 8 additions & 9 deletions CertificateDsc.psd1
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@{
# Version number of this module.
moduleVersion = '4.4.0.0'
moduleVersion = '4.5.0.0'

# ID used to uniquely identify this module
GUID = '1b8d785e-79ae-4d95-ae58-b2460aec1031'
Expand Down Expand Up @@ -53,14 +53,12 @@
# IconUri = ''

# ReleaseNotes of this module
ReleaseNotes = '- Minor style corrections from PR for
[Issue 161](https://github.com/PowerShell/CertificateDsc/issues/161)
that were missed.
- Opt-in to Example publishing to PowerShell Gallery - fixes
[Issue 177](https://github.com/PowerShell/CertificateDsc/issues/177).
- Changed Test-CertificateAuthority to return the template name if it finds the
display name of the template in the certificate -fixes
[Issue 147](https://github.com/PowerShell/CertificateDsc/issues/147).
ReleaseNotes = '- Fix example publish to PowerShell Gallery by adding `gallery_api`
environment variable to `AppVeyor.yml` - fixes [Issue 187](https://github.com/PowerShell/CertificateDsc/issues/187).
- CertificateDsc.Common.psm1
- Exclude assemblies that set DefinedTypes to null instead of an empty array
to prevent failures on GetTypes(). This issue occurred with the
Microsoft.WindowsAzure.Storage.dll assembly.
'

Expand All @@ -85,3 +83,4 @@ that were missed.




9 changes: 6 additions & 3 deletions Modules/CertificateDsc.Common/CertificateDsc.Common.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,11 @@ function Test-Thumbprint
# Get FIPS registry key
$fips = [System.Int32] (Get-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Lsa\FipsAlgorithmPolicy' -ErrorAction SilentlyContinue).Enabled

# Get a list of Hash Providers
$allHashProviders = [System.AppDomain]::CurrentDomain.GetAssemblies().GetTypes()
<#
Get a list of Hash Providers, but exclude assemblies that set DefinedTypes to null instead of an empty array.
Otherwise, the call to GetTypes() fails.
#>
$allHashProviders = ([System.AppDomain]::CurrentDomain.GetAssemblies() | Where-Object { $null -ne $_.DefinedTypes}).GetTypes()

if ($fips -eq $true)
{
Expand Down Expand Up @@ -740,7 +743,7 @@ function Get-CertificateTemplateName

if ($null -ne $templateExtensionText)
{
return Get-CertificateTemplateInformation -FormattedTemplate $templateExtensionText |
return Get-CertificateTemplateInformation -FormattedTemplate $templateExtensionText |
Select-Object -ExpandProperty Name
}
}
Expand Down
15 changes: 8 additions & 7 deletions Tests/Unit/CertificateDsc.Common.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -24,26 +24,27 @@ try
InModuleScope $script:ModuleName {
$DSCResourceName = 'CertificateDsc.Common'
$invalidThumbprint = 'Zebra'
$definedRuntimeTypes = ([System.AppDomain]::CurrentDomain.GetAssemblies() | Where-Object -FilterScript { $null -ne $_.DefinedTypes}).GetTypes()

# This thumbprint is valid (but not FIPS valid)
$validThumbprint = (
[System.AppDomain]::CurrentDomain.GetAssemblies().GetTypes() | Where-Object {
$definedRuntimeTypes | Where-Object -FilterScript {
$_.BaseType.BaseType -eq [System.Security.Cryptography.HashAlgorithm] -and
($_.Name -cmatch 'Managed$' -or $_.Name -cmatch 'Provider$')
} | Select-Object -First 1 | ForEach-Object {
(New-Object $_).ComputeHash([String]::Empty) | ForEach-Object {
} | Select-Object -First 1 | ForEach-Object -Process {
(New-Object $_).ComputeHash([String]::Empty) | ForEach-Object -Process {
'{0:x2}' -f $_
}
}
) -join ''

# This thumbprint is valid for FIPS
$validFipsThumbprint = (
[System.AppDomain]::CurrentDomain.GetAssemblies().GetTypes() | Where-Object {
$definedRuntimeTypes | Where-Object -FilterScript {
$_.BaseType.BaseType -eq [System.Security.Cryptography.HashAlgorithm] -and
($_.Name -cmatch 'Provider$' -and $_.Name -cnotmatch 'MD5')
} | Select-Object -First 1 | ForEach-Object {
(New-Object $_).ComputeHash([String]::Empty) | ForEach-Object {
} | Select-Object -First 1 | ForEach-Object -Process {
(New-Object $_).ComputeHash([String]::Empty) | ForEach-Object -Process {
'{0:x2}' -f $_
}
}
Expand Down Expand Up @@ -1287,7 +1288,7 @@ Major Version Number=100
Minor Version Number=5
'@

$params = @{
TemplateExtensions = $testCertificateWithAltTemplateInformation.Extensions
}
Expand Down
7 changes: 4 additions & 3 deletions Tests/Unit/MSFT_CertReq.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,13 @@ $TestEnvironment = Initialize-TestEnvironment `
try
{
InModuleScope $script:DSCResourceName {
$definedRuntimeTypes = ([System.AppDomain]::CurrentDomain.GetAssemblies() | Where-Object -FilterScript { $null -ne $_.DefinedTypes}).GetTypes()
$validThumbprint = (
[System.AppDomain]::CurrentDomain.GetAssemblies().GetTypes() | Where-Object {
$definedRuntimeTypes | Where-Object -FilterScript {
$_.BaseType.BaseType -eq [System.Security.Cryptography.HashAlgorithm] -and
($_.Name -cmatch 'Managed$' -or $_.Name -cmatch 'Provider$')
} | Select-Object -First 1 | ForEach-Object {
(New-Object $_).ComputeHash([String]::Empty) | ForEach-Object {
} | Select-Object -First 1 | ForEach-Object -Process {
(New-Object $_).ComputeHash([String]::Empty) | ForEach-Object -Process {
'{0:x2}' -f $_
}
}
Expand Down
7 changes: 4 additions & 3 deletions Tests/Unit/MSFT_CertificateImport.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,13 @@ try
{
InModuleScope $script:DSCResourceName {
$DSCResourceName = 'MSFT_CertificateImport'
$definedRuntimeTypes = ([System.AppDomain]::CurrentDomain.GetAssemblies() | Where-Object -FilterScript { $null -ne $_.DefinedTypes}).GetTypes()
$validThumbprint = (
[System.AppDomain]::CurrentDomain.GetAssemblies().GetTypes() | Where-Object {
$definedRuntimeTypes | Where-Object -FilterScript {
$_.BaseType.BaseType -eq [System.Security.Cryptography.HashAlgorithm] -and
($_.Name -cmatch 'Managed$' -or $_.Name -cmatch 'Provider$')
} | Select-Object -First 1 | ForEach-Object {
(New-Object $_).ComputeHash([String]::Empty) | ForEach-Object {
} | Select-Object -First 1 | ForEach-Object -Process {
(New-Object $_).ComputeHash([String]::Empty) | ForEach-Object -Process {
'{0:x2}' -f $_
}
}
Expand Down
7 changes: 4 additions & 3 deletions Tests/Unit/MSFT_PfxImport.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,13 @@ try
{
InModuleScope $script:DSCResourceName {
$DSCResourceName = 'MSFT_PfxImport'
$definedRuntimeTypes = ([System.AppDomain]::CurrentDomain.GetAssemblies() | Where-Object -FilterScript { $null -ne $_.DefinedTypes}).GetTypes()
$validThumbprint = (
[System.AppDomain]::CurrentDomain.GetAssemblies().GetTypes() | Where-Object {
$definedRuntimeTypes | Where-Object -FilterScript {
$_.BaseType.BaseType -eq [System.Security.Cryptography.HashAlgorithm] -and
($_.Name -cmatch 'Managed$' -or $_.Name -cmatch 'Provider$')
} | Select-Object -First 1 | ForEach-Object {
(New-Object $_).ComputeHash([String]::Empty) | ForEach-Object {
} | Select-Object -First 1 | ForEach-Object -Process {
(New-Object $_).ComputeHash([String]::Empty) | ForEach-Object -Process {
'{0:x2}' -f $_
}
}
Expand Down
3 changes: 3 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
# environment configuration #
#---------------------------------#
version: 2.3.{build}.0
environment:
gallery_api:
secure: 9ekJzfsPCDBkyLrfmov83XbbhZ6E2N3z+B/Io8NbDetbHc6hWS19zsDmy7t0Vvxv
install:
- git clone https://github.com/PowerShell/DscResource.Tests

Expand Down

0 comments on commit c2b6774

Please sign in to comment.