我试图使用java代码计算aws授权代码,但这不起作用给出错误:
String host =“bucketname”+“.s3-us-east-2.amazonaws.com”; 日历cal =日历….
要签名的字符串实际上缺少一些元素,例如区域(参见 https://docs.aws.amazon.com/general/latest/gr/sigv4_elements.html )
请在此处查看Java代码示例 https://docs.aws.amazon.com/general/latest/gr/signature-v4-examples.html#signature-v4-examples-java
AWS SDK for Java有一个Signer组件,可以为您实现此功能 - 无需编写自己的代码 https://docs.aws.amazon.com/AWSJavaSDK/latest/javadoc/com/amazonaws/auth/AWS4Signer.html