ps/Modules/Alkami.DevOps.Certificates/Private/Import-Cert.ps1
2023-05-30 22:51:22 -07:00

33 lines
891 B
PowerShell

function Import-Cert {
<#
.SYNOPSIS
Imports a Certificate into a Store.
#>
[CmdletBinding()]
Param(
[Parameter(Mandatory=$true)]
[string]$certFullName,
[parameter(Mandatory=$true)]
[System.Security.Cryptography.X509Certificates.StoreName]$storeName,
[Parameter(Mandatory=$false)]
[string]$importPassword
)
if ($importPassword)
{
return [Alkami.Ops.Common.Cryptography.CertificateHelper]::LoadCertificateToStore(
$certFullName,
$storeName,
[System.Security.Cryptography.X509Certificates.StoreLocation]::LocalMachine,
$importPassword);
}
return [Alkami.Ops.Common.Cryptography.CertificateHelper]::LoadCertificateToStore(
$certFullName,
$storeName,
[System.Security.Cryptography.X509Certificates.StoreLocation]::LocalMachine);
}