Encrypted file for account info in email script
조회 수: 1 (최근 30일)
이전 댓글 표시
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
Rik
2022년 1월 20일
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.
답변 (1개)
Pravarthana P
2022년 2월 16일
편집: Pravarthana P
2022년 2월 16일
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
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!