Can a secret be hidden in a ‘safe’ java class offering access credentials?

No, it’s not safe from other Java code. Your secret could be retrieved from an instance of Safe like this: Field field = safe.getClass().getDeclaredField(“secret”); field.setAccessible(true); String secret = (String) field.get(safe); Update: If you control the loading of the other Java code that you want to hide the secret from you can probably use a custom … Read more