Skip to content

Program that uses RSA/AES/SHA256 to Ciph and Sign files.

Notifications You must be signed in to change notification settings

Althernis/Cipher-Keys-local

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation



Program Structure

Sign and Cipher

We start with a Message contained in a file.

First, we have to sign it. For that, we have to use a hash function with the messages's text. Once we have it, we use our private key (RSA pair keys) to cipher it, having the sign.

With the signed hash and the message its neccesary to generate a symmetric key, using AES. Using that key, we cipher the concatenation of the signed hash and the message, obtaining the cipher message.

In order to communicate the Symmetric key with the destination, we have to cipher the symmetric key with the destination's public asymmetric key, so the destination could uncipher it with their private key.

The singed and cipher message will be the concatenation of the ciphered Symmetric key with the ciphered message.

Here is the resultant diagram:




Sign and Cipher a Message

UnCipher and Check Sign

We start with a Singed and Chipered Message contained in a file.

We have to read it and get the Symmetric key, unciphing it using the user's private key and getting the sign and content.

Its necessary to validate the sign and, if its ok, get the content.

Functions

  • generate_RSA: Generate the keys

  • load_RSA: Load/Generate the keys

  • sign: Sign the content

  • check_sign: Check the sign

  • cipher: Ciph content

  • unciph: Unciph content

  • sign_and_ciph: Sign and Ciph a file

  • unciph_file: Unciph content

  • unciph_aes_key: Unciph AES Key

  • unciph_and_checkSign: Unciph file and check the Sign

Enviroment

This enviroment is created using virtualenv on a linux machine.

virtualenv -p python3 CypherEnv

source CypherEnv/bin/activate

pip install PyCryptodome

!important dont install PyCrypto. There are some conflicts.

Examples

This examples were run on a linux machine. If you use Windows, the output could change due to the colors.py module.

No parameters




Verbose mode

Keys Generation, Ciph and Error




Custom Keys Generation




Releases

No releases published

Packages

No packages published

Languages