Browse Source

Add --strip option to encrypt_secret.py

Sometimes you're storing a password in a file by editting it, but you
want it to be raw without newlines/whitespace/etc. This lets you do
that easily.

Change-Id: Idc961b89a5ec3fb639e70a321b4ea587cf743b9d
changes/47/530547/1
Clint Byrum 4 years ago
parent
commit
04bcbe18dc
1 changed files with 4 additions and 0 deletions
  1. +4
    -0
      tools/encrypt_secret.py

+ 4
- 0
tools/encrypt_secret.py View File

@ -46,6 +46,8 @@ def main():
# TODO(jeblair): Throw a fit if SSL is not used.
parser.add_argument('project',
help="The name of the project.")
parser.add_argument('--strip', action='store_true', default=False,
help="Strip whitespace from beginning/end of input.")
parser.add_argument('--infile',
default=None,
help="A filename whose contents will be encrypted. "
@ -68,6 +70,8 @@ def main():
plaintext = sys.stdin.read()
plaintext = plaintext.encode("utf-8")
if args.strip:
plaintext = plaintext.strip()
pubkey_file = tempfile.NamedTemporaryFile(delete=False)
try:


Loading…
Cancel
Save