Skip to content

Commit

Permalink
Remove debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
ktbyers committed Oct 6, 2024
1 parent 2110124 commit d981771
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
5 changes: 4 additions & 1 deletion netmiko/cli_tools/encr_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
from cryptography.hazmat.primitives.kdf.pbkdf2 import PBKDF2HMAC
from cryptography.hazmat.primitives.ciphers import Cipher, algorithms, modes

ENCRYPTION_PREFIX = "__encrypt__"


def encrypt_value(value, key, encryption_type):
salt = os.urandom(16)
Expand All @@ -29,7 +31,8 @@ def encrypt_value(value, key, encryption_type):
raise ValueError(f"Unsupported encryption type: {encryption_type}")

# Combine salt and encrypted data
return f"{base64.b64encode(salt).decode()}:{base64.b64encode(encrypted).decode()}"
b64_salt = base64.b64encode(salt).decode()
return f"{ENCRYPTION_PREFIX}{b64_salt}:{base64.b64encode(encrypted).decode()}"


key = input("Enter your encryption key: ").encode()
Expand Down
1 change: 0 additions & 1 deletion netmiko/cli_tools/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ def obtain_devices(device_or_group: str) -> Dict[str, Dict[str, Any]]:
config_params, my_devices = load_netmiko_yml()
use_encryption = config_params.get("encryption", False)
encryption_type = config_params.get("encryption_type", "fernet")
import pdbr; pdbr.set_trace()
if use_encryption:
key = get_encryption_key()
my_devices = decrypt_config(my_devices, key, encryption_type)
Expand Down

0 comments on commit d981771

Please sign in to comment.