sops: Decryption fails for some data

I have encrypted a json file but cannot decrypt it again and get the error Could not marshal tree: No binary data found in tree

Unfortunately I cannot share the json contents. Its a Google Service Account private key. However its likely it will also fail for other json files of this type as they have the same format and similar data.

sops 3.0.5 (latest)

About this issue

  • Original URL
  • State: open
  • Created 6 years ago
  • Reactions: 1
  • Comments: 19 (10 by maintainers)

Most upvoted comments

In case of YAML files like this:

:base_path: /var/gemstash
:cache_type: memory
:db_adapter: postgres
:db_url: postgres://gemstash:password@10.1.0.3/gemstash
:log_file: :stdout

I had to specify both --input-type and --output-type:

sops -d --input-type yaml --output-type yaml --verbose gemstash.yaml.enc

I was able to fix this error by adding explicitly the output format:

$> sops -d file.json.enc
Error dumping file: No binary data found in tree
$> sops --output-type json -d file.json.enc
{
...
}

@autrilla it makes sense but if you think about it people expects the same to be happening in the process of encrypting and decrypting without specifying any kind of format.

I mean, i would expect this to be working with no issues at all:

$> sops --encrypt a.json > a.json.enc
$> sops --decrypt a.json.enc

Maybe include the input format inside the spec?