security - Android how to handle sensitive data in memory -
please have following scenario:
the app uses password access remote webservice on https;
to so, app asks user password, not store on device (and use in safe manner access webservice).
my concern following: it's theroetically possible access memory read data contains , retrieve password.
please how prevent happening?
thanks
please how prevent happening?
i wear tin-foil hats on professional basis (besides, think spiffy...), , beyond worry about. i'd worry making https code won't victim of martian-in-the-middle (mitm) attack, that's lot easier attacker execute.
that being said, samgak alludes in comment, string
immutable. once password in string
, @ risk attack describe.
if use edittext
collect password, not call gettext().tostring()
user typed in. gettext()
return editable
, allows @ characters, not string
. then, if http client api allows fill in password using char[]
, once http request done, can clear out contents of char[]
, clear()
editable
, , pray edittext
, kin aren't holding onto string
anywhere represents user typed in. may vary device, device manufacturers have had long history of screwing around edittext
behavior, , may clean in terms of aosp code may less clean on hardware manufacturers.
if getting password other means (e.g., own set of pin entry buttons), avoid string
representation of result, , wipe out char[]
when you're done it.
Comments
Post a Comment