Really confused - Guess it has to do with a single character placement at the end, or possible padding done with basic digest that I'm not aware of..?
So, if I execute this, you can see the product of the base64 encode:
echo 'host@mail.com:password' | openssl enc -base64
aG9zdEBtYWlsLmNvbTpwYXNzd29yZAo=
Now, if I make a curl request:
curl -v -u host@mail.com:password https://
aG9zdEBtYWlsLmNvbTpwYXNzd29yZA==
You'll notice that the base64 strings are NOT the same..haha what? The base64 command line one is actually incorrect - if you substitute that in the request, it fails. SO - does basic digest NOT truly use a base64 string? I'm noticing that is always doing a o= instead of 开发者_如何学C== at the end of the string ...
And ideas?
EDIT: So, it was the trailing newline from echo: -n do not output the trailing newline
Thanks!
>>> 'aG9zdEBtYWlsLmNvbTpwYXNzd29yZA=='.decode('base64')
'host@mail.com:password'
>>> 'aG9zdEBtYWlsLmNvbTpwYXNzd29yZAo='.decode('base64')
'host@mail.com:password\n'
Try echo -n
instead.
精彩评论