我有一个用aes128对称算法加密的文件。如何在spark中配置解码文件?
我试着像下面那样加载文件,然后调用自定义函数来进行解密。但解密总是失败。看起来加密的二进制内容在通过spark加载后发生了变化。如何避免?
val dec = spark.sparkContext.textFile("inputFile")
dec.coalesce(1, shuffle=true).saveAsTExtFile("path")
解密保存文件时出现异常
Input length must be multiple of 16 when decrypting with padded cipher
java.lang.SecurityException: Input length must be multiple of 16 when decrypting with padded cipher
1条答案
按热度按时间tquggr8v1#
据我所知,spark本身没有解密api,因此您必须逐行(或者在dataframes的情况下是逐单元)进行解密。
代码方面你可以做如下的事情,
假设示例中的文本文件,