Skip to content

DnsNameProperty not working in Powershell 7.4.x and 7.5.x #25635

@peeerle

Description

@peeerle

Summary of the new feature / enhancement

Dear all,

(Windows 11 resp. Win Srv 2025 Std 64 BIT)

The class DnsNameProperty seems not to be working with PWSH.
Although the class exists it is not working properly when using in conjunction with X509Certificate2.
Is that behavior be intention?
Is there a successor or other new path to get the values from certificate?

Explanation :
With Powershell 5.1 I can use it and the Property is automatically filled when I loaded a certificate.
With PWSH I can instantiate it with an instance of a certificate (after adding type with Microsoft.PowerShell.Security.dll), but the property DnsNameList is not filled.

Also the Property EnhancedKeyUsageList remains empty with PWSH when loading a certificate from a file.

Pls. advise a workaround or a better way to get the info from the file.

THX and beste regards!

Proposed technical implementation details (optional)

I tried to ways to load the cert with PWSH (partial pieces here only):
1.
[ type]$tpeCrtLdrTpe= 'System.Security.Cryptography.X509Certificates.X509CertificateLoader' -as [type]
$tpeCrtLdrTpe::LoadCertificateFromFile( $file)

[ X509Certificate2]::new( $thebytes)

Both ways seem to work correctly and creating the x509certicate2 instance.
But only with Windows Powershell all properties are filled.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue-Enhancementthe issue is more of a feature request than a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions