ps/Modules/Alkami.DevOps.Certificates/Private/Export-Cert.ps1

38 lines
938 B
PowerShell
Raw Normal View History

2023-05-30 22:51:22 -07:00
function Export-Cert {
<#
.SYNOPSIS
Exports a Certificate.
#>
[CmdletBinding()]
[OutputType([System.Object])]
Param(
[parameter(Mandatory=$true)]
[string]$exportPath,
[parameter(Mandatory=$false)]
[string]$exportPassword,
[parameter(Mandatory=$true)]
[System.Security.Cryptography.X509Certificates.StoreName]$storeName
)
if ($exportPassword)
{
return ,[Alkami.Ops.Common.Cryptography.CertificateHelper]::ExportAllCertificates(
$storeName,
[System.Security.Cryptography.X509Certificates.StoreLocation]::LocalMachine,
$exportPath,
$exportPassword
);
}
return ,[Alkami.Ops.Common.Cryptography.CertificateHelper]::ExportAllCertificates(
$storeName,
[System.Security.Cryptography.X509Certificates.StoreLocation]::LocalMachine,
$exportPath
);
}