Skip to content

Commit

Permalink
Fixed: Convert-CCertificateProvider fails on Windows 2012 R2 when a c…
Browse files Browse the repository at this point in the history
…ertificate isn't password protected.
  • Loading branch information
splatteredbits committed Mar 10, 2023
1 parent 309490e commit f5dfc50
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 15 deletions.
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
<!-- markdownlint-disable MD024 (no-duplicate-heading/no-duplicate-header) -->

# 3.1.2

Fixed: `Convert-CCertificateProvider` fails on Windows Server 2012 R2 when a certificate isn't password-protected.

# 3.1.1

Fixed: Find-CCertificate fails if a certificate's subject alternate name is `null` or has a `null` value.
Fixed: `Find-CCertificate` fails if a certificate's subject alternate name is `null` or has a `null` value.

# 3.1.0

Expand Down
2 changes: 1 addition & 1 deletion Carbon.Cryptography/Carbon.Cryptography.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
RootModule = 'Carbon.Cryptography.psm1'

# Version number of this module.
ModuleVersion = '3.1.1'
ModuleVersion = '3.1.2'

# ID used to uniquely identify this module
GUID = '225b9f63-3e3e-406c-87a0-33d34f30cd8e'
Expand Down
15 changes: 2 additions & 13 deletions Carbon.Cryptography/Functions/Convert-CCertificateProvider.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -120,29 +120,18 @@ function Convert-CCertificateProvider
'-user'
'-csp'
$ProviderName
'-p'
if ($Password)
{
'-p'
Convert-CSecureStringToString -SecureString $Password
}
else
{
if ($PSVersionTable['PSVersion'] -ge [Version]'7.0')
{
""
}
else
{
'""'
}
}
'-ImportPfx'
'Temp'
$FilePath
'AT_KEYEXCHANGE,NoRoot'
}

$output = 'y' | certutil $certUtilArgs
$output = '' | certutil $certUtilArgs
if ($LASTEXITCODE)
{
$msg = "Failed to convert provider for ""$($FilePath)"" because the certutil conversion command failed:" +
Expand Down

0 comments on commit f5dfc50

Please sign in to comment.