-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
31 lines (26 loc) · 1 KB
/
main.py
File metadata and controls
31 lines (26 loc) · 1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import camellia
import generate_key
import chacha
import rsa
# CAMELLIA
key_size = 128
generate_key.generate_camellia_key(key_size, 'key-camellia')
camellia.encrypt_file('AI1_Plan.pdf', 'key-camellia', key_size, 'file', 'camellia-encrypted')
camellia.decrypt_file('camellia-encrypted', 'key-camellia', key_size, 'file', 'camellia-decrypted')
#
# CHACHA20
# nonce = generate_key.generate_chacha_key('key-chacha')
# chacha.encrypt_file('AI1_Plan.pdf', 'key-chacha', nonce, 'file', 'chacha20-encrypted')
# chacha.decrypt_file('chacha20-encrypted', 'key-chacha', nonce, 'file', 'chacha20-decrypted')
#
# RSA
# # Get a key pair
# # generate_key.generate_rsa_keypair()
# message = "Hello, RSA!"
# # Read the key
# public_key = rsa.read_public_key("rsa_pub_key.pem")
# encrypted_message = rsa.encrypt(public_key, 'AI1_Plan.pdf', 'file', 'rsa_encrypted')
#
# # Read the other key
# private_key = rsa.read_private_key("rsa_private_key.pem")
# decrypted_message = rsa.decrypt(private_key, 'rsa_encrypted', 'file', 'rsa_decrypted')