Refer to the signature implementation logic in the demo code:demo
params | notes | sample |
X-Up-Key | publisher_key | X-Up-Key: i8XNjC4b8KVok4uw5RftR38Wgp2BFwql |
X-Up-Timestamp | Unix timestamp(ms), the millisecond from 1970/1/1. Valid duration is 15 minutes. | 1562813567000 |
X-Up-Signature | signature string |
params | notes | sample |
Content-MD5 | MD5 from HTTP Body string(upper letters) | 875264590688CA6171F6228AF5BBB3D2 |
Content-Type | type of HTTP Body | application/json |
Headers | Headers except X-Up-Signature | X-Up-Timestamp:1562813567000 X-Up-Key:aac6880633f102bce2174ec9d99322f55e69a8a2 |
HTTPMethod | HTTP method(upper letters) | PUT、GET、POST |
Resource Path | strings from HTTP path | /v1/fullreport |
Create signature string:
SignString = HTTPMethod + "\n"
\+ Content-MD5 + "\n"
\+ Content-Type + "\n"
\+ Headers + "\n"
\+ Resource
MD5Result = MD5(SignString)
X-Up-Signature = ToUpper(MD5Result)
Resource:
URL Path and query params
Headers:
// X-Up-Key + X-Up-Timestamp (sort by first letter)
// except X-Up-Signature
Headers = Key1 + ":" + Value1 + '\n' + Key2 + ":" + Value2
Server will create sign and campare the sign with X-Up-Signature