Skip to content

StjepanPetrovic/cryptography-rsa-aes

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Crypthography

Setup

  1. Install PHP 8.2
  2. Open terminal in the project root directory and run php -S localhost:8000 command in terminal
  3. Open http:https://localhost:8000 in browser
  4. Connect to the Internet because of JQuery

You should see the following screen:

img.png

Scenario

  1. Alice wants to send a file to Bob, but she wants to encrypt the file before sending it to Bob
  2. Bob sends his public key to Alice, and they agree on a symmetric key (showed on the main screen)
  3. In the first form, Alice selects a file, choose the key to use and clicks on the "Encrypt file" button, and she gets an encrypted file made on her client side
  4. In the second form, Alice selects the encrypted file and clicks on the "Send file" button, and she sends the encrypted file to Bob
  5. Bob decrypts the file with his private key or the symmetric key, and he gets the Alice's original file
  6. Bob edits Alice's file and signs it with his private key
  7. Bob sends edited Alice's file and his digital signature to Alice
  8. Alice verifies Bob's digital signature with Bob's public key, and she gets the message that the signature is valid or not to be sure that the file is from Bob and that the file is not changed

Symmetric Crypthography (AES cryptography)

  1. Used for symmetric key generation (PHP):

  2. Used for symmetric encryption (JavaScript - WebCrypto):

  3. Used for symmetric decryption (PHP - OpenSSL):

Asymmetric Encryption (RSA cryptopsystem)

  1. Used for asymmetric key generation (PHP - OpenSSL):

  2. Used for asymmetric encryption (JavaScript - WebCrypto):

  3. Used for asymmetric decryption (PHP - OpenSSL):

Digital Signature

Used for digital signature: