Code Monkey home page Code Monkey logo

Comments (10)

bduggan avatar bduggan commented on August 24, 2024 6

On second thought, maybe we can just skip base64 encoding entirely.

from aws-secrets.

bduggan avatar bduggan commented on August 24, 2024 2

Since awscli is already a prerequisite, I suppose we can assume python is installed, so perhaps this could be replaced with python -m base64 -d

from aws-secrets.

fabriziofortino avatar fabriziofortino commented on August 24, 2024 1

Newer versions of base64 on OS/X supports both -D and -d for decoding:

Usage:	base64 [-hvDd] [-b num] [-i in_file] [-o out_file]
  -h, --help     display this message
  -Dd, --decode   decodes input
  -b, --break    break encoded string into num character lines
  -i, --input    input file (default: "-" for stdin)
  -o, --output   output file (default: "-" for stdout)

from aws-secrets.

nicholaides avatar nicholaides commented on August 24, 2024

Also, can we be certain that every OS will have base64?

from aws-secrets.

di avatar di commented on August 24, 2024

@nicholaides It's a builtin: https://docs.python.org/3/library/base64.html

from aws-secrets.

nicholaides avatar nicholaides commented on August 24, 2024

Sorry-- I meant, the shell command/executable base64. I was wondering how certain we can be that it's available on every OS. Brian's point that we can rely on Python being installed makes Python seem like a good solution.

from aws-secrets.

bduggan avatar bduggan commented on August 24, 2024

It's part of gnu coreutils, so it's on any GNU/linux based distro (just as cat is). Another option would be to require coreutils on OS/X to get the gnu version (brew install coreutils)
e.g. on an ubuntu box:

$ dpkg -S /bin/cat
coreutils: /bin/cat
$ dpkg -S /usr/bin/base64
coreutils: /usr/bin/base64

I wouldn't recommend python for this if we didn't already have awscli as a requirement.

from aws-secrets.

bduggan avatar bduggan commented on August 24, 2024

What's also interesting is that OS/X (the only outlier) lists lowercase d in the first line of the help message, so this could be called a bug in the OS/X base64

$ /usr/bin/base64 --help
Usage:  /usr/bin/base64 [-dhvD] [-b num] [-i in_file] [-o out_file]
  -h, --help     display this message
  -D, --decode   decodes input
  -b, --break    break encoded string into num character lines
  -i, --input    input file (default: "-" for stdin)
  -o, --output   output file (default: "-" for stdout)

from aws-secrets.

om-ha avatar om-ha commented on August 24, 2024

I can attest @fabriziofortino

Even on Big Sur man base64

     -d
     -D
     --decode             Decode incoming Base64 stream into binary data.

from aws-secrets.

coding-bunny avatar coding-bunny commented on August 24, 2024

This issue just bit me today on Ubuntu 22.04: base64: invalid option -- 'D'

The only supported options are:

base64 --help
Usage: base64 [OPTION]... [FILE]
Base64 encode or decode FILE, or standard input, to standard output.

With no FILE, or when FILE is -, read standard input.

Mandatory arguments to long options are mandatory for short options too.
  -d, --decode          decode data
  -i, --ignore-garbage  when decoding, ignore non-alphabet characters
  -w, --wrap=COLS       wrap encoded lines after COLS character (default 76).
                          Use 0 to disable line wrapping

      --help     display this help and exit
      --version  output version information and exit

The data are encoded as described for the base64 alphabet in RFC 4648.
When decoding, the input may contain newlines in addition to the bytes of
the formal base64 alphabet.  Use --ignore-garbage to attempt to recover
from any other non-alphabet bytes in the encoded stream.

GNU coreutils online help: <https://www.gnu.org/software/coreutils/>
Full documentation <https://www.gnu.org/software/coreutils/base64>
or available locally via: info '(coreutils) base64 invocation'

from aws-secrets.

Related Issues (10)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.