Certificate pinning đảm bảo app chỉ giao tiếp với server có certificate SSL cụ thể, ngăn chặn tấn công man-in-the-middle. Dùng CertificatePinner của OkHttp để pin public key hash.
Ví dụ: CertificatePinner.Builder().add("example.com", "sha256/AAAAAAA...").build(). Cần xử lý việc xoay certificate. Implement cho app nhạy cảm (banking, social network) hoặc dữ liệu có giá trị cao.
Certificate pinning ensures your app only communicates with servers having a specific SSL certificate, preventing man-in-the-middle attacks. Use OkHttp's CertificatePinner to pin public key hashes.
Example: CertificatePinner.Builder().add("example.com", "sha256/AAAAAAA...").build(). This adds security but requires handling certificate rotation. Implement for sensitive apps (banking, social networks).