TAILIEUCHUNG - Building Secure ASP.NET Applications phần 9

Quay trở lại Form1 trong chế độ thiết kế và kích đúp vào nút Decrypt để tạo ra xử lý sự kiện một nút bấm. 10. Thêm đoạn code sau đây để xử lý sự kiện nút Decrypt. try {/ / Thiết lập các đối tượng decryptor decryptor Tháng Mười Hai = n | 442 Building Secure Applications Perform the encryption byte cipherText plainText key Store the intialization vector as this will be required for decryption Display the encrypted string cipherText catch Exception ex Exception encrypting Encryption Test Harness 9. Return to Form1 in Designer mode and double-click the Decrypt button to create a button click event handler. 10. Add the following code to the Decrypt button event handler. try Set up the Decryptor object Decryptor dec new Decryptor Set the Initialization Vector byte key Perform the decryption byte plainText key Display the decrypted string. plainText catch Exception ex Exception decrypting. Encryption Test Harness 11. Return to Form1 in Designer mode and double-click the Write Registry Data button to create a button click event handler. 12. Add the following code to the event handler. Create registry key and named values RegistryKey rk Software true rk TestApplication How To Store an Encrypted Connection String in the Registry 443 Write encrypted string initialization vector and key to the registry connectionString initVector key The data has been successfully written to the registry 13. Run the application and then click Encrypt. The encrypted connection string is displayed in the Encrypted String field. 14. Click Decrypt. The original .

TỪ KHÓA LIÊN QUAN
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.