Skip to content

Commit

Permalink
Fix/replace stray escaped chars (#89)
Browse files Browse the repository at this point in the history
* Remove stray \\n chars from keys

* bump version v24.23.0 -> v24.25.0
  • Loading branch information
adammcdonagh committed Jun 20, 2024
1 parent c1fde87 commit 33cd072
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

# v24.25.0

- Remove stray `\\n` characters from private and public keys when doing encryption/decryption, and replace with proper newlines

# v24.23.0

- Added new `cacheableVariables` option for transfers. This allows you to specify a list of variables that should be cached and written back to somewhere (depending on the `cachingPlugin` referenced). This is useful for dynamically updated variables that need to be stored centrally. For more detail see the `README.md`ß
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "opentaskpy"
version = "v24.23.0"
version = "v24.25.0"
authors = [{ name = "Adam McDonagh", email = "adam@elitemonkey.net" }]
license = { text = "GPLv3" }
classifiers = [
Expand Down Expand Up @@ -71,7 +71,7 @@ otf-batch-validator = "opentaskpy.cli.batch_validator:main"
profile = 'black'

[tool.bumpver]
current_version = "v24.23.0"
current_version = "v24.25.0"
version_pattern = "vYY.WW.PATCH[-TAG]"
commit_message = "bump version {old_version} -> {new_version}"
commit = true
Expand Down
5 changes: 5 additions & 0 deletions src/opentaskpy/taskhandlers/transfer.py
Original file line number Diff line number Diff line change
Expand Up @@ -770,6 +770,9 @@ def encrypt_files(
# Set up gnupg
gpg = gnupg.GPG(gnupghome=f"{tmpdir}/.gnupg")

# Remove any escaped newline characters from the key
public_key = public_key.replace("\\n", "\n")

# Load the public key
import_result = gpg.import_keys(public_key)

Expand Down Expand Up @@ -847,6 +850,8 @@ def decrypt_files(self, files: dict, private_key: str) -> dict:
# Set up gnupg
gpg = gnupg.GPG(gnupghome=f"{tmpdir}/.gnupg")

private_key = private_key.replace("\\n", "\n")

# Load the private key
import_result = gpg.import_keys(private_key)
# Check the key imported OK
Expand Down

0 comments on commit 33cd072

Please sign in to comment.