Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
2.1k views
in Technique[技术] by (71.8m points)

amazon s3 - AWS java SDK manually set signature version

I'm trying to access a blob store service which is on top of AWS S3. It supports AWS SDK and it's signature version 2.

I'm using code here to access the this service.

Is it possible to manually set the signature version of the request made by AWS SDK ?

According to this page

AWS currently supports two signature versions: signature version 2 and signature version 4, which are covered in this section. Most services support version 4, and if a service supports version 4, we strongly recommend that you use that version.

I'm unable to find how to set the signature version to 2 or 4 manually.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

From the S3 Developer Guide - Specifying Signature Version in Request Authentication:

Java SDK

Add the following in your code.

System.setProperty(SDKGlobalConfiguration.ENABLE_S3_SIGV4_SYSTEM_PROPERTY, "true");

Or, on the command line, specify the following.

-Dcom.amazonaws.services.s3.enableV4

It looks like v2 was the default in the AWS SDK previously, but v4 is now the default starting in SDK v1.11.0 (May, 2016).


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

57.0k users

...