-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Description
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.