nguyenngocquy21130506 / SecurityWeb

0 stars 0 forks source link

Trao đổi dữ liệu giữa JSP và Servlet #1

Open 21130407KhuongVo opened 18 hours ago

21130407KhuongVo commented 18 hours ago

Giải pháp: RSA

  1. Class AppInitializer.java có nhiệm vụ sẽ tự động tạo cặp public keyprivate key mỗi khi chương trình được khởi chạy và lưu chúng vào trong Context của ứng dụng

image

  1. Ở trong file jsp sẽ thực hiện lấy context bằng cách image Gắn link thư viện JSEncrypt <script src="https://cdnjs.cloudflare.com/ajax/libs/jsencrypt/3.0.0-beta.1/jsencrypt.min.js"></script> Thực hiện tạo đối tượng JSEncrypt và truyền key vào. Gọi phương thức encrypt để thực hiện mã hóa dữ liệu image

  2. Ở trong file java sẽ thực hiện lấy context bằng cách PrivateKey privateKey = (PrivateKey) req.getServletContext().getAttribute("PRIVATE_KEY"); image

21130407KhuongVo commented 18 hours ago

@PhiLongNLU @nguyenngocquy21130506