- [DEVEXPRESS] Hỗ trợ tìm kiếm highlight không dấu và không khoảng cách trên Gridview Filter
- [C#] Chia sẻ source code phần mềm Image Downloader tải hàng loạt hình ảnh từ danh sách link url
- [C#] Chụp hình và quay video từ camera trên winform
- [C#] Chia sẽ full source code tách file Pdf thành nhiều file với các tùy chọn
- Giới thiệu về Stock Tracker Widget - Công cụ theo dõi cổ phiếu và cảnh báo giá tăng giảm bằng C# và WPF
- [VB.NET] Chia sẻ công cụ nhập số tiền tự động định dạng tiền tệ Việt Nam
- [VB.NET] Hướng dẫn fill dữ liệu từ winform vào Microsoft word
- [VB.NET] Hướng dẫn chọn nhiều dòng trên Datagridview
- Hướng Dẫn Đăng Nhập Nhiều Tài Khoản Zalo Trên Máy Tính Cực Kỳ Đơn Giản
- [C#] Chia sẻ source code phần mềm đếm số trang tập tin file PDF
- [C#] Cách Sử Dụng DeviceId trong C# Để Tạo Khóa Cho Ứng Dụng
- [SQLSERVER] Loại bỏ Restricted User trên database MSSQL
- [C#] Hướng dẫn tạo mã QRcode Style trên winform
- [C#] Hướng dẫn sử dụng temp mail service api trên winform
- [C#] Hướng dẫn tạo mã thanh toán VietQR Pay không sử dụng API trên winform
- [C#] Hướng Dẫn Tạo Windows Service Đơn Giản Bằng Topshelf
- [C#] Chia sẻ source code đọc dữ liệu từ Google Sheet trên winform
- [C#] Chia sẻ source code tạo mã QR MOMO đa năng Winform
- [C#] Chia sẻ source code phần mềm lên lịch tự động chạy ứng dụng Scheduler Task Winform
- [C#] Hướng dẫn download file từ Minio Server Winform
[C#] Hướng dẫn đọc thông tin chứng chỉ SSL trên website
Xin chào các bạn, bài viết này mình tiếp tục hướng dẫn các bạn cách đọc chứng chỉ Certificate SSL trên một website: lấy các thông số đơn vị cấp, ngày cấp, ngày hết hạn...
[C#] How to get info certificate https website
Nếu bạn quản lý một lúc nhiều website, và bạn muốn quản lý thông tin tất cả các chứng chỉ website.
Thì bài viết này, sẻ giúp bạn các code để lấy thông tin của một certificate website.
Thông tin ssl của website mình xem từ trình duyệt Chrome:

Giao diện demo ứng dụng đọc thông tin certificate ssl của laptrinhvb.net:

Ở hình trên, các bạn thấy thông tin chi tiết của website laptrinhvb.
Source code C#:
using System;
using System.Net.Security;
using System.Net.Sockets;
using System.Security.Cryptography.X509Certificates;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace DownloadCertificateWebsite
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        private async void btnGet_Click(object sender, EventArgs e)
        {
            var info = new StringBuilder();
            var certificate = await CertificateDownloader.GetCertificateAsync(txt_website.Text.Trim(), 443);
            info.AppendLine($"Subject:   {certificate.Subject}");
            info.AppendLine($"Issuer:    {certificate.Issuer}");
            info.AppendLine($"NotBefore: {certificate.NotBefore}");
            info.AppendLine($"NotAfter:  {certificate.NotAfter}");
            info.AppendLine($"Algorithm: {certificate.SignatureAlgorithm.FriendlyName}");
            txt_info.Text = info.ToString();
        }
    }
    static class CertificateDownloader
    {
        private static readonly RemoteCertificateValidationCallback s_certificateCallback = (a, b, c, d) => true;
        public static async Task<X509Certificate2> GetCertificateAsync(string domain, int port = 443)
        {
            var client = new TcpClient(domain, port);
            var sslStream = new SslStream(client.GetStream(), leaveInnerStreamOpen: true, s_certificateCallback);
            await sslStream.AuthenticateAsClientAsync(domain).ConfigureAwait(false);
            var serverCertificate = sslStream.RemoteCertificate;
            if (serverCertificate != null)
                return new X509Certificate2(serverCertificate);
            return null;
        }
    }
}
Thanks for watching!

![[C#] Hướng dẫn đọc thông tin chứng chỉ SSL trên website](https://laptrinhvb.net/uploads/users/9a8cb514e4428e85fb4ca07588e9103f.png)


![[C#] Hướng dẫn tạo tab ứng dụng giống Chrome sử dụng thư viện EasyTabs](https://laptrinhvb.net/uploads/source/csharp/tab_google_thumb.png)
![[C#] Sử dụng DotNetBrowser nhân Chromium giải pháp thay thế WebBrowser trên Winform](https://laptrinhvb.net/uploads/source/vbnet/dot_net_browser_thumb.jpg)
![[C#] Hướng dẫn custom Radio Button trên Winform](https://laptrinhvb.net/uploads/source/vbnet/custom_radio_button.gif)
![[C#] Hướng dẫn bắt sự kiện submit form khi enter ở textbox username hoặc mật khẩu](https://laptrinhvb.net/uploads/source/csharp/login_system_thumb.png)
![[C#] Hướng dẫn truyền dữ liệu giữa hai ứng dụng](https://laptrinhvb.net/uploads/source/image_baiviet/9d74ed52d1e8e78e2b458641ccfb565f.jpg)
![[C#] Hướng dẫn tạo dữ liệu test hàng loạt với thư viện Bogus for .NET](https://laptrinhvb.net/uploads/source/new_image_baiviet/bogus_fake_data.png)
![[C#] Hướng dẫn thiết kế form loading splash screen transparent winform](https://laptrinhvb.net/uploads/source/vbnet/TransparentSplashScreen_thumb.png)
![[C#] Hướng dẫn ngắt kết nối mạng card ethenet trong windows](https://laptrinhvb.net/uploads/source/csharp/ethenet_csharp_thumb.jpg)
![[C#] Hướng dẫn Detect Face and Crop Image sử dụng EmguCV trong lập trình Winform](https://laptrinhvb.net/uploads/source/csharp/detect_face_and_crop_csharp_thumb.jpg)
![[C#] Hướng dẫn chèn video Youtube vào App Winform](https://laptrinhvb.net/uploads/source/csharp/youtube_embble_thumb.jpg)
![[C#] Copy File Share trong mạng Lan với chứng thực tài khoản Domain với tên đăng nhập và mật khẩu](https://laptrinhvb.net/uploads/source/vbnet/copy_file_share_network_csharp.jpg)
![[C#] Chèn chú thích dưới hình ảnh lập trình Winform](https://laptrinhvb.net/uploads/source/csharp/footer_image_csharp.png)
![[C#] Hướng dẫn xuất dữ liệu từ DataGridview ra file Excel](https://laptrinhvb.net/uploads/source/new_image_baiviet/data_gridview_to_excel.png)
![[C#] Hướng dẫn tạo Float Text OSD Windows trong lập trình Winform](https://laptrinhvb.net/uploads/source/csharp/osd_windows_thumb.png)
![[C#] Giới thiệu thư viện Fluent FTP Awesome dùng để làm việc với FTP](https://laptrinhvb.net/uploads/source/vbnet/fluent_ftp_thumb.png)
![[C#] Giới thiệu Template Engine Scriban trên NET](https://laptrinhvb.net/uploads/source/new_image_baiviet/scriban_template_engine.png)
![[C#] Fake Blue Screen BSOD in winform](https://laptrinhvb.net/uploads/source/new_image_baiviet/fake_bsod.png)

![[C#] Hướng dẫn đọc dữ liệu Text từ chương trình Notepad sử dụng Win32](https://laptrinhvb.net/uploads/source/csharp/win32_gettext.png)
![[C#] Bảo mật source code .NET sử dụng VaultVM Tool](https://laptrinhvb.net/uploads/source/new_image_baiviet/vaultVM_tools.png)
![[C#] Viết ứng dụng Scan Subnet địa chỉ IP trong cùng mạng LAN](https://laptrinhvb.net/uploads/source/devexpress/scan_ip_thumb.jpg)
![[C#] Memory Cache là gì, và sử dụng trong ứng dụng Winform](https://laptrinhvb.net/uploads/source/new_image_baiviet/memory_cache.png)
![[C#] Chia sẽ thư viện MCoreLib.dll để lập trình AT Command gởi, nhận tin nhắn SMS  và các chức năng khác](https://laptrinhvb.net/uploads/source/csharp/sms_lib_csharp.jpg)
![[C#] Hướng dẫn code hiển thị thời gian thực trên Winform](https://laptrinhvb.net/uploads/source/vbnet/time_relative.png)
