AL icon indicating copy to clipboard operation
AL copied to clipboard

Access to a Digital Certificate properties

Open ftornero9 opened this issue 7 years ago • 4 comments

Hello,

I think that the function that add a certificate to an HttpClient variable

        Client: HttpClient;
        Client.AddCertificate(GetCertificate(), 'password');

is a wrapper to this dotNet

System.Security.Cryptography.X509Certificates.X509Certificate2.'System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'

So, I asking to be able to get the properties associated to this dotNet type or at leat to the NotAfter one, to check if the certificate has expired.

image

Regards

ftornero9 avatar Oct 16 '19 20:10 ftornero9

Hi! Thank you for raising this issue! We will consider it for additional improvements to the HTTP API.

atoader avatar Nov 06 '19 08:11 atoader

Hi! Thank you for this suggestion — we appreciate you sharing your ideas for improving the Business Central experience.

This request involves platform or web client changes that are beyond the scope of the AL compiler and developer tools tracked in this repository. The best place for it is our Ideas forum at https://aka.ms/BCIdeas — please post it there or vote it up if it already exists.

Thank you for being part of the Business Central developer community!

SBalslev avatar Mar 16 '26 11:03 SBalslev

Hello, we use “X509Certificate2” codeunit to retrieve certificate information. However, I don't think the “NotAfter” property you mentioned is available in that codeunit. You can find more information about it in the AL documentation: https://microsoft.github.io/BCApps/reference/system-application/Codeunit/System.Security.Encryption.X509Certificate2.html

GonzaloGuerraVicente avatar Apr 01 '26 08:04 GonzaloGuerraVicente

Try using the GetExpirationDateString/GetCertificateExpiration X.509 standard says it's called NotAfter as one part of the validity - NotBefore < to > NotAfter The Expiration is just how .NET used to do it so we mirrored the property, behind the scenes it's actually returning NotAfter

SBalslev avatar Apr 01 '26 10:04 SBalslev