Encrypted file for account info in email script
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
I have this script to send emails using MATLAB:
setpref('Internet','SMTP_Server','smtp.gmail.com');
setpref('Internet','E_mail','EMAIL ADDRESS');
setpref('Internet','SMTP_Username','EMAIL USERNAME');
setpref('Internet','SMTP_Password','EMAIL PASSWORD');
props = java.lang.System.getProperties;
props.setProperty('mail.smtp.auth','true');
props.setProperty('mail.smtp.socketFactory.class', 'javax.net.ssl.SSLSocketFactory');
props.setProperty('mail.smtp.socketFactory.port','465');
sendmail('RECEIVER ADDRESS','I did it','I can also send attatchments');
and while the script itself (when filled in with the correct information) does function as intended, the inclusion of the email username and password in the .m file is obviously insecure. Does anyone know of a way of both encrypting a file with the information, and getting matlab to read it?
1 Kommentar
Rik
am 20 Jan. 2022
Anybody with access to the file containing your password and the code you wrote to decrypt it, will have access to the password. That is fundamental to the way this code will work.
If you actually want something secure, at the very least do NOT invent your own encryption and decryption method. Store the key in a third place.
Antworten (1)
Pravarthana P
am 16 Feb. 2022
Bearbeitet: Pravarthana P
am 16 Feb. 2022
Hi Alexander Ketzle, it can be understood that you are trying to protect the data that is present in your MATLAB source code. This is a known issue, for which you can find the possible workarounds as stated below:
1. You can replace your SMTP server username and password in your MATLAB preferences with blank values. You can do this by typing the following commands at the MATLAB command prompt:
setpref('Internet','SMTP_Username','');
setpref('Internet','SMTP_Password','');
2. You can always convert into Pcode that obfuscates the code although this doesn’t provide complete encryption of your code.
You may find the following link helpful:
0 Kommentare
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!