< Summary - Kestrun — Combined Coverage

Information
Class: Private.Certificate.Join-KeyUsageFlag
Assembly: Kestrun.PowerShell.Private
File(s): /home/runner/work/Kestrun/Kestrun/src/PowerShell/Kestrun/Private/Certificate/Join-KeyUsageFlag.ps1
Tag: Kestrun/Kestrun@765a8f13c573c01494250a29d6392b6037f087c9
Line coverage
83%
Covered lines: 5
Uncovered lines: 1
Coverable lines: 6
Total lines: 41
Line coverage: 83.3%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Coverage history

Coverage history 0 25 50 75 100 04/19/2026 - 15:52:57 Line coverage: 83.3% (5/6) Total lines: 41 Tag: Kestrun/Kestrun@765a8f13c573c01494250a29d6392b6037f087c9

Metrics

File(s)

/home/runner/work/Kestrun/Kestrun/src/PowerShell/Kestrun/Private/Certificate/Join-KeyUsageFlag.ps1

#LineLine coverage
 1<#
 2.SYNOPSIS
 3    Combines multiple X509KeyUsageFlags into a single value.
 4.DESCRIPTION
 5    The Join-KeyUsageFlag function takes an array of X509KeyUsageFlags and combines them using a bitwise OR operation to
 6    that represents all the specified key usage flags.
 7    This is useful for scenarios where multiple key usage flags need to be included in a certificate request or self-sig
 8    and the underlying APIs expect a single combined value rather than an array of individual flags.
 9.PARAMETER KeyUsage
 10    An array of X509KeyUsageFlags to combine. Each element in the array should be a valid X509KeyUsageFlags value such a
 11.OUTPUTS
 12    [System.Security.Cryptography.X509Certificates.X509KeyUsageFlags] - A single combined X509KeyUsageFlags value that r
 13    If no valid flags are provided, it returns $null.
 14.EXAMPLE
 15    $combinedFlags = Join-KeyUsageFlag -KeyUsage DigitalSignature, KeyEncipherment
 16    Write-Output $combinedFlags
 17
 18    This example combines the DigitalSignature and KeyEncipherment flags into a single X509KeyUsageFlags value and outpu
 19.EXAMPLE
 20    $combinedFlags = Join-KeyUsageFlag -KeyUsage DataEncipherment, KeyAgreement
 21    Write-Output $combinedFlags
 22
 23    This example combines the DataEncipherment and KeyAgreement flags into a single X509KeyUsageFlags value and outputs 
 24#>
 25function Join-KeyUsageFlag {
 26    param(
 27        [System.Security.Cryptography.X509Certificates.X509KeyUsageFlags[]]$KeyUsage
 28    )
 29
 130    $combinedKeyUsage = [System.Security.Cryptography.X509Certificates.X509KeyUsageFlags]::None
 31
 132    foreach ($keyUsageFlag in $KeyUsage) {
 133        $combinedKeyUsage = $combinedKeyUsage -bor $keyUsageFlag
 34    }
 35
 136    if ($combinedKeyUsage -eq [System.Security.Cryptography.X509Certificates.X509KeyUsageFlags]::None) {
 037        return $null
 38    }
 39
 140    return $combinedKeyUsage
 41}

Methods/Properties

Join-KeyUsageFlag()