Discussion:
Base64 decoding on the command line - how?
(too old to reply)
Steve
2005-09-03 08:03:07 UTC
Permalink
Is there a simple command line tool that will encode/decode a file to
base64?

There is uuencode which, on its man page allegedly has the -m option to use
base64, but when I try it, it says its an illegal option.

Any ideas?
--
Regards,
Steve

"...which means he created the heaven and the earth... in the DARK! How good
is that?"
Gary
2005-09-03 08:06:24 UTC
Permalink
Post by Steve
Is there a simple command line tool that will encode/decode a file to
base64?
There is uuencode which, on its man page allegedly has the -m option to use
base64, but when I try it, it says its an illegal option.
Any ideas?
$ uuencode -m foo foo
begin-base64 644 foo
...
...
====

Works here, on 10.4.2
--
remove stars for email
g*a*r*y*c*o*w*e*l*l*a*t*m*a*c*d*o*t*c*o*m
Steve
2005-09-03 08:19:32 UTC
Permalink
On 3/9/05 09:06, in article
Post by Gary
Post by Steve
Is there a simple command line tool that will encode/decode a file to
base64?
There is uuencode which, on its man page allegedly has the -m option to use
base64, but when I try it, it says its an illegal option.
Any ideas?
$ uuencode -m foo foo
Yes.

However, what you failed to pick up on was that it is was far too early in
the morning for me to post anything comprehensible, and having re-read my
post it doesn't describe what I want to do at all!!! ;-)

Let me start again....

I already have some base64 encoded data (without headers'n'stuff like
'begin-base64'. I'm looking for a command line tool to decode it for me.

What I meant to say originally is that *uudecode* doesn't have a -m option!
--
Regards,
Steve

"...which means he created the heaven and the earth... in the DARK! How good
is that?"
Gary
2005-09-03 16:44:01 UTC
Permalink
Post by Steve
Yes.
However, what you failed to pick up on was that it is was far too early in
the morning for me to post anything comprehensible, and having re-read my
post it doesn't describe what I want to do at all!!! ;-)
Let me start again....
I already have some base64 encoded data (without headers'n'stuff like
'begin-base64'. I'm looking for a command line tool to decode it for me.
What I meant to say originally is that *uudecode* doesn't have a -m option!
uudecode will detect the data format and decode your base64 file without any
switches. At least, it does this for base64 files encoded by uuencode -m.
--
remove stars for email
g*a*r*y*c*o*w*e*l*l*a*t*m*a*c*d*o*t*c*o*m
Chris Ridd
2005-09-03 08:15:53 UTC
Permalink
Post by Steve
Is there a simple command line tool that will encode/decode a file to
base64?
There is uuencode which, on its man page allegedly has the -m option to use
base64, but when I try it, it says its an illegal option.
From a quick look at the source, only uuencode takes the -m flag, and
produces a file that starts 'begin-base64' instead of just 'begin'. Uudecode
automatically handles both styles, and therefore doesn't need the -m flag.
Have you filed a bug against the man page?

Unless you've got a file in that format already, you probably don't want to
bother with uudecode.

OpenSSL has a plain base64 encoder/decoder. To encode to base64:

openssl enc -a -e -in infile -out base64file

To decode from base64:

openssl enc -a -d -in base64file -out outfile

Cheers,

Chris
Steve
2005-09-03 11:04:04 UTC
Permalink
Post by Chris Ridd
openssl enc -a -e -in infile -out base64file
openssl enc -a -d -in base64file -out outfile
That¹s the one! Cheers Chris.
--
Regards,
Steve

"...which means he created the heaven and the earth... in the DARK! How good
is that?"
Continue reading on narkive:
Loading...