/** * Provides access to the clear-text value of the string in a controlled * fashion. * * The clear-text characters will only be available for the duration of the * call and automatically zeroed out following the call. * <p> * <b>NOTE:</b> Callers are encouraged to use * {@link #verifyBase64SHA1Hash(String)} where possible if the intended use * is merely to verify the contents of the string match an expected hash * value. * * @param accessor * Accessor callback. * @throws IllegalStateException * If the string has been disposed */ public void access(Accessor accessor) { checkNotDisposed(); char[] clearChars = null; try { clearChars = decryptChars(); accessor.access(clearChars); } finally { SecurityUtil.clear(clearChars); } }
/** * Provides access to the clear-text value of the string in a controlled * fashion. * * The clear-text characters will only be available for the duration of the * call and automatically zeroed out following the call. * <p> * <b>NOTE:</b> Callers are encouraged to use * {@link #verifyBase64SHA1Hash(String)} where possible if the intended use * is merely to verify the contents of the string match an expected hash * value. * * @param accessor * Accessor callback. * @throws IllegalStateException * If the string has been disposed */ public void access(Accessor accessor) { checkNotDisposed(); char[] clearChars = null; try { clearChars = decryptChars(); accessor.access(clearChars); } finally { SecurityUtil.clear(clearChars); } }
/** * Provides access to the clear-text value of the string in a controlled fashion. * The clear-text characters will only be available for the duration of the call * and automatically zeroed out following the call. * * <p> * <b>NOTE:</b> Callers are encouraged to use {@link #verifyBase64SHA1Hash(String)} * where possible if the intended use is merely to verify the contents of * the string match an expected hash value. * @param accessor Accessor callback. * @throws IllegalStateException If the string has been disposed */ public void access(Accessor accessor) { checkNotDisposed(); char [] clearChars = null; try { clearChars = decryptChars(); accessor.access(clearChars); } finally { SecurityUtil.clear(clearChars); } }