Avatar
Please consider registering
guest
sp_LogInOut Log Insp_Registration Register
Register | Lost password?
Advanced Search
Forum Scope


Match



Forum Options



Minimum search word length is 3 characters - maximum search word length is 84 characters
sp_Feed Topic RSSsp_TopicIcon
UserIdentity - pass username & password in form of char[] not plain String
September 29, 2026
13:40, EEST
Avatar
amatuszkiew
New Member
Members
Forum Posts: 1
Member Since:
September 29, 2026
sp_UserOfflineSmall Offline

Hi,

I have question related to creation of UserIdentity object. When we want to create UserIdentity with username and password we need to pass String objects with proper data. The problematic part is a fact that we pass immutable objects that are managed by Java String Pool. Basically it means that if take a heap dump of JVM the credentials will be exposed. Is there any way to for example pass this data in other way (for example in form of char[])?

I will be glad for any guidance,
Artur

September 29, 2026
15:34, EEST
Avatar
Bjarne Boström
Moderator
Moderators
Forum Posts: 1118
Member Since:
April 3, 2012
sp_UserOfflineSmall Offline

Hi,

Assuming you mean the classical pattern of giving char[] and the zeroing it out? That doesn’t apply here.

The SDK must retain knowledge of the password, since if there is a connection break it must be able to do ActivateSession again once reconnected, thus it needs the password at that time again. In theory after the UaClient.disconnect there would be no more need to know, unless doing another .connect on the same object. This is one of the general reasons why systems increasingly try to move away from user passwords. User-certificates would avoid the need to have the password in memory, however please note below.

Note that the same also applies to the private keys related to the application (and user) certificates. They are also in memory. We must be able to pass those to BouncyCastle lib to do crypto operations as byte[]. Here as well a reconnect will need to be able to make a new SecureChannel. Also the SecureChannel is renewed in addition even if there are no connection breaks.

The SDK cannot protect against an environment where process memory itself is not secure. If an attacker is able to make a memory dump, they are likely to have enough privileges to modify the application and SDK code running on the JVM itself. Thus, if you yourself make a memory dump, it should be treated with care. Maybe you can post-process it to remove sensitive information if you must give it to someone.

P.S.
In theory it might be possible to some day support hardware-backed private keys. It might also be possible to have some callback for the user password to be given as char[] each time it is needed, though an implementation of that would need to have non-memory-based storage, and it would still leave a timing window when the password is in memory. At least currently none of these are on our roadmap.

Forum Timezone: Europe/Helsinki
Most Users Ever Online: 2206
Currently Online:
Guest(s) 23
Currently Browsing this Page:
1 Guest(s)
Top Posters:
Heikki Tahvanainen: 402
hbrackel: 160
rocket science: 133
pramanj: 86
Francesco Zambon: 83
Ibrahim: 78
Sabari: 62
kapsl: 57
gjevremovic: 49
Xavier: 43
Member Stats:
Guest Posters: 1
Members: 738
Moderators: 7
Admins: 1
Forum Stats:
Groups: 3
Forums: 15
Topics: 1614
Posts: 6804
Newest Members:
amatuszkiew, mopihod4, TheresaHarrison, a.santos.meb, itilgabut
Moderators: Jouni Aro: 1060, Pyry: 1, Petri: 1, Bjarne Boström: 1118, Jimmy Ni: 26, Matti Siponen: 375, Lusetti: 10
Administrators: admin: 1