数据流,使用客户提供的加密密钥加载文件

Dataflow, loading a file with a customer supplied encryption key

尝试使用 CSEK 加载 GCS 文件时出现数据流错误

[ERROR] The target object is encrypted by a customer-supplied encryption key

我打算尝试在数据流端进行 AES 解密,但我发现如果不传递加密密钥我什至无法获取文件。

还有其他方法可以从数据流中加载 CSEK 加密的 Google 云存储文件吗?例如使用 google 云存储 api,获取流句柄然后将其传递给数据流?

    // Fails
    p.apply("Read from source", TextIO.read().from("gs://my_bucket/myfile")).apply(..); 

documentation Cloud Dataflow do not currently support objects encrypted with customer-supplied encryption keys. I opened a feature request 对此加以实施。

请注意,您无法在没有加密密钥的情况下获取使用客户提供的加密密钥 (CSEK) 上传的云存储中的文件。

根据documentation

If you use customer-supplied encryption keys or client-side encryption, you must securely manage your keys and ensure that they are not lost. If you lose your keys, you are no longer able to read your data, and you continue to be charged for storage of your objects until you delete them.

如果我们还有 CSE 密钥,示例 Java 访问文件的代码是:

byte[] content = storage.readAllBytes(
    bucketName, blobName, BlobSourceOption.decryptionKey(decryptionKey));

描述了使用 CSEK 获取文件的所有其他可能方法 here