Safely using String for passwords by using reflection to scrub contents prior to garbage collection

后端 未结 2 1103
囚心锁ツ
囚心锁ツ 2021-01-07 23:52

Does using reflection to scrub a String make using String as safe as using char[] for passwords?

From a security aspect, it is

2条回答
  •  Happy的楠姐
    2021-01-08 00:22

    One argument I have against String is that it's just too easy to inadvertently make a copy. Using strings safely is possible in theory, but the whole library ecosystem is based on the assumption that it's perfectly OK to copy strings. In the end, considering all the restrictions, strings may not be as convenient for this use case as they generally are.

提交回复
热议问题