Questions tagged [base64]
Questions about encoding/decoding file or stdin by using base64
54
questions
0
votes
1
answer
25
views
How to make base64 print the encoded output after a newline without newline being encoded?
I like to encode with base64 from stdin by invoking the command pasting the input and pressing Ctrl + D twice in order to avoid a trailing newline if I don't want one to be part of the input. It ...
1
vote
1
answer
71
views
How to decode base64-encoded inline attachments in email files saved from Thunderbird or Gmail?
Although base64 [--decode] works well when encoding and decoding files locally, I can't decode a base64-encoded inline attachment in an eml file saved from Thunderbird or Gmail.
I observed that base64-...
8
votes
1
answer
873
views
Why is 0x00 being deleted when assigning a base64 decoded string to a variable
I'm using a Mac. In Bash, I'm trying to decode a base64 string and then try to print the Hex value. I'm using base64 -d command and then assigning it to a variable.
myText='YYN29+...
0
votes
0
answers
40
views
Google Cloud does not like my Customer-supplied encryption key (CSEK)
I'm trying to encrypt a VM image with my own provided key.
So I go to my Terminal emulator and do:
$ openssl enc -aes256 -A -P
enter aes-256-cbc encryption password:
Verifying - ...
0
votes
2
answers
211
views
Replace a base64 value from file
I have one file which is gets details from ldapsearch command and create file as below
# lschuler, people, pl.s2-eu.XXXXXXXXX.local
dn: uid=lschuler,ou=people,dc=pl,dc=s2-eu,dc=XXXXXXXXX,dc=local
...
0
votes
1
answer
1k
views
Trying to decode base64 from curl, but I get "base64: invalid input"
Trying to decode base64 from curl, but I get "base64: invalid input".
➜ curl -s 'preprod-payroll.trick.htb/index.php?page=php://filter/convert.base64-encode/resource=home' | grep -A 1 '<...
2
votes
1
answer
2k
views
How to decode base64 for both Linux and macOS?
On Linux I can do:
echo ${ANDROID_KEYSTORE} | base64 -di > android/keystores/staging.keystore
But on macOS, the same commands give:
base64: option requires an argument -- i
Usage: base64 [-hvDd] [...
0
votes
1
answer
211
views
How to force base64 encoding for s-nail attachments?
I have a job that picks up CSV files and sends them through an external mail service. Everything seems to be great, with one exception: I found that the windows style CRLF CSV files get mangled by ...
0
votes
0
answers
471
views
base64 decode as save as multiple files
I have a file(har file saved from web developer" that contains the base64 encoded value of multiple video*.ts files. I am interested to decode the base64 part and save as multiple ts files if the ...
0
votes
3
answers
267
views
Replace a timestamp Base64 value in a file
I have a problem, I have a file test.txt that has a content like this:
dn: serv=CSPS,mscId=167e48dc2b7a42d4acce611c8b477262,ou=multiSCs,dc=three
structuralObjectClass: CP1
objectClass: CP1
objectClass:...
-1
votes
1
answer
10k
views
base64: invalid input error when trying to decode contents of yaml file
What specific syntax must be changed in the bash below to successfully decode the base64 encoded value which is throwing the error below?
THE ERROR:
The following 3 simple commands are typed into the ...
3
votes
4
answers
1k
views
Replace a base64 value in a file in unix
I have a problem, I have a file test.txt that has a content like this:
objectClass: CPM1
objectClass: CPM2
objectClass: CPM3
objectClass: CPM4
objectClass: CPZ
objectClass: CP04s
objectClass: CP0A
...
3
votes
1
answer
1k
views
running base64 encoded bash script gives me error
I have a bash script; the script is to generate a random number and have the user guess it.
printf 'Guess the number (1-10) : '
read -r n
randint=$(( ( RANDOM % 10 ) + 1 ))
if [ $n = $randint ];
then
...
0
votes
0
answers
462
views
mutt & attachment encoding
So, I have a simple bash script that is intended to send a note to a user (say, the fictitious [email protected]), where said note contains a short snippet of text (contained in the file message....
-1
votes
1
answer
900
views
Can't encode this string [duplicate]
I'm doing a simple exercise where copy a base64 encoded cookie value, and then make a few changes and then re-encode, and then use the result to log into a site as admin.
I have the following encoded ...
4
votes
2
answers
1k
views
Difference between wc -c and ${#}?
I've created script, where I encoded string 28 times with base64. Then I wanted to echo count of chars in outputted string.
First I used ${#var} which gave me 34070.
Then I tried on the same string
...
16
votes
3
answers
40k
views
base64 -d decodes, but says invalid input
Does anybody know why this is happening and how to fix it?
me@box:~$ echo "eyJmb28iOiJiYXIiLCJiYXoiOiJiYXQifQ" | base64 -di
{"foo":"bar","baz":"bat"}...
1
vote
1
answer
989
views
Base64 Encoding Not Producing The Required Encoded Value
I am trying to base 64 encode the following information:
{ "expiration": "2015-12-30T12:00:00.000Z",
"conditions": [
{"bucket": "sigv4examplebucket&...
-2
votes
1
answer
934
views
Sending email attachments in plain text format instead of base64
I need to send an email. The requirements are as follows:
Plain text and not HTML (Message type)
Plain text and not base64 (Attachments, given that my attachments are all ASCII text files.)
How do I ...
1
vote
2
answers
9k
views
How to properly encode string based on json file?
I have the following basic.json file:
{
"user": "user",
"pass": "password"
}
I'm trying to encode it in base64 like this:
"Basic dXNlcjpwYXNzd29yZA=="
I think I'm close:
echo Basic $(echo ...
1
vote
0
answers
2k
views
Remove newline character after pipe
I want to do Base64 encode with a command
echo -en "my_message" | openssl sha1 -hmac "secret_key" | base64
The output string of openssl is as expected, but the output of base64 is not as the output ...
1
vote
1
answer
3k
views
Read from stdin and pipe to next command
I would like to read a password from stdin, suppress its output and encode it with base64, like so:
read -s|openssl base64 -e
What is the right command for that?
0
votes
1
answer
15k
views
Can you search for base64 with grep?
Is it possible to search for Base64 strings with grep? Say I have a list of text files and I want to find all the Base64 strings contained in them; is there any way to search for them? I mean I know ...
0
votes
3
answers
5k
views
Why does converting from base64 and back garble the end of this string?
Command:
echo "HelloWorld==" | base64 -d | base64
Output:
HelloWorlQ==
Why is my d now a Q?
Edit:
I am not trying to start with arbitrary data and base64 encode it. My intention is to start ...
-6
votes
2
answers
7k
views
The following text is encoded in base 64. How do I decode it and get the answer?
Ik5ldmVyIHRydXN0IGEgY29tcHV0ZXIgeW91IGNhbid0IHRocm93IG91dCBhIHdpbmRvdyIgLSBTdGV2ZSBXb3puaWFr
How do I decode this and get the answer?
1
vote
2
answers
255
views
Unexpected grep behaviour when using command substituiton
I'm trying to find and print out all the files that contain a base64 encoded string, using grep and command substitution.
If I first encode the base64 string, and then grep, I'm able to find the file:...
1
vote
1
answer
544
views
How can I source a base 64 encoded file in bash?
Is there a way to source a base64 encoded file in bash instead of doing this?
cat $DIR/data/saves/$savegame | base64 --decode > $DIR/data/saves/$savegame.decoded
. $DIR/data/saves/$savegame....
-4
votes
1
answer
739
views
For base64 encoding/decoding, can base64 and uuencode/uudecode be used exchangeably?
Do both base64 (from coreutils) and uuencode -m and uudecode (from sharutils) implement base64 encoding and decoding? Can they be used exchangeably?
-1
votes
1
answer
365
views
Bash: Is it better to echo or <<<? [closed]
When passing input, which method is better?
> echo 'test' | base64
dGVzdAo=
> base64 <<< 'test'
dGVzdAo=
With variables as well, which method should be use?
> t='test'
> ...
0
votes
2
answers
3k
views
How to decode base64 text in ldif file in Linux?
I need to decode base64 embedded in ldif (openldap) backups.
I found here a way to join lines starting with a blank.
Then, based on this question about "How to decode base64 text in xml file in ...
8
votes
1
answer
30k
views
How do you convert a base64 utf-8 encoded string to a binary file from bash?
Is there a tool that will do this in bash?
8
votes
3
answers
36k
views
What's the right way to base64 encode a binary file on CentOS 7?
I'm using CentOS 7 with bash shell. I thought base64-encoding a binary file would be as simple as
[rails@server lib]$ cat mybinary.file | base64 > /tmp/output.base64
However, I notice when I ...
0
votes
2
answers
2k
views
How can the, encrypted with AES, and BASE64 encoded, SSH private key, have size smaller than specified?
This might be obvious to some, but I wonder, if I generated 8192 key in size with:
ssh-keygen -t rsa -b 8192
How can the, encrypted with AES, and BASE64 encoded, SSH private key, have size smaller ...
-1
votes
1
answer
78
views
is there a Base64-based dist?
Is there a Linux distribution or Unix version where everything is Base64 encoded in memory? I'm interested in the concept of being able to dump the entire system state and print it as a book.
4
votes
1
answer
3k
views
Javascript BTOA vs base64 in bash?
I need to convert a username and password combination into base64 before sending to an API.
The javascript BTOA function is working for me, but when I try to use base64 command in bash I get slightly ...
1
vote
2
answers
981
views
Using Linux, how would I find an image stored in base64 locally? [closed]
I've been given a project handled by a former coder in our organization. It's a php based application and it is Massive (as in tons of files everywhere). I'm trying to find a logo that's stored......
0
votes
1
answer
1k
views
openssl decoding does not work with echo
I encrypted some data:
echo -n aaaa | openssl enc -aes-128-ecb -K E5E9FA1BA31ECD1AE84F75CAAA474F3A -nosalt -out o
This decodes it correctly:
base64 o | openssl enc -d -aes-128-ecb -K ...
0
votes
2
answers
7k
views
Concatenate 2 binary strings in base64 form
I have two BASE64 encoded strings and I would like to get the BASE64 encoding of the binary concatenation of the two string using just the command line.
Example:
> $ echo -n "\x01\x02" |base64 ...
0
votes
1
answer
1k
views
Base64 decode and overwrite file
I have a file which contains base64 encoded image data: ~/dog/1.jpg
I put it there via SSH, and base 64 encoded the data so it would be safe to transfer in the terminal. Assume the base64 image data ...
2
votes
1
answer
108
views
What is the point of hashing?
I was looking at my companies hashing implementation and I saw that the passwords for the root user are stored in base64 encoding. What is to stop anyone from simply copying the password and doing a ...
3
votes
1
answer
3k
views
bash: how do I write base64-encoded content into a file to specified line
I'm working on an "edgemax feature-wizard" which is kind of a plugin system.
There are only three files allowed in a plugin tarball: a bash script as backend, a HTML file as frontend and a validation....
1
vote
1
answer
542
views
How can I decrypt back a base64 encoded shaX binary string?
For the encrypted base64 encoded SHAX strings, what command can decrypt it back to original string, thanks
14
votes
1
answer
20k
views
Can OpenSSL decode base64 data that does not contain line breaks?
I have two chunks of base64 data in a bash variable. The usual line breaks within the base64 data have been replaced by spaces and the variable is basically one very long one-line string.
I can ...
5
votes
3
answers
3k
views
Is it possible to convert linux salted sha512 password hash to LDAP format?
We have an LDAP server which stores passwords and other user data.
The server is not used for authentication of client machines though but only for authentication of client apps.
So users change their ...
5
votes
3
answers
8k
views
How do I decode a list of base64-encoded file names?
I have a list of base64-encoded file names in the pattern of {base64-encoded part here}_2015-11-12.pdf. I'm trying to decode that list of files and return it on the command line as another list, ...
6
votes
1
answer
5k
views
How to extract first base64 code out of file?
On Linux I'm having text files and each contains 1 or 2 base64 blocks of code. Following is part of the file and 1 base64 block.
Content-Transfer-Encoding: base64
...
1
vote
0
answers
3k
views
curl --data-urlencode and underscores
I've been using curl -XPOST to post some links to a Telegram channel via a bot api/key, the urls are in form of https://site/x/pre_encoded_string, where pre_encoded_string is in form (real samples) ...
2
votes
1
answer
10k
views
Apply SHA256 and Base64 to string in script
I'm trying to apply SHA256 and then Base64 encode a string inside a shell script. Got it working with PHP:
php -r 'echo base64_encode(hash("sha256", "asdasd", false));'. But I'm trying to get rid of ...
1
vote
4
answers
7k
views
How to decode base64 text in xml file in Linux?
I'm new in linux (shell).
I need to decode base64 text in xml file using linux shell script.
Could you please help me to write linux shell script for decoding the values of those tags where attribute ...
5
votes
1
answer
1k
views
What is this seemingly base64 data set by setfattr?
I have written a short shell script that simply wraps setfattr in a slightly more convenient form for setting the extended attribute that corresponds to a free-text comment:
#!/bin/sh
test "$2" &&...