Skip to content

Commit 9b3f2b1

Browse files
authored
Remove AES cipher from backup (#5954)
AES cipher is no longer needed since Docker repository authentication has been removed from backups in #5605.
1 parent 3d026b9 commit 9b3f2b1

File tree

1 file changed

+2
-11
lines changed

1 file changed

+2
-11
lines changed

supervisor/backups/backup.py

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@
1818
from typing import Any, Self, cast
1919

2020
from awesomeversion import AwesomeVersion, AwesomeVersionCompareException
21-
from cryptography.hazmat.backends import default_backend
22-
from cryptography.hazmat.primitives.ciphers import Cipher, algorithms, modes
2321
from securetar import AddFileError, SecureTarFile, atomic_contents_add, secure_path
2422
import voluptuous as vol
2523
from voluptuous.humanize import humanize_error
@@ -62,7 +60,7 @@
6260
from ..utils.json import json_bytes
6361
from ..utils.sentinel import DEFAULT
6462
from .const import BUF_SIZE, LOCATION_CLOUD_BACKUP, BackupType
65-
from .utils import key_to_iv, password_to_key
63+
from .utils import password_to_key
6664
from .validate import SCHEMA_BACKUP
6765

6866
_LOGGER: logging.Logger = logging.getLogger(__name__)
@@ -102,7 +100,6 @@ def __init__(
102100
self._tmp: TemporaryDirectory | None = None
103101
self._outer_secure_tarfile: SecureTarFile | None = None
104102
self._key: bytes | None = None
105-
self._aes: Cipher | None = None
106103
self._locations: dict[str | None, BackupLocation] = {
107104
location: BackupLocation(
108105
path=tar_file,
@@ -348,16 +345,10 @@ def set_password(self, password: str | None) -> None:
348345
self._init_password(password)
349346
else:
350347
self._key = None
351-
self._aes = None
352348

353349
def _init_password(self, password: str) -> None:
354-
"""Set password + init aes cipher."""
350+
"""Create key from password."""
355351
self._key = password_to_key(password)
356-
self._aes = Cipher(
357-
algorithms.AES(self._key),
358-
modes.CBC(key_to_iv(self._key)),
359-
backend=default_backend(),
360-
)
361352

362353
async def validate_backup(self, location: str | None) -> None:
363354
"""Validate backup.

0 commit comments

Comments
 (0)