My application is ruby-on-rails, but I expect any answers to this question will probably be framework agnostic.
My application sends emails via gmail SMTP using rails ActionMailers a-la:
mail = MyActionMailerSubclass.setup_email
options = { :address => "smtp.gmail.com",
:port => 587,
:domain => 'mydomain.com',
:user_name => 'myuser@mydomain.com',
:password => 's3cur3p@s$w0rd',
:authentication => 'plain',
:enable_starttls_auto => true }
mail.delivery_method :smtp, options
mail.deliver
Ok, that's great...there's my password for gmail in plain text in the application code. Or I could store it in the database in plain text. Obviously both are unacceptable.
Salting and hashing, the usual technique wont work here because I need to send the password along to gmail.
So, what strategies are there for securing a password for a third party service?
Ultimately that user name and password wont even belong to me, they will belong to the application end-user.