Message from the source to destination is sent in encrypted form. Input message is encrypted using the public key of the receiver and it is decrypted at the receiver using its private key. Encryption and decryption follows the Asymmetric Cryptography (RSA) Algorithm.
#Filename: asymmetric_Crypto.cc
Encryption() {
len = strlen(imsg);
while(i != len)
{
pt = m[i];
k = 1;
for (j = 0;j < key;j++)
{
k = k * pt;
k = k % n;
}
ct = k + 96;
en1[i] = ct;
}
printf("\nTHE ENCRYPTED MESSAGE IS\n");
for (w = 0; w < len; w++)
{
printf("%c", en1[w]);
}
}
Decryption () {
while (i != mdelen)
{
count2++;
ct = temp[i];
k = 1;
for (j = 0;j < key;j++)
{
k = k *ct;
k = k % n;
}
h[i] = pt;
i++;
}
printf("\nTHE DECRYPTED MESSAGE IS\n");
for (v = 0; v < mdelen; v++)
{
printf("%c", h[v]);
}
mdecr = h;
}
}