Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/398.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/spring/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
从HTTP头java检索编码值_Java_Spring_Httprequest - Fatal编程技术网

从HTTP头java检索编码值

从HTTP头java检索编码值,java,spring,httprequest,Java,Spring,Httprequest,在我的SpringWebApp中,我收到一个带有RC4加密字符串的HTTP头。当我在从头文件中获取值后解密时,我得到了错误的字符串。下面是spring控制器类的代码摘录。request.getheader()方法中的默认解码是什么。如何使用其他解码 以下是显示标题键和值的tcp跟踪屏幕截图 您的实际密钥是否可以用7位ASCII表示?如果没有,您可能会遇到字符编码问题,因为您没有明确指定字符集。谢谢Andy。我想从标头中检索的值类似于“sN vÎÙ¸Ýv”。在从getHeader()方法中获取值

在我的SpringWebApp中,我收到一个带有RC4加密字符串的HTTP头。当我在从头文件中获取值后解密时,我得到了错误的字符串。下面是spring控制器类的代码摘录。request.getheader()方法中的默认解码是什么。如何使用其他解码

以下是显示标题键和值的tcp跟踪屏幕截图


您的实际密钥是否可以用7位ASCII表示?如果没有,您可能会遇到字符编码问题,因为您没有明确指定字符集。谢谢Andy。我想从标头中检索的值类似于“sN vÎÙ¸Ýv”。在从getHeader()方法中获取值时,如何明确指定要使用的解码。(对于HTTP头来说,这是一个不合理的值。)您可能需要按照尝试
ISO-8859-1
。如果做不到这一点,UTF-8可能也值得一试。您对请求来源的任何了解都可能会给您提供进一步的想法来尝试。不幸的是,是的。出于安全原因,我们使用此函数获取手机号码的RC4加密值。我正在更新我的问题,屏幕截图显示了我可以在tcp跟踪中看到的值。感谢您的支持。
iconv
接受序列为
ISO-8859-1
byte[] enc_msisdn = request.getHeader(headerName).getBytes();
rc4 = new RC4("rc4pskey".getBytes());
byte[] decipher = rc4.decrypt(enc_msisdn);