C++ Program two functions seal/open that encrypt/decrypt data using Hybrid Encryption.
$10-50 USD
Suljettu
Julkaistu noin vuosi sitten
$10-50 USD
Maksettu toimituksen yhteydessä
Function seal:
Declaration:
bool seal(const char * inFile, const char * outFile, const char * publicKeyFile, const char * symmetricCipher)
Description:
The function accepts four parameters, the first three parameters define the names of files. In the file inFile, you will find binary data intended for encryption, outFile is the output file where you save all the necessary data for decryption, and publicKeyFile is the public key that will be used to encrypt the symmetric key. The parameter symmetricCipher is the name of the symmetric cipher.
The function generates a symmetric (shared) key and an initialization vector (IV), which will be the input to the symmetric cipher symmetricCipher. You will encrypt the data in inFile with this cipher, key, and IV. Also, you encrypt the symmetric key with an asymmetric cipher (RSA) using the public key stored in publicKeyFile.
OpenSSL does most of the work for you:
PEM_read_PUBKEY reads the public key,
EVP_SealInit generates a shared key and IV (if necessary), encrypts the shared key, and sets the context,
EVP_SealUpdate and EVP_SealFinal work the same as in previous tasks.
Hybrid encryption is able to encrypt for multiple recipients. The data is encrypted only once with a shared key and IV, but the shared key can be encrypted with multiple public keys. Therefore, the function accepts an array of public keys.
Output file format:
The output file will have the following structure:
position in file length structure description
0 4 B int NID - A numerical identifier for an OpenSSL cipher. (used symmetric cipher)
4 4 B int EKlen - length of the encrypted key
8 EKlen B unsigned char array Encrypted key using RSA
8 + EKlen IVlen B unsigned char array Initialization vector (if needed)
8 + EKlen + IVlen --- unsigned char array Encrypted data
Expected function behavior:
Returns true in case of success, false otherwise.
In case the function returns false, the output file will not exist.
Function open:
Declaration:
bool open(const char * inFile, const char * outFile, const char * privateKeyFile )
Description:
In the file inFile, you will find an encrypted file in the same format as the output file from the seal function. Write the decrypted data to the output file outFile - binary identity with the input file to the seal function is expected. This time, the private key for decrypting the encrypted key can be found in privateKeyFile. The functions PEM_read_PrivateKey, EVP_OpenInit, EVP_OpenUpdate, and EVP_OpenFinal will play a key role in this function.
Sample data contents
[login to view URL] - public key (try to open it as a txt file),
[login to view URL] - private key,
[login to view URL] - file with declarations and a basic test,
[login to view URL] - encrypted file. You can use it to test decryption. It was encrypted using the attached private key. After decryption, you will find ASCII text in it. If you encrypt the same data, the file will not be the same as [login to view URL] - a different key and IV were used.
Final advice
There are many places in this task where functions may return an error. Check and consider automatically releasing resources using unique_ptr (applies to context, key, allocated arrays, and file closing).
The length of the encrypted key depends on the public key. You cannot count on a fixed length.
When compiling, do not forget to link the OpenSSL crypto library using -lcrypto.
The OpenSSL version on progtest is 1.1.1n.
All "notes" from the previous task apply.
Hi,
I have great experience in implementing cryptographic algorithms both public and private from scratch as well as using the OpenSSL libraries, the core APIs as well as EVP functions in C or C++. I have clearly understood your requirements and I am very much interested in working on this amazing project, requiring both assymetric and symmetric key cryptography. I would like to get some minor technical clarifications regarding the requirements, which I can definitely get cleared from you via chat. I love programming in C and C++ and developing applications for the Linux platform.
I am very much interested in implementing this project and I am happy to put in the effort to help you in every way possible! Please feel free to contact me via chat so that we can discuss further and start working on this amazing project right away!!!
Best Regards,
Aravind A
Hello Client!
I am a senior expert with 10+ years of strong experience in C/C++ Programming and Cryptography.
If you hire me, I will perfectly complete two functions seal/open that encrypt/decrypt data using hybrid encryption so as to just meet your requirements.
I can start working on your project right away.
Please send a message to discuss this.
I look forward to hearing from you.
Regards,
Nicat.
******⭐⭐COMPETITVE PROGRAMMER ⭐⭐*********
Hi. Very happy to bid your project because my skills are fitted in your project .I am a expert in C/C++, C#, Python, OOP, Java and have rich experiences for over 5 years. I can work full time, and I am sure that I can complete your work with 100% quality. I hope you contact me for good result you wanted. Thanks.
I am familiar with your topic. Kindly allow me to start working on it. I GUARANTEE you high quality, detailed, self-tailored paper to your specifications and within the stipulated time frame