---
title: FAQ - Certificate Purpose and EKU Testing Scenarios
description: "Test Certificate Purpose and EKU validation with automated PowerShell scripts covering 6 scenarios: Server Auth, Client Auth, Code Signing, Multi-Purpose, Any Purpose, and Missing EKU."
---

# FAQ - Certificate Purpose and EKU Testing Scenarios

Validate [Certificate Purpose and EKU][] monitoring with automated PowerShell test scripts covering all detection scenarios - from properly scoped single-purpose certificates (OK) to security risks like "Any Purpose" certificates (ERROR) and multi-purpose configurations (WARNING).

**What's on This Page:**

* **6 Test Scenarios** - Config tables and validation points for Server Auth, Client Auth, [Code Signing][], Multi-Purpose, Any Purpose, and Missing EKU
* [Batch Testing Script][] - Create all test certificates with a signed Root CA for chain validation
* [Cleanup and Diagnostic Script][] - Remove test certificates and diagnose leftover artifacts
* **Validation Checklist** - Verify expected monitoring states match actual results
* **Troubleshooting** - Resolve testing-specific issues (agent detection, configuration, PowerShell errors)

## Why Test Certificate Purpose?

Certificate purpose validation prevents security risks from overly permissive certificates. Testing ensures monitoring correctly identifies:

* ❌ **Any Purpose certificates** (ERROR) - Can be used for ANY operation if compromised
* ⚠️ **Multi-purpose certificates** (WARNING) - Broader attack surface than needed
* ⚠️ **Missing Key Usage** (WARNING) - Unclear purpose, potential compatibility issues
* ✅ **Single-purpose certificates** (OK) - Properly scoped, follows least privilege

**Related Documentation:** See [Certificate Purpose and EKU][] for complete feature documentation, security context, detection examples, and best practices.

>[!NOTE]
>These scripts require **PowerShell 7+** with Administrator privileges for certificate store access.

>[!WARNING]
>Never deploy test certificates to production environments. Always clean up after validation testing.

![Certificate Purpose Validation Example][1]  
*Certificate purpose validation showing Enhanced Key Usage extensions and security assessment results.*

## :fa-list-check: Testing Scenarios Overview

|#|Scenario|Purpose|[Expected State][]|Key Focus|
|---|---|---|---|---|
|**1**|[Server Authentication](#scenario-1-server-authentication)|SSL/TLS server certificates|✅ **OK**|Server Auth EKU (1.3.6.1.5.5.7.3.1)|
|**2**|[Client Authentication](#scenario-2-client-authentication)|Client auth & mTLS|✅ **OK**|Client Auth EKU (1.3.6.1.5.5.7.3.2)|
|**3**|[Code Signing](#scenario-3-code-signing)|Software & script signing|✅ **OK**|Code Signing EKU (1.3.6.1.5.5.7.3.3)|
|**4**|[Multi-Purpose](#scenario-4-multi-purpose)|Multiple EKUs (broader scope)|⚠️ **Warning**|Server + Client Auth combined|
|**5**|[Any Purpose](#scenario-5-any-purpose-security-risk)|Overly permissive certificate|❌ **Critical**|Any Purpose EKU (2.5.29.37.0)|
|**6**|[Missing EKU](#scenario-6-missing-eku)|No Extended Key Usage extension|⚠️ **Warning**|No EKU extension defined|

## :fa-sitemap: Test Scenario Workflow

```mermaid
graph TD
    Start[Start Testing] --> Config[Configure Scenarios]
    Config --> S1{Scenario 1 Server Auth}
    Config --> S2{Scenario 2 Client Auth}
    Config --> S3{Scenario 3 Code Signing}
    Config --> S4{Scenario 4 Multi-Purpose}
    Config --> S5{Scenario 5 Any Purpose}
    Config --> S6{Scenario 6 Missing EKU}
    S1 --> V1[OK]
    S2 --> V2[OK]
    S3 --> V3[OK]
    S4 --> V4[Warning]
    S5 --> V5[Critical]
    S6 --> V6[Warning]
    V1 --> Monitor[Monitor Results]
    V2 --> Monitor
    V3 --> Monitor
    V4 --> Monitor
    V5 --> Monitor
    V6 --> Monitor
    Monitor --> Validate[Validate Alerts]
    Validate --> Cleanup[Cleanup Test Certs]
    Cleanup --> End[Testing Complete]
    style S1 fill:#e3f2fd
    style S2 fill:#e3f2fd
    style S3 fill:#e3f2fd
    style S4 fill:#fff3e0
    style S5 fill:#ffebee
    style S6 fill:#fff3e0
    style V1 fill:#c8e6c9
    style V2 fill:#c8e6c9
    style V3 fill:#c8e6c9
    style V4 fill:#ffe0b2
    style V5 fill:#ffcdd2
    style V6 fill:#ffe0b2
```

*Diagram: Full testing workflow from scenario configuration through certificate creation, monitoring validation, and cleanup.*

## :fa-vial: Test Scenarios

### Scenario 1: Server Authentication

**Purpose**: Validate SSL/TLS server certificate monitoring with proper Server Authentication EKU.

|Setting|Value|Rationale|
|---|---|---|
|:fa-certificate: **EKU**|Server Authentication (1.3.6.1.5.5.7.3.1)|Single-purpose EKU for HTTPS/TLS servers - follows least privilege principle|
|:fa-key: **Key Usage**|DigitalSignature, KeyEncipherment|Required for SSL/TLS handshake and session key encryption|
|:fa-box-archive: **Store**|Local Machine|Server certificates must be accessible to [IIS][]/services running under system accounts|
|:fa-traffic-light: [Expected State][]|✅ OK|Properly scoped certificate should pass validation without warnings|

>[!TIP]
>**Using certificates with IBM MQ?** IBM MQ has version-specific certificate storage: legacy agents (.NET Framework 4.8) use IBM MQ Key Database files (.kdb), while modern agents (.NET 9/10) support Windows Certificate Store. See [IBM MQ SSL FAQ][] for conversion guidance.

**Validation Points:**

* Server Auth EKU present and validated
* Appropriate for IIS bindings, API endpoints, HTTPS services
* No security warnings for properly scoped certificate

---

### Scenario 2: Client Authentication

**Purpose**: Test client authentication certificate validation for mTLS and client auth scenarios.

|Setting|Value|Rationale|
|---|---|---|
|:fa-certificate: **EKU**|Client Authentication (1.3.6.1.5.5.7.3.2)|Single-purpose EKU for client-side authentication (mTLS, VPN, smart cards)|
|:fa-key: **Key Usage**|DigitalSignature|Client certificates only need to sign authentication challenges|
|:fa-box-archive: **Store**|Local Machine|All test certificates installed in LocalMachine\My for consistency|
|:fa-traffic-light: [Expected State][]|✅ OK|Properly scoped client certificate should pass validation|

**Validation Points:**

* Client Auth EKU properly configured
* Suitable for mutual TLS, VPN client auth, smart card authentication
* Single-purpose certificate with appropriate scope

---

### Scenario 3: Code Signing

**Purpose**: Verify code signing certificate purpose validation.

|Setting|Value|Rationale|
|---|---|---|
|:fa-certificate: **EKU**|Code Signing (1.3.6.1.5.5.7.3.3)|Single-purpose EKU for signing executables, scripts, and software packages|
|:fa-key: **Key Usage**|DigitalSignature|Code signing only requires ability to create digital signatures|
|:fa-box-archive: **Store**|Local Machine|Shared code signing certificates accessible to build servers and deployment systems|
|:fa-traffic-light: [Expected State][]|✅ OK|Purpose-specific code signing certificate should validate successfully|

**Validation Points:**

* Code Signing EKU validated
* Appropriate for PowerShell scripts, executables, MSI packages
* Private key protection critical for code integrity

---

### Scenario 4: Multi-Purpose

**Purpose**: Test detection of certificates with multiple EKU extensions (security concern).

|Setting|Value|Rationale|
|---|---|---|
|:fa-certificate: **EKU**|Server Authentication + Client Authentication|Multiple EKUs create broader attack surface - violates least privilege|
|:fa-key: **Key Usage**|DigitalSignature, KeyEncipherment|Combined usage for both server and client operations|
|:fa-box-archive: **Store**|Local Machine|System-wide store to demonstrate improper multi-purpose certificate deployment|
|:fa-traffic-light: [Expected State][]|⚠️ Warning|Should trigger warning for overly permissive certificate scope|

**Validation Points:**

* Multiple EKUs detected (broader attack surface)
* Warning generated for multi-purpose usage
* Violates principle of least privilege

---

### Scenario 5: Any Purpose (Security Risk)

**Purpose**: Detect overly permissive "Any Purpose" certificates (critical security risk).

|Setting|Value|Rationale|
|---|---|---|
|:fa-certificate: **EKU**|Any Purpose (2.5.29.37.0)|Unrestricted usage - can be used for ANY operation if compromised (maximum risk)|
|:fa-key: **Key Usage**|DigitalSignature, KeyEncipherment|Standard key usage combined with Any Purpose EKU creates security risk|
|:fa-box-archive: **Store**|Local Machine|System-wide to demonstrate critical risk of "Any Purpose" in production|
|:fa-traffic-light: [Expected State][]|❌ Critical|Must trigger critical error for immediate remediation|

**Validation Points:**

* Any Purpose EKU (OID 2.5.29.37.0) flagged as critical security risk
* Unrestricted usage enables maximum attack surface
* Immediate remediation required (replace with purpose-specific certificate)

---

### Scenario 6: Missing EKU

**Purpose**: Identify certificates without explicit Enhanced Key Usage (EKU) extensions.

|Setting|Value|Rationale|
|---|---|---|
|:fa-certificate: **EKU**|Not defined|Missing EKU makes certificate purpose unclear and unpredictable|
|:fa-key: **Key Usage**|Default (PowerShell adds automatically)|PowerShell adds default Key Usage; omitting EKU creates undefined purpose|
|:fa-box-archive: **Store**|Local Machine|System-wide store to test detection of incomplete certificate definitions|
|:fa-traffic-light: [Expected State][]|⚠️ Warning|Should trigger warning for undefined EKU - requires manual review|

>[!NOTE]
>PowerShell's `New-SelfSignedCertificate` cmdlet **always adds default Key Usage** values even when not specified. This scenario omits the `-TextExtension` parameter to create a certificate **without an EKU extension**. To create a certificate that truly lacks both Key Usage AND EKU extensions, use `certreq.exe` with a custom INF file that explicitly omits both extensions.

**Validation Points:**

* Missing EKU extension detected
* Warning for undefined certificate purpose
* Requires manual review to determine intended usage

---

## :fa-tools: Batch Testing Script

The [Batch Testing Script][] creates all 6 test scenarios in a single run, including a signed test Root CA for chain validation compatibility.

>[!TIP]
>**Chain Validation Compatible**: The batch script creates a test Root CA installed to the Trusted Root store so chain validation passes automatically — no need to disable chain validation or enable dev mode.

**What the script does:**

* Creates a test Root CA signed by itself (installed to `LocalMachine\Root`)
* Issues all 6 test certificates signed by the test Root CA
* Outputs a summary with thumbprint and expected monitoring state per certificate

[→ View Full Batch Testing Script][Batch Testing Script]

---

## :fa-broom: Cleanup Script

The [Cleanup and Diagnostic Script][] removes all test certificates and the test Root CA after validation.

>[!IMPORTANT]
>The cleanup script removes **both** the 6 test certificates (from `LocalMachine\My`) **and** the Nodinite Test Root CA (from `LocalMachine\Root`).

[→ View Full Cleanup and Diagnostic Script][Cleanup and Diagnostic Script]

---

## :fa-play: Usage Instructions

### Running the Batch Script

1. :fa-terminal: **Open PowerShell 7 as Administrator** and verify version: `$PSVersionTable.PSVersion`

2. :fa-wrench: **Configure Scenarios** (optional): Edit the `$scenarios` hashtable to enable/disable specific tests

3. :fa-play: **Execute** the script from [Batch Testing Script][]

4. :fa-desktop: **Monitor Results**: Wait for agent discovery (or force sync), then verify expected states match actual monitoring results

5. :fa-broom: **Cleanup**: Run the [Cleanup and Diagnostic Script][] when testing is complete

### Validation Checklist

* :fa-square: ✅ **Chain validation passes** (all certs trusted via test Root CA)
* :fa-square: ✅ Server Authentication shows OK state
* :fa-square: ✅ Client Authentication shows OK state
* :fa-square: ✅ Code Signing shows OK state
* :fa-square: ⚠️ Multi-Purpose generates Warning alert
* :fa-square: ❌ Any Purpose generates Critical alert
* :fa-square: ⚠️ Missing EKU generates Warning alert

---

## :fa-question-circle: Frequently Asked Questions

**Q: Why do I get script errors when running the PowerShell 7 test scripts?**  
**A:** These scripts require **PowerShell 7 or later** with Administrator privileges. Verify your PowerShell version by running `$PSVersionTable.PSVersion` — it should show 7.x or higher. PowerShell 5.1 (Windows PowerShell) does not support the `-TextExtension` parameter used for configuring Enhanced Key Usage extensions. Download PowerShell 7+ from [Microsoft's official site](https://learn.microsoft.com/en-us/powershell/scripting/install/install-powershell-on-windows)<sup>:fa-arrow-up-right-from-square:</sup>.

**Q: Will these test certificates trigger chain validation errors?**  
**A:** **No** — the batch script creates a test Root CA and automatically installs it to the Trusted Root Certification Authorities store. All 6 test certificates are signed by this CA, ensuring **chain validation passes**. The [Cleanup and Diagnostic Script][] removes both the test certificates and the Root CA.

**Q: How do I validate Certificate Purpose and EKU usage with :Nodinite:?**  
**A:** Run the [Batch Testing Script][] on your [Windows Server][] to create test certificates with different EKU configurations. The :Nodinite: monitoring agent will automatically discover these certificates during its next synchronization cycle. Review monitoring results in the :Nodinite: [Web Client][] to verify each certificate shows the expected state.

**Q: How do I enable Certificate Purpose and EKU validation in :Nodinite:?**  
**A:** Enable the "Validate Certificate Purpose" feature in the [Windows Server Monitoring Agent][] configuration. See the [Certificate Configuration][] guide for step-by-step instructions.

## :fa-hand-point-right: Next Steps

* :fa-cog: [Certificate Configuration][] – Turn on certificate purpose checks  
* :fa-tools: [Batch Testing Script][] – Create the test certificates for these scenarios  

## :fa-link-horizontal: Related Topics

* :fa-shield-check: [Certificate Overview][]  
* :fa-chart-line: [Certificate Monitoring][]  
* :fa-certificate: [Certificate Purpose and EKU][]  
* :fa-cog: [Certificate Configuration][]  
* :fa-tools: [Batch Testing Script][]  
* :fa-broom: [Cleanup and Diagnostic Script][]  
* :fa-question-circle: [FAQ: Private Key Health Testing Scenarios][]  
* :fa-question-circle: [FAQ: Weak Cryptography Testing Scenarios][]  
* :fa-question-circle: [FAQ: Chain Validation Testing Scenarios][]  

[1]:{ndm}/Documentation%20Pictures/MonitorAgent/WindowsServer/Certificates/CertificatePurposeValidation.png

[Batch Testing Script]:{ndr}/Logging%20and%20Monitoring/Windows%20Server/Features/Certificates/Troubleshooting/Scripts/Batch-Testing-Script.md
[Certificate Configuration]:{ndr}/Logging%20and%20Monitoring/Windows%20Server/Features/Certificates/Configuration.md
[Certificate Monitoring]:{ndr}/Logging%20and%20Monitoring/Windows%20Server/Features/Certificates/Monitoring.md
[Certificate Overview]:{ndr}/Logging%20and%20Monitoring/Windows%20Server/Features/Certificates/Overview.md
[Certificate Purpose and EKU]:{ndr}/Logging%20and%20Monitoring/Windows%20Server/Features/Certificates/Certificate%20Purpose%20and%20EKU.md
[Cleanup and Diagnostic Script]:{ndr}/Logging%20and%20Monitoring/Windows%20Server/Features/Certificates/Troubleshooting/Scripts/Cleanup-and-Diagnostic-Script.md
[Code Signing]:{ndr}/Core%20Services/Security/Code%20Signing%20and%20Binary%20Integrity.md
[Expected State]:{ndr}/Administration/2.%20Monitor%20Management/3.%20Resources/Features/Expected%20State.md
[FAQ: Chain Validation Testing Scenarios]:{ndr}/Logging%20and%20Monitoring/Windows%20Server/Features/Certificates/Troubleshooting/FAQ%20-%20Chain%20Validation%20Testing%20Scenarios.md
[FAQ: Private Key Health Testing Scenarios]:{ndr}/Logging%20and%20Monitoring/Windows%20Server/Features/Certificates/Troubleshooting/FAQ%20-%20Private%20Key%20Health%20Testing.md
[FAQ: Weak Cryptography Testing Scenarios]:{ndr}/Logging%20and%20Monitoring/Windows%20Server/Features/Certificates/Troubleshooting/FAQ%20-%20Weak%20Cryptography%20Testing%20Scenarios.md
[IBM MQ SSL FAQ]:{ndr}/Logging%20and%20Monitoring/IBM%20MQ/Troubleshooting/FAQ%20-%20SSL%20Certificate%20Configuration.md
[IIS]:{ndr}/Logging%20and%20Monitoring/Windows%20Server/Features/IIS.md
[Web Client]:{ndr}/Getting%20Started/Overview.md
[Windows Server]:{ndr}/Logging%20and%20Monitoring/Windows%20Server/Features/Windows%20Server.md
[Windows Server Monitoring Agent]:{ndr}/Logging%20and%20Monitoring/Windows%20Server/Overview.md