The goal of IniEncrypt is to test the efficacy and the applicability of both symmetric and asymmetric cryptographic algorithms when encrypting/decrypting text and images.
Algorithms being considered include:
- Diffie-Hellman
- RSA
- 3DES
- AES
Cryptographic Algorithms can be:
- Symmetric Algorithm (e.g AES and TripleDES)
- Asymmetric Algorithm (e.g. RSA and DiffieHellman)
Symmetric Algorithm are cryptographic algorithms that use a single key to either encrypt or decrypt data. This means both parties (Bob and Alice) share a single secret key. AES has a key size length of 16-bytes while TripleDES can support both 16-bytes and 24-bytes key sizes.
Asymmetric Algorithms are cryptographic algorithms that require the use of a key pair i.e. two keys (PrivateKey and PublicKey) are required. When two parties (Bob and Alice) want to communicate, The following processes happens:
- The sender(Alice) generates a Public and Private Key pair.
- Alice then encodes her Public Key and sends it to the receiver(Bob).
- Bob generates his own Public and Private Key pair and sends his encoded Public Key over to Alice.
- This marks the end of the key sharing process.
- To transmit data between both parties, Alice, for example, encrypts her message (data) with Bob's Public Key and sends it to Bob.
- Bob receives the encrypted message from Alice and decrypts it with his Private Key.
-
RSA accepts key sizes between 512 and 65536 bytes (in multiples of 64 bytes). RSA can only encrypt data with a maximum size of ((keySize/8)-11) i.e. for example, if a keySize of 1024 is used, it can only encrypt data with a maximum size of ((1024/8)-11) = 117 bytes
-
Diffie Hellman is a Key Exchange algorithm and accepts key sizes between 512 and 2048 bytes (in multiples of 64 bytes). The DH Key Exchange Process:
- The sender (Alice) starts the DH Key exchange process by generating a Private and Public Key pair with a specified Key size.
- Alice encodes her Public Key and sends it to the receiver (Bob).
- Bob receives Alice's encoded Public Key and generates his own Public and Private Key pair using the parameters encoded in Alice's Public Key.
- Bob encodes his Public Key and sends it over to Alice.
- Alice uses Bob's encoded Public Key to initiate her own first phase of the DH protocol.
- Bob also uses Alice's Public Key to initiate his own first phase of the DH protocol.
- Both Bob and Alice generates a Shared Secret Key (The keys generated at both ends must tally).
- The size of the Shared Secret Key is dependent on the size of the cryptographic Key used. If a key size of 512 is used, a Shared Secret Key of 64 bytes would be generated.
- The Shared Secret Key is used to encrypt/decrypt data being sent or received to/from both parties (Bob and Alice).