1

I want to encrypt a client secret that starts with a dash, but if I do something like:

aws kms encrypt --region us-east-1 --key-id xxxyyzz --output text --query CiphertextBlob --plaintext -blahblah-

The result is:

usage: aws [options] <command> <subcommand> [<subcommand> ...] [parameters]
To see help text, you can run:

  aws help
  aws <command> help
  aws <command> <subcommand> help
aws: error: argument --plaintext: expected one argument

Tried escaping like:

aws kms encrypt --region us-east-1 --key-id xxxyyzz --output text --query CiphertextBlob --plaintext \-blahblah-

But got the same error. My searches so far only gave application specific answers (e.g. sed). What's the elusive trick I'm missing?

2
  • did you try with single quotes? '-blahblah-' Feb 7, 2020 at 17:55
  • I did, same thing!
    – Nagev
    Feb 7, 2020 at 17:56

1 Answer 1

1

Well, doing aws kms encrypt help gave me the solution:

$ aws kms encrypt --region us-east-1 --key-id vvvvvvvv --output text --query CiphertextBlob --plaintext fileb://clientsecret.txt

Where clientsecret.txt holds the string that contains dashes, without a new line character.

2
  • Your OS is Windows or Linux? Feb 10, 2020 at 10:22
  • Linux (Ubuntu).
    – Nagev
    Feb 10, 2020 at 12:18

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .