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-' Commented Feb 7, 2020 at 17:55
  • I did, same thing! Commented 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? Commented Feb 10, 2020 at 10:22
  • Linux (Ubuntu). Commented Feb 10, 2020 at 12:18

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.