using System; using Org.BouncyCastle.X509; using Org.BouncyCastle.Asn1.X509; // Load the certificate from a file X509Certificate cert = new X509CertificateParser().ReadCertificate("certificate.crt"); // Retrieve the subject alternative name extension DerOctetString extensionValue = (DerOctetString)cert.GetExtensionValue(X509Extensions.SubjectAlternativeName); // Convert the extension data to a string for display string extensionData = extensionValue.GetOctetString(); Console.WriteLine("Subject Alternative Name: " + extensionData);In this example, the GetExtensionValue() method is called on a loaded X509Certificate object, passing in the OID for the subject alternative name extension. The resulting extension value is returned as a DerOctetString object, which is converted to a string for display. The Org.BouncyCastle.X509 namespace is part of the Bouncy Castle Crypto library for C#. This library provides a wide range of cryptographic functionality, including support for encryption, digital signatures, and secure communication protocols.