This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const crypto = require('crypto'); | |
const fs = require('fs'); | |
// Phát sinh một khoá bí mật Ks của thuật toán AES | |
function generateAESSecretKey() { | |
return crypto.randomBytes(32); // 32 bytes = 256 bits | |
} | |
// Mã hoá tập tin sử dụng thuật toán AES với khoá Ks | |
function encryptFileAES(filePath, secretKey) { |