如何使用bycrypt js加密视频文件?

时间:2019-03-12 07:08:51

标签: angular video cryptojs

我正在尝试在下载和使用FileReader API时对视频文件进行加密。下面是我的代码:

leadGenSubmit() {
    let headers = new HttpHeaders();
    let reader = new FileReader();
    headers = headers.set("Accept", "video/mp4");
    let url = "http://static.videogular.com/assets/videos/videogular.mp4";
    let filename = url.substring(url.lastIndexOf('/')+1);
    return this.http
      .get(url, { headers: headers, responseType: "blob" })
      .subscribe(
        data => {
          console.log(data);
          var blob = new Blob([data], { type: "video/mp4" });
          var myPassword = "myPassword";
          var encrypted = CryptoJS.AES.encrypt(reader.result, myPassword);
          console.log("Encrypted" + encrypted);
          reader.readAsDataURL(blob);
          saveAs(blob, filename);
        },
        err => {
          console.log(err);
        }
      );
  }

我调试了一下,发现它正在记录不同的加密密钥,但是我无法确定它是否已加密。

0 个答案:

没有答案