Signature Does Not Match Error

126 views
Skip to first unread message

Tiziano Fortin

unread,
Aug 26, 2015, 8:26:45 AM8/26/15
to JetS3t Users
Hi....
I've the following problem with Java JetS3t API 0.9.4:

when i try to upload new S3Object in my bucket in this way:


S3Object obj = null;

        try {
            obj = new S3Object(URLEncoder.encode(myFile.getEmail(), "UTF-8") + "/" + myFile.getFileName(), myFile.getFile());
            obj.setContentType(myFile.getMimeType());
            obj.setBucketName(this.bucketName);
            obj.addMetadata("title", myFile.getTitoloOpera());
            obj.addMetadata("description", myFile.getDescrizioneOpera());
            obj.addMetadata("extraInfo", myFile.getAltreInfo());
            obj.addMetadata("hash", new String(Hex.encodeHexString(myFile.getHash())));
            obj.addMetadata("email", myFile.getEmail());
            obj.addMetadata("userid", myFile.getIdUser());
            obj.addMetadata("index", String.valueOf(index));
            obj.addMetadata("T", T);
            obj.setSHA256Hash(myFile.getHash());
            obj = this.s3Service.putObject(this.bucketName, obj);     <-- HERE THE ERROR!!
            return obj;



I get this error:


RestStorageService:611 - Rethrowing as a ServiceException error in performRequest: org.jets3t.service.ServiceException: Service Error Message. -- ResponseCode: 403, ResponseStatus: null, XML Error Message: <?xml version="1.0" encoding="UTF-8"?><Error><Code>SignatureDoesNotMatch</Code><Message></Message></Error>

2015-08-26 13:39:15 DEBUG RestStorageService:615 - Releasing HttpClient connection after error: Service Error Message.

2015-08-26 13:39:15 DEBUG SeewebUtils:199 - co.proofy.proofycommonlibs.SeewebUtilsorg.jets3t.service.S3ServiceException: Service Error Message. -- ResponseCode: 403, ResponseStatus: Forbidden, XML Error Message: <?xml version="1.0" encoding="UTF-8"?><Error><Code>SignatureDoesNotMatch</Code><Message></Message></Error>


What does it mean this error? where is my fault?


thankyou




James Murty

unread,
Aug 26, 2015, 8:35:59 AM8/26/15
to jets3t...@googlegroups.com
Hi,

I don't know what your `myFile.getHash()` method call is doing, but it probably isn't the right thing.

If you are using the S3Object(S3Bucket, File) constructor, as it seems you are, you don't need to set the SHA256 hash yourself because JetS3t does it automatically. So if you just remove the `obj.setSHA256Hash()` line of code altogether it should fix the problem.

If you really do need to set this hash value yourself, use JetS3t's ServiceUtils#hashSHA256 method to generate the hash byte value.

Hope this helps,
James


--
You received this message because you are subscribed to the Google Groups "JetS3t Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jets3t-users...@googlegroups.com.
To post to this group, send email to jets3t...@googlegroups.com.
Visit this group at http://groups.google.com/group/jets3t-users.
For more options, visit https://groups.google.com/d/optout.

Tiziano Fortin

unread,
Aug 26, 2015, 8:46:34 AM8/26/15
to JetS3t Users
Hi James,
thankyou... I'll provide to remove that line and I'll do some tests to verify this.
I'll let you know as soon as possible....

thankyou!

Tiziano Fortin

unread,
Sep 23, 2015, 5:05:21 AM9/23/15
to JetS3t Users
Hi james.... I've done many and many test about this...
but the error is the same : SignatureDoesNotMatch
but this error is not for all file.... only a few (i don't know the reason)

any ideas?

thanks!

Tiziano Fortin

unread,
Sep 24, 2015, 4:53:42 AM9/24/15
to JetS3t Users
here a complete stack trace if need:

2015-09-24 08:48:44 DEBUG SeewebUtils:55 - >>> Bucket in use: production

2015-09-24 08:48:44 DEBUG Jets3tProperties:326 - s3service.https-only=true

2015-09-24 08:48:44 DEBUG Jets3tProperties:306 - storage-service.internal-error-retry-max=5

2015-09-24 08:48:44 DEBUG Jets3tProperties:326 - storage-service.apply-recommended-dns-caching-defaults=true

2015-09-24 08:48:44 DEBUG StorageService:138 - Setting recommended DNS caching defaults

2015-09-24 08:48:44 DEBUG StorageService:147 - Using DNS caching system settings: networkaddress.cache.ttl=300, networkaddress.cache.negative.ttl=1

2015-09-24 08:48:44 DEBUG Jets3tProperties:266 - http.connection-manager.factory-class-name=org.jets3t.service.utils.RestUtils$ConnManagerFactory

2015-09-24 08:48:44 DEBUG Jets3tProperties:306 - httpclient.connection-timeout-ms=60000

2015-09-24 08:48:44 DEBUG Jets3tProperties:306 - httpclient.socket-timeout-ms=60000

2015-09-24 08:48:44 DEBUG Jets3tProperties:326 - httpclient.stale-checking-enabled=true

2015-09-24 08:48:44 DEBUG Jets3tProperties:266 - httpclient.useragent=null

2015-09-24 08:48:44 DEBUG RestUtils:342 - Setting user agent string: JetS3t/0.9.4 (Linux/2.6.32-29-pve; i386; it; JVM 1.7.0_80) 

2015-09-24 08:48:44 DEBUG Jets3tProperties:326 - http.protocol.expect-continue=true

2015-09-24 08:48:44 DEBUG Jets3tProperties:286 - httpclient.connection-manager-timeout=0

2015-09-24 08:48:44 DEBUG Jets3tProperties:306 - httpclient.retry-max=5

2015-09-24 08:48:44 DEBUG Jets3tProperties:326 - httpclient.proxy-autodetect=true

2015-09-24 08:48:44 DEBUG Jets3tProperties:266 - s3service.s3-endpoint=seewebstorage.it

2015-09-24 08:48:45 DEBUG PluginProxyUtil:100 - About to attempt auto proxy detection under Java version:1.7.0_80-b15

2015-09-24 08:48:45 DEBUG PluginProxyUtil:120 - Sun Plugin reported java version not 1.3.X, 1.4.X, 1.5.X or 1.6.X - trying failover detection...

2015-09-24 08:48:45 DEBUG PluginProxyUtil:127 - Using failover proxy detection...

2015-09-24 08:48:45 DEBUG PluginProxyUtil:290 - Plugin Proxy Config List Property:null

2015-09-24 08:48:45 DEBUG PluginProxyUtil:321 - No configured plugin proxy list

2015-09-24 08:48:45 DEBUG Jets3tProperties:266 - s3service.default-storage-class=null

2015-09-24 08:48:45 DEBUG Jets3tProperties:266 - s3service.server-side-encryption=null

2015-09-24 08:48:45 DEBUG Jets3tProperties:266 - devpay.user-token=null

2015-09-24 08:48:45 DEBUG Jets3tProperties:266 - devpay.product-token=null

2015-09-24 08:48:45 DEBUG Jets3tProperties:326 - httpclient.requester-pays-buckets-enabled=false

2015-09-24 08:48:45 DEBUG RestStorageService:1847 - Creating Object with key xxx%40gmail.com/Clienti Proof.numbers in bucket production

2015-09-24 08:48:45 DEBUG RestStorageService:1855 - Uploading object data with Content-Length: 166256

2015-09-24 08:48:45 DEBUG RepeatableRequestEntity:143 - Setting maximal read-ahead mark limit for markable input stream java.io.ByteArrayInputStream assuming it doesn't use in-memory storage: 166256

2015-09-24 08:48:45 DEBUG Jets3tProperties:286 - httpclient.read-throttle=0

2015-09-24 08:48:45 DEBUG Jets3tProperties:266 - s3service.s3-endpoint=seewebstorage.it

2015-09-24 08:48:45 DEBUG Jets3tProperties:326 - s3service.enable-storage-classes=true

2015-09-24 08:48:45 DEBUG Jets3tProperties:266 - s3service.s3-endpoint=seewebstorage.it

2015-09-24 08:48:45 DEBUG RestStorageService:1958 - Creating object bucketName=production, objectKey=xxx%40gmail.com/Clienti Proof.numbers, storageClass=null. Content-Type=application/octet-stream Including data? true Metadata: {title=kjgbkhbhmb  lhkljb,, hash=546cab4fedaa46c22400b72dbfd95ecd6899f022684a097767ca518dc3bd7196, email=x...@gmail.com, Content-Length=166256, description=jkgb,b.jhyf, userid=62, Content-MD5=JU8cGTH5JrXwuPz3RLwZQQ==, extraInfo=kjgk,jb-.lgykf , md5-hash=254f1c1931f926b5f0b8fcf744bc1941, x-amz-content-sha256=546cab4fedaa46c22400b72dbfd95ecd6899f022684a097767ca518dc3bd7196, Content-Type=application/octet-stream} ACL: null

2015-09-24 08:48:45 DEBUG Jets3tProperties:326 - s3service.disable-dns-buckets=false

2015-09-24 08:48:45 DEBUG Jets3tProperties:266 - s3service.s3-endpoint=seewebstorage.it

2015-09-24 08:48:45 DEBUG Jets3tProperties:266 - s3service.s3-endpoint-virtual-path=

2015-09-24 08:48:45 DEBUG Jets3tProperties:306 - s3service.s3-endpoint-https-port=443

2015-09-24 08:48:45 DEBUG RestStorageService:1336 - S3 URL: https://production.seewebstorage.it:443/xxx%2540gmail.com/Clienti%20Proofy.numbers

2015-09-24 08:48:45 DEBUG RestStorageService:303 - Performing PUT request for 'https://production.seewebstorage.it:443/xxx%2540gmail.com/Clienti%20Proofy.numbers', expecting response codes: [200,204]

2015-09-24 08:48:45 DEBUG RestStorageService:307 - Headers: [Date: Thu, 24 Sep 2015 06:48:45 GMT, x-amz-meta-userid: 62, x-amz-meta-description: jkgb,b.jhyf, x-amz-meta-extraInfo: kjgk,jb-.lgykf , Content-MD5: JU8cGTH5JrXwuPz3RLwZQQ==, x-amz-content-sha256: 546cab4fedaa46c22400b72dbfd95ecd6899f022684a097767ca518dc3bd7196, x-amz-meta-email: x...@gmail.com, x-amz-meta-hash: 546cab4fedaa46c22400b72dbfd95ecd6899f022684a097767ca518dc3bd7196, Content-Type: application/octet-stream, x-amz-meta-md5-hash: 254f1c1931f926b5f0b8fcf744bc1941, x-amz-meta-title: kjgbkhbhmb  lhkljb,]

2015-09-24 08:48:45 DEBUG Jets3tProperties:306 - httpclient.retry-max=5

2015-09-24 08:48:45 DEBUG RestStorageService:694 - Adding authorization for Access Key 'cos0624'.

2015-09-24 08:48:45 DEBUG Jets3tProperties:266 - s3service.s3-endpoint=seewebstorage.it

2015-09-24 08:48:45 DEBUG Jets3tProperties:266 - storage-service.request-signature-version=AWS2

2015-09-24 08:48:45 DEBUG Jets3tProperties:266 - s3service.s3-endpoint=seewebstorage.it

2015-09-24 08:48:45 DEBUG RestStorageService:819 - Canonical string ('|' is a newline): PUT|JU8cGTH5JrXwuPz3RLwZQQ==|application/octet-stream|Thu, 24 Sep 2015 06:48:45 GMT|x-amz-content-sha256:546cab4fedaa46c22400b72dbfd95ecd6899f022684a097767ca518dc3bd7196|x-amz-meta-description:jkgb,b.jhyf|x-amz-meta-email:x...@gmail.com|x-amz-meta-extrainfo:kjgk,jb-.lgykf |x-amz-meta-hash:546cab4fedaa46c22400b72dbfd95ecd6899f022684a097767ca518dc3bd7196|x-amz-meta-md5-hash:254f1c1931f926b5f0b8fcf744bc1941|x-amz-meta-title:kjgbkhbhmb  lhkljb,|x-amz-meta-userid:62|/production/xxx%2540gmail.com/Clienti%20Proof.numbers

2015-09-24 08:48:46 DEBUG Jets3tProperties:306 - httpclient.max-connections=20

2015-09-24 08:48:46 DEBUG Jets3tProperties:306 - httpclient.max-connections-per-host=0

2015-09-24 08:48:46 DEBUG Jets3tProperties:286 - httpclient.connection.ttl=-1

2015-09-24 08:48:46 DEBUG RestUtils$ThreadSafeConnManager:235 - Get connection: {s}->https://production.seewebstorage.it:443, timeout = 0

2015-09-24 08:48:46 DEBUG ConnPoolByRoute:345 - [{s}->https://production.seewebstorage.it:443] total kept alive: 0, total issued: 0, total allocated: 0 out of 20

2015-09-24 08:48:46 DEBUG ConnPoolByRoute:520 - No free connections [{s}->https://production.seewebstorage.it:443][null]

2015-09-24 08:48:46 DEBUG ConnPoolByRoute:364 - Available capacity: 20 out of 20 [{s}->https://production.seewebstorage.it:443][null]

2015-09-24 08:48:46 DEBUG ConnPoolByRoute:546 - Creating new connection [{s}->https://production.seewebstorage.it:443]

2015-09-24 08:48:46 DEBUG DefaultClientConnectionOperator:174 - Connecting to production.seewebstorage.it:443

2015-09-24 08:48:47 DEBUG RequestAddCookies:122 - CookieSpec selected: default

2015-09-24 08:48:47 DEBUG RequestAuthCache:76 - Auth cache not set in the context

2015-09-24 08:48:47 DEBUG RequestProxyAuthentication:87 - Proxy auth state: UNCHALLENGED

2015-09-24 08:48:47 DEBUG DefaultHttpClient:683 - Attempt 1 to execute request

2015-09-24 08:48:47 DEBUG DefaultClientConnection:268 - Sending request: PUT /xxx%2540gmail.com/Clienti%20Proofy.numbers HTTP/1.1

2015-09-24 08:48:47 DEBUG wire:72 -  >> "PUT /xxx%2540gmail.com/Clienti%20Proofy.numbers HTTP/1.1[\r][\n]"

2015-09-24 08:48:47 DEBUG wire:72 -  >> "Date: Thu, 24 Sep 2015 06:48:45 GMT[\r][\n]"

2015-09-24 08:48:47 DEBUG wire:72 -  >> "x-amz-meta-userid: 62[\r][\n]"

2015-09-24 08:48:47 DEBUG wire:72 -  >> "x-amz-meta-description: jkgb,b.jhyf[\r][\n]"

2015-09-24 08:48:47 DEBUG wire:72 -  >> "x-amz-meta-extraInfo: kjgk,jb-.lgykf [\r][\n]"

2015-09-24 08:48:47 DEBUG wire:72 -  >> "Content-MD5: JU8cGTH5JrXwuPz3RLwZQQ==[\r][\n]"

2015-09-24 08:48:47 DEBUG wire:72 -  >> "x-amz-content-sha256: 546cab4fedaa46c22400b72dbfd95ecd6899f022684a097767ca518dc3bd7196[\r][\n]"

2015-09-24 08:48:47 DEBUG wire:72 -  >> "x-amz-meta-email: xx...@gmail.com[\r][\n]"

2015-09-24 08:48:47 DEBUG wire:72 -  >> "x-amz-meta-hash: 546cab4fedaa46c22400b72dbfd95ecd6899f022684a097767ca518dc3bd7196[\r][\n]"

2015-09-24 08:48:47 DEBUG wire:72 -  >> "Content-Type: application/octet-stream[\r][\n]"

2015-09-24 08:48:47 DEBUG wire:72 -  >> "x-amz-meta-md5-hash: 254f1c1931f926b5f0b8fcf744bc1941[\r][\n]"

2015-09-24 08:48:47 DEBUG wire:72 -  >> "x-amz-meta-title: kjgbkhbhmb  lhkljb,[\r][\n]"

2015-09-24 08:48:47 DEBUG wire:72 -  >> "Authorization: AWS xxx:SzruRz0y9KNCchC2oROe8vy0vK0=[\r][\n]"

2015-09-24 08:48:47 DEBUG wire:72 -  >> "Content-Length: 166256[\r][\n]"

2015-09-24 08:48:47 DEBUG wire:72 -  >> "Host: production.seewebstorage.it:443[\r][\n]"

2015-09-24 08:48:47 DEBUG wire:72 -  >> "Connection: Keep-Alive[\r][\n]"

2015-09-24 08:48:47 DEBUG wire:72 -  >> "User-Agent: JetS3t/0.9.4 (Linux/2.6.32-29-pve; i386; it; JVM 1.7.0_80) [\r][\n]"

2015-09-24 08:48:47 DEBUG wire:72 -  >> "Expect: 100-continue[\r][\n]"

2015-09-24 08:48:47 DEBUG wire:72 -  >> "[\r][\n]"

2015-09-24 08:48:47 DEBUG headers:272 - >> PUT /xxx%2540gmail.com/Clienti%20Proof.numbers HTTP/1.1

2015-09-24 08:48:47 DEBUG headers:275 - >> Date: Thu, 24 Sep 2015 06:48:45 GMT

2015-09-24 08:48:47 DEBUG headers:275 - >> x-amz-meta-userid: 62

2015-09-24 08:48:47 DEBUG headers:275 - >> x-amz-meta-description: jkgb,b.jhyf

2015-09-24 08:48:47 DEBUG headers:275 - >> x-amz-meta-extraInfo: kjgk,jb-.lgykf 

2015-09-24 08:48:47 DEBUG headers:275 - >> Content-MD5: JU8cGTH5JrXwuPz3RLwZQQ==

2015-09-24 08:48:47 DEBUG headers:275 - >> x-amz-content-sha256: 546cab4fedaa46c22400b72dbfd95ecd6899f022684a097767ca518dc3bd7196

2015-09-24 08:48:47 DEBUG headers:275 - >> x-amz-meta-email: x...@gmail.com

2015-09-24 08:48:47 DEBUG headers:275 - >> x-amz-meta-hash: 546cab4fedaa46c22400b72dbfd95ecd6899f022684a097767ca518dc3bd7196

2015-09-24 08:48:47 DEBUG headers:275 - >> Content-Type: application/octet-stream

2015-09-24 08:48:47 DEBUG headers:275 - >> x-amz-meta-md5-hash: 254f1c1931f926b5f0b8fcf744bc1941

2015-09-24 08:48:47 DEBUG headers:275 - >> x-amz-meta-title: kjgbkhbhmb  lhkljb,

2015-09-24 08:48:47 DEBUG headers:275 - >> Authorization: AWS cos0624:SzruRz0y9KNCchC2oROe8vy0vK0=

2015-09-24 08:48:47 DEBUG headers:275 - >> Content-Length: 166256

2015-09-24 08:48:47 DEBUG headers:275 - >> Host: production.seewebstorage.it:443

2015-09-24 08:48:47 DEBUG headers:275 - >> Connection: Keep-Alive

2015-09-24 08:48:47 DEBUG headers:275 - >> User-Agent: JetS3t/0.9.4 (Linux/2.6.32-29-pve; i386; it; JVM 1.7.0_80) 

2015-09-24 08:48:47 DEBUG headers:275 - >> Expect: 100-continue

2015-09-24 08:48:47 DEBUG wire:72 -  << "HTTP/1.1 403 Forbidden[\r][\n]"

2015-09-24 08:48:47 DEBUG wire:72 -  << "Date: Thu, 24 Sep 2015 06:48:47 GMT[\r][\n]"

2015-09-24 08:48:47 DEBUG wire:72 -  << "Server: RestServer/1.0[\r][\n]"

2015-09-24 08:48:47 DEBUG wire:72 -  << "Content-Length: 110[\r][\n]"

2015-09-24 08:48:47 DEBUG wire:72 -  << "Content-Type: application/xml[\r][\n]"

2015-09-24 08:48:47 DEBUG wire:72 -  << "Cache-Control: no-cache[\r][\n]"

2015-09-24 08:48:47 DEBUG wire:72 -  << "Connection: close[\r][\n]"

2015-09-24 08:48:47 DEBUG wire:72 -  << "[\r][\n]"

2015-09-24 08:48:47 DEBUG DefaultClientConnection:253 - Receiving response: HTTP/1.1 403 Forbidden

2015-09-24 08:48:47 DEBUG headers:256 - << HTTP/1.1 403 Forbidden

2015-09-24 08:48:47 DEBUG headers:259 - << Date: Thu, 24 Sep 2015 06:48:47 GMT

2015-09-24 08:48:47 DEBUG headers:259 - << Server: RestServer/1.0

2015-09-24 08:48:47 DEBUG headers:259 - << Content-Length: 110

2015-09-24 08:48:47 DEBUG headers:259 - << Content-Type: application/xml

2015-09-24 08:48:47 DEBUG headers:259 - << Cache-Control: no-cache

2015-09-24 08:48:47 DEBUG headers:259 - << Connection: close

2015-09-24 08:48:47 DEBUG RestStorageService:337 - Response for 'PUT'. Content-Type: application/xml, Headers: [Date: Thu, 24 Sep 2015 06:48:47 GMT, Server: RestServer/1.0, Content-Length: 110, Content-Type: application/xml, Cache-Control: no-cache, Connection: close]

2015-09-24 08:48:47 DEBUG RestStorageService:340 - Response entity: org.apache.http.conn.BasicManagedEntity@97779c

2015-09-24 08:48:47 DEBUG RestStorageService:342 - Entity length: 110

2015-09-24 08:48:47 DEBUG RestStorageService:356 - Received response code 403; matches one of expected set ([200, 204])? false

2015-09-24 08:48:47 DEBUG RestStorageService:372 - Error response xml: true

2015-09-24 08:48:47 DEBUG RestStorageService:373 - Error response entity: org.apache.http.conn.BasicManagedEntity@97779c

2015-09-24 08:48:47 DEBUG RestStorageService:374 - Error response entity length: 110

2015-09-24 08:48:47 DEBUG RestStorageService:389 - Response '/xxx%2540gmail.com/Clienti%20Proofy.numbers' - Received error response with XML message

2015-09-24 08:48:47 DEBUG wire:72 -  << "<?xml version="1.0" encoding="UTF-8"?>[\n]"

2015-09-24 08:48:47 DEBUG wire:72 -  << "<Error><Code>SignatureDoesNotMatch</Code>[\n]"

2015-09-24 08:48:47 DEBUG wire:72 -  << "<Message></Message>[\n]"

2015-09-24 08:48:47 DEBUG wire:72 -  << "</Error>[\n]"

2015-09-24 08:48:47 DEBUG DefaultClientConnection:160 - Connection 0.0.0.0:50487<->95.174.3.231:443 shut down

2015-09-24 08:48:47 DEBUG RestUtils$ThreadSafeConnManager:282 - Released connection is not reusable.

2015-09-24 08:48:47 DEBUG ConnPoolByRoute:429 - Releasing connection [{s}->https://production.seewebstorage.it:443][null]

2015-09-24 08:48:47 DEBUG DefaultClientConnection:176 - Connection 0.0.0.0:50487<->95.174.3.231:443 closed

2015-09-24 08:48:47 DEBUG ConnPoolByRoute:676 - Notifying no-one, there are no waiting threads

2015-09-24 08:48:47 DEBUG HttpMethodReleaseInputStream:152 - Released HttpMethod as its response data stream is fully consumed

2015-09-24 08:48:47 DEBUG RestStorageService:611 - Rethrowing as a ServiceException error in performRequest: org.jets3t.service.ServiceException: Service Error Message. -- ResponseCode: 403, ResponseStatus: null, XML Error Message: <?xml version="1.0" encoding="UTF-8"?><Error><Code>SignatureDoesNotMatch</Code><Message></Message></Error>

2015-09-24 08:48:47 DEBUG RestStorageService:615 - Releasing HttpClient connection after error: Service Error Message.

2015-09-24 08:48:47 DEBUG SeewebUtils:199 - co.proofy.proofycommonlibs.SeewebUtilsorg.jets3t.service.S3ServiceException: Service Error Message. -- ResponseCode: 403, ResponseStatus: Forbidden, XML Error Message: <?xml version="1.0" encoding="UTF-8"?><Error><Code>SignatureDoesNotMatch</Code><Message></Message></Error>

James Murty

unread,
Oct 10, 2015, 8:39:02 AM10/10/15
to jets3t...@googlegroups.com
Hi,

Is it always the same file(s) that fail with the invalid signature? If so, are you able to provide an example file that fails in this way?

Regards,
James

Tiziano Fortin

unread,
Oct 12, 2015, 8:17:58 AM10/12/15
to JetS3t Users
no, not the same every time...

the file sometimes fails and some time works. I don't think that the header of the file is corrupt.

bye
Reply all
Reply to author
Forward
0 new messages