Why is the command line built on the command line different from the calculated base64 curl?

Actually confused - Guess that this is due to the placement of one character at the end or a possible addition made using the main digest, which I do not know about ...?

So, if I did this, you can see the base64 encoding product:

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 will notice that base64 strings DO NOT match. The base64 command line alone is actually incorrect - if you replace this in the request, it fails. Does a main digest NOT really use a base64 string? I notice that it always does o = instead of == at the end of the line ...

And ideas?

EDIT: So this was the final newline from the echo: -n do not output the final newline

Thanks!

+4
source share
1 answer
 >>> 'aG9zdEBtYWlsLmNvbTpwYXNzd29yZA=='.decode('base64') ' host@mail.com :password' >>> 'aG9zdEBtYWlsLmNvbTpwYXNzd29yZAo='.decode('base64') ' host@mail.com :password\n' 

Try echo -n .

+7
source

Source: https://habr.com/ru/post/1299183/


All Articles