Marco Ricci
Add support for Python 3.9
Marco Ricci commited eea542a at 2024-10-01 11:51:05
vault_native.py
# SPDX-FileCopyrightText: 2024 Marco Ricci <software@the13thletter.info>
#
# SPDX-License-Identifier: MIT
"""Exporter for the vault native configuration format (v0.2 or v0.3).
The vault native formats are the configuration formats used by vault
v0.2 and v0.3. The configuration is stored as a single encrypted file,
which is encrypted and authenticated. v0.2 and v0.3 differ in some
details concerning key derivation and expected format of internal
structures, so they are *not* compatible. v0.2 additionally contains
cryptographic weaknesses (API misuse of a key derivation function, and
a low-entropy method of generating initialization vectors for CBC block
encryption mode) and should thus be avoided if possible.
The public interface is the [`export_vault_native_data`][] function.
Multiple *non-public* classes are additionally documented here for
didactical and educational reasons, but they are not part of the module
API, are subject to change without notice (including removal), and
should *not* be used or relied on.
"""
from __future__ import annotations
import abc
import base64
import json
import logging
import warnings
from typing import TYPE_CHECKING
from derivepassphrase import exporter, vault
if TYPE_CHECKING:
from collections.abc import Sequence
from typing import Any
from typing_extensions import Buffer
if TYPE_CHECKING:
from cryptography import exceptions as crypt_exceptions
from cryptography import utils as crypt_utils
from cryptography.hazmat.primitives import ciphers, hashes, hmac, padding
from cryptography.hazmat.primitives.ciphers import algorithms, modes
from cryptography.hazmat.primitives.kdf import pbkdf2
else:
try:
from cryptography import exceptions as crypt_exceptions
from cryptography import utils as crypt_utils
from cryptography.hazmat.primitives import (
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX