url-signature | Build urls with a hash signature | Hashing library
kandi X-RAY | url-signature Summary
kandi X-RAY | url-signature Summary
Build urls with a hash signature to prevent the modification of URL parts.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Verify the given URL .
- Sign an url
- Get hash data from url parts .
- Get key - value pairs .
- Sets the hash algorithm .
- Creates an invalid hash algorithm exception .
- Creates an exception for the given signature string .
- Creates a timeout exception .
- Creates a new timeout violation .
- Creates a new SignatureException for the given Signature .
url-signature Key Features
url-signature Examples and Code Snippets
Community Discussions
Trending Discussions on url-signature
QUESTION
I'm converting code from Go to Java. The source to convert is at https://github.com/h2non/imaginary#url-signature and this is my current code converted to Java.
The problem is that I'm missing something, since the signature generated in Java is different than the one in Go.
Expected result (as in source in Go):
ruEWRoFO-ic-L38vTsjqIYE6DLZ532CTaZXOh1gwuVo
Actual result in Java:
x2clz4ynSxcFPNc6h3W832vyrIQ=
My code in Java:
...ANSWER
Answered 2018-Jul-10 at 10:35I don't know what Hashing
class you are using in Java, because it isn't standard, but if I use the standard class javax.crypto.Mac
to do HmacSHA256 (NOT HmacSHA1) with that key and data -- and encode with the 'unpadded URLsafe' variant of Base64 promoted by JSON, not the traditional one Java defaults to -- I do get ruEWRoFO-ic-L38vTsjqIYE6DLZ532CTaZXOh1gwuVo
.
However, it is very poor practice to sign the path and query without some delimiting -- this may allow a signature to be 'moved' to different data. It is also weird, though not directly dangerous, to use a key that is characters but only hex digit characters. I wouldn't use a scheme designed like this for anything important without extensive investigation.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install url-signature
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page