
Help with decription on arduino
- or -
Post a project like this1819
£40(approx. $54)
- Posted:
- Proposals: 2
- Remote
- #2890072
- Awarded
Description
Experience Level: Entry
I currently have a project that I am working on and was wondering if someone could help
The project is to create a secure key that ends an encrypted password over MQTT to an esp8266.
The issue that I am having is to do with encryption and decryption.
In PHP I have the following that encrypts and decrypts the password but needs help with the esp side of things
//Key
$key = 'opc$5304#*&230+@$#&y_2483hf782e4';
//Function for Encryption
function encryptthis($data, $key) {
$encryption_key = base64_decode($key);
$iv = openssl_random_pseudo_bytes(openssl_cipher_iv_length('aes-256-cbc'));
$encrypted = openssl_encrypt($data, 'aes-256-cbc', $encryption_key, 0, $iv);
return base64_encode($encrypted . '::' . $iv);
}
//Function for Decryption
function decryptthis($data, $key) {
$encryption_key = base64_decode($key);
list($encrypted_data, $iv) = array_pad(explode('::', base64_decode($data), 2),2,null);
return openssl_decrypt($encrypted_data, 'aes-256-cbc', $encryption_key, 0, $iv);
}
Kind Regards,
Jason Toland
The project is to create a secure key that ends an encrypted password over MQTT to an esp8266.
The issue that I am having is to do with encryption and decryption.
In PHP I have the following that encrypts and decrypts the password but needs help with the esp side of things
//Key
$key = 'opc$5304#*&230+@$#&y_2483hf782e4';
//Function for Encryption
function encryptthis($data, $key) {
$encryption_key = base64_decode($key);
$iv = openssl_random_pseudo_bytes(openssl_cipher_iv_length('aes-256-cbc'));
$encrypted = openssl_encrypt($data, 'aes-256-cbc', $encryption_key, 0, $iv);
return base64_encode($encrypted . '::' . $iv);
}
//Function for Decryption
function decryptthis($data, $key) {
$encryption_key = base64_decode($key);
list($encrypted_data, $iv) = array_pad(explode('::', base64_decode($data), 2),2,null);
return openssl_decrypt($encrypted_data, 'aes-256-cbc', $encryption_key, 0, $iv);
}
Kind Regards,
Jason Toland

Jason T.
100% (16)Projects Completed
11
Freelancers worked with
10
Projects awarded
50%
Last project
2 Jul 2021
United Kingdom
New Proposal
Login to your account and send a proposal now to get this project.
Log inClarification Board Ask a Question
-
There are no clarification messages.
We collect cookies to enable the proper functioning and security of our website, and to enhance your experience. By clicking on 'Accept All Cookies', you consent to the use of these cookies. You can change your 'Cookies Settings' at any time. For more information, please read ourCookie Policy
Cookie Settings
Accept All Cookies