Skip to main content
# yaycl Encrypted Yaml Support

A [yaycl](https://github.com/seandst/yaycl) plugin to seamlessly load encypted yamls,
as well as helper methods for encrypting and decrypting yaycl yamls.

# Usage

```python
# Set the crypt key one of these ways:
conf = yaycl.Config('/path/to/yamls', crypt_key='my secret')
conf = yaycl.Config('/path/to/yamls', crypt_key_file='/path/to/a/file/containing/my/secret')

# Or set them after instantiating conf if you like (but it's a little less pretty):
conf._yaycl['crypt_key'] = 'my secret'
conf._yaycl['crypt_key_file'] = '/path/to/a/file/containing/my/secret'

# Or set the correspnding environment vars before loading python:
# - YAYCL_CRYPT_KEY corresponds to 'crypt_key' kwarg
# - YAYCL_CRYPT_KEY_FILE corresponds to 'crypt_key_file' kwarg

# Assuming you've loaded "test.yaml" from your yaml conf dir,
# this will encrypt it and remove the unencrypted version:

yaycl_crypt.encrypt_yaml(conf, 'test')

# Encrypted yamls have the extension '.eyaml', and (assuming the crypt key is set)
# will be loaded just like an unencrypted yaml. If the yaml being loaded has no extension,
# yaycl_crypt will append the extension '.e' to the unencrypted yaml name

# To decrypt:
yaycl_crypt.decrypt_yaml(conf, 'test')

# As before (but going the other way), the .eyaml file will be deleted,
# leaving just the unencrypted yaml file in the conf dir
```

# Notes

- If both an encrypted an unencrypted yaml exist, `yaycl_crypt` will issue a warning
and punt to the next `yaycl` loader, which is most likely the default loader. This
means the unencrypted yaml gets loaded, under the assumption that an unencrypted yaml
next to an encrypted yaml probably means the unencrypted yaml is being actively edited.
- If `yaycl_crypt.decrypt_yaml` is called, and an unencrypted yaml already exists,
`yaycl_crypt` will refuse to overwrite the existing unencrypted conf, again under the
assumption that the unencrypted conf is being actively worked on. If it isn't, the
simplest way to remove it is likely to encrypt it first to delete the unencrypted file,
then decrypt it.
- `yaycl_crypt.encrypt_yaml` has no similar qualms about overwriting encrypted yamls, since
the most likely reason for using this function is to write config changes in a recently
unencrypted config file.
- Both `encrypt_yaml` and `decrypt_yaml` take a `delete` kwarg, which defaults to `True`.
If set to `False`, `encrypt_yaml` will *not* delete the unencrypted config of the same
name, and `decrypt_yaml` will similarly *not* delete its encrypted counterpart.
- `yaml_crypt` isn't guaranteed to be completely "secure"; its main goal is to obfuscate
configuration files with private data in a way that is not trivial to circumvent.
Anyone with access to a python interpreter that can read your eyaml files has access
to your secret key.

[![Coverage Status](https://coveralls.io/repos/seandst/yaycl-crypt/badge.svg?branch=master)](https://coveralls.io/r/seandst/yaycl-crypt?branch=master)
[![Build Status](https://travis-ci.org/seandst/yaycl-crypt.svg?branch=master)](https://travis-ci.org/seandst/yaycl-crypt)



Metadata

Release files for yaycl-crypt 0.4.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for yaycl-crypt 0.4.0
File Size Uploaded Provenance
yaycl-crypt-0.4.0.tar.gz 7.1 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for yaycl-crypt 0.4.0
File Interpreter ABI Platform
yaycl_crypt-0.4.0-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size: 14.8 kB

Release files / yaycl-crypt-0.4.0.tar.gz

Download URL yaycl-crypt-0.4.0.tar.gz
Size 7.1 kB
Tags Source
SHA-256 checksum
How to use checksums
75e2ddb54209836f44980a1e9ead2e3eac358340c31339c6b456fdf312e575b1
BLAKE2b-256 checksum
How to use checksums
2b7684039e80013db0cf59964aa2c001bcb8130b234d65ec361a7bfc6d7ec5db
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / yaycl_crypt-0.4.0-py2.py3-none-any.whl

Download URL yaycl_crypt-0.4.0-py2.py3-none-any.whl
Size 7.6 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
6b775ec40aa0fcfb132987efc409414e17b226ebab2e82767ba92554b84c0e54
BLAKE2b-256 checksum
How to use checksums
36350d8363fb8ce5331f03c18777d17ebc1c365409c22752ebed6c1db7b82a11
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for yaycl-crypt 0.4.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page