Package org.apache.shiro.crypto.cipher
Class SimpleByteSourceBroker
java.lang.Object
org.apache.shiro.crypto.cipher.SimpleByteSourceBroker
- All Implemented Interfaces:
ByteSourceBroker,org.apache.shiro.lang.util.Destroyable
public class SimpleByteSourceBroker
extends Object
implements ByteSourceBroker, org.apache.shiro.lang.util.Destroyable
A simple implementation that maintains cipher service, ciphertext and key for decrypting it later.
useBytes(ByteSourceUser) guarantees the sensitive data in byte array will be erased at end of use.-
Constructor Summary
ConstructorsConstructorDescriptionSimpleByteSourceBroker(JcaCipherService cipherService, byte[] ciphertext, byte[] key) -
Method Summary
Modifier and TypeMethodDescriptionvoiddestroy()byte[]As the name implies, this returns a cloned byte array and caller has a responsibility to wipe it out at end of use.voiduseBytes(ByteSourceUser user) This method accepts an implementation of ByteSourceUser functional interface.
-
Constructor Details
-
SimpleByteSourceBroker
-
-
Method Details
-
useBytes
Description copied from interface:ByteSourceBrokerThis method accepts an implementation of ByteSourceUser functional interface.
To limit the decrypted value's existence, developers should maintain the implementation part as short as possible.- Specified by:
useBytesin interfaceByteSourceBroker- Parameters:
user- Implements a use-case for the decrypted value.
-
getClonedBytes
public byte[] getClonedBytes()Description copied from interface:ByteSourceBrokerAs the name implies, this returns a cloned byte array and caller has a responsibility to wipe it out at end of use.- Specified by:
getClonedBytesin interfaceByteSourceBroker
-
destroy
- Specified by:
destroyin interfaceorg.apache.shiro.lang.util.Destroyable- Throws:
Exception
-