Skip to content

6214 Колганова Е.А. Лаб.3 Вар.8#213

Open
lizka19 wants to merge 9 commits intoitsecd:mainfrom
lizka19:lab3-var8
Open

6214 Колганова Е.А. Лаб.3 Вар.8#213
lizka19 wants to merge 9 commits intoitsecd:mainfrom
lizka19:lab3-var8

Conversation

@lizka19
Copy link

@lizka19 lizka19 commented May 25, 2025

В работе была создана Гибридная криптосистема, совмещающая в себе два протокола RSA и Blowfish. Ассиметричным алгоритмом (RSA) был получен ключ для симметричного шифрования (Blowfish).
Папка keys - для хранения созданных в процессе шифрования ключей. Папка texts - для хранения изначального, зашифрованного и расшифрованного текстов

@github-actions github-actions bot added In progress Код в процессе проверки Lab 3 Лабораторная 3 "Построение гибридной криптосистемы" labels May 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

почистить файлы


key_length = int(input("Введите длину симметричного ключа: "))

if key_length < 32 or key_length > 448 or key_length % 8 != 0:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

не совсем верное условие ,ключ длиной 512 пройдет
корректнее if 32 <= key_length <= 448 and key_length % 8 == 0:

Comment on lines 109 to 129
@staticmethod
def load_private_key(path: str) -> RSAPrivateKey:
"""
Загружает приватный RSA ключ из файла.

:param path: Путь к файлу с приватным ключом.
:return: Загруженный приватный ключ.
"""

with open(path, "rb") as f:
private_key = serialization.load_pem_private_key(
f.read(),
password=None
)
return private_key


@staticmethod
def load_encrypted_symmetric_key(path: str) -> bytes:
"""
Загружает зашифрованный симметричный ключ из файла.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

эти функции уже реализованы в lab_3/file_work.py

lab_3/main.py Outdated
Comment on lines 100 to 95
if args.generation:
genereate_keys(settings)

elif args.encryption:
encrypt_mode(settings)

elif args.decryption:
decrypt_mode(settings)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

для выбора режима шифрования используйте match/case и Enum

@lizka19 lizka19 requested a review from Daria-creator-lab May 26, 2025 14:03

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

этого тут быть не должно
сделайте clean up кода

@Daria-creator-lab Daria-creator-lab added Approved Код зачтен. Можно сдавать теорию. and removed In progress Код в процессе проверки labels Jun 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Approved Код зачтен. Можно сдавать теорию. Lab 3 Лабораторная 3 "Построение гибридной криптосистемы"

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments