Can I encrypt an email password only in a .m file?

2 Ansichten (letzte 30 Tage)
George Ebberson
George Ebberson am 3 Nov. 2018
Kommentiert: George Ebberson am 3 Nov. 2018
I have written a GUI for a .exe file, and I intend to distribute it, certainly to friends but also perhaps on the file exchange as an easy way of giving everyone the newest version. As a user-friendly feature, if an error occurs I have written a sub-function to change preferences and send an email from a Gmail account I have setup specifically for this purpose, to itself, a simplified version of which is below:
% Get current prefs.
Code to store current prefs...
% Set to custom values.
setpref('Internet','E_mail','mygmail');
setpref('Internet','SMTP_Server','smtp.gmail.com');
setpref('Internet','SMTP_Username','mygmail');
setpref('Internet','SMTP_Password','mypassword');
props.setProperty('mail.smtp.auth','true');
props.setProperty('mail.smtp.starttls.enable','true');
sendmail('mygmail','errorname','errordetails');
% Restore prefs.
Code to restore original prefs...
Is there a way for me to encrypt the username and password strings? So far, I've considered moving this to a second function, and distributing it as a p-code along with the main function, but I ideally need a one-file solution as some of the people using it may not be too tech-savvy.
I've also considered just p-coding the entire thing, but from what I understand p-code isn't allowed on the file exchange?
Ideally, I need some mechanism to store the password in an encrypted form inside the m-file (I've thought about storing it as some psuedo-hash and including the maths to de-hash it, but everyone else will also have the maths and therefore the password), or, a way of sending an email from any PC, which may not be on my network, to the address I've setup.
I'm not objected to using another email service if anyone knows of another which may be more convenient in this case.
  2 Kommentare
John D'Errico
John D'Errico am 3 Nov. 2018
Yes, it is true that p-code is not allowed on the File Exchange.
Can you find a way to do what you want? Anything along these lines would be a total kluge. But could you? I doubt you could do something that would run better than a horse with two legs.
George Ebberson
George Ebberson am 3 Nov. 2018
This was my worry. I fear I may have to just put the details in plaintext and not leave anything sensitive on the account.

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Kategorien

Mehr zu Adding custom doc finden Sie in Help Center und File Exchange

Produkte


Version

R2018b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by