Package com.unboundid.util
Class PassphraseEncryptedOutputStreamProperties
- java.lang.Object
-
- com.unboundid.util.PassphraseEncryptedOutputStreamProperties
-
- All Implemented Interfaces:
java.io.Serializable
@Mutable @ThreadSafety(level=NOT_THREADSAFE) public final class PassphraseEncryptedOutputStreamProperties extends java.lang.Object implements java.io.Serializable
This class provides a set of properties that will be used when creating aPassphraseEncryptedOutputStream
. The default settings that will be used for properties that are not required in the constructor are:- The header will be written to the beginning of the output stream.
- The cipher type's key factory iteration count will be used.
- No key identifier will be included in the encryption header.
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description PassphraseEncryptedOutputStreamProperties(PassphraseEncryptionCipherType cipherType)
Creates a newPassphraseEncryptedOutputStreamProperties
instance with the provided cipher type value.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description PassphraseEncryptionCipherType
getCipherType()
Retrieves the cipher type value that will be used to obtain settings when encrypting data.int
getKeyFactoryIterationCount()
Retrieves the iteration count that will be used when generating the encryption key from the passphrase.java.lang.String
getKeyIdentifier()
Retrieves a key identifier that may be used to associate the encryption details with information in another system.void
setKeyFactoryIterationCount(java.lang.Integer keyFactoryIterationCount)
Specifies the iteration count that will be used when generating the encryption key from the passphrase.void
setKeyIdentifier(java.lang.String keyIdentifier)
Specifies a key identifier that may be used to associate the encryption details with information in another system.void
setWriteHeaderToStream(boolean writeHeaderToStream)
Specifies whether thePassphraseEncryptedOutputStream
should write the generatedPassphraseEncryptedStreamHeader
to the wrapped output stream before starting the encrypted data so that aPassphraseEncryptedInputStream
can read it to obtain the necessary information for decrypting the data.java.lang.String
toString()
Retrieves a string representation of these properties.void
toString(java.lang.StringBuilder buffer)
Appends a string representation of these properties to the provided buffer.boolean
writeHeaderToStream()
Indicates whether thePassphraseEncryptedOutputStream
should write the generatedPassphraseEncryptedStreamHeader
to the wrapped output stream before starting the encrypted data so that aPassphraseEncryptedInputStream
can read it to obtain the necessary information for decrypting the data.
-
-
-
Constructor Detail
-
PassphraseEncryptedOutputStreamProperties
public PassphraseEncryptedOutputStreamProperties(@NotNull PassphraseEncryptionCipherType cipherType)
Creates a newPassphraseEncryptedOutputStreamProperties
instance with the provided cipher type value.- Parameters:
cipherType
- The cipher type value that will be used to obtain settings when encrypting data.
-
-
Method Detail
-
getCipherType
@NotNull public PassphraseEncryptionCipherType getCipherType()
Retrieves the cipher type value that will be used to obtain settings when encrypting data.- Returns:
- The cipher type value that will be used to obtain settings when encrypting data.
-
writeHeaderToStream
public boolean writeHeaderToStream()
Indicates whether thePassphraseEncryptedOutputStream
should write the generatedPassphraseEncryptedStreamHeader
to the wrapped output stream before starting the encrypted data so that aPassphraseEncryptedInputStream
can read it to obtain the necessary information for decrypting the data.- Returns:
true
if thePassphraseEncryptedOutputStream
should write aPassphraseEncryptedStreamHeader
to the wrapped output stream before any encrypted data, orfalse
if not.
-
setWriteHeaderToStream
public void setWriteHeaderToStream(boolean writeHeaderToStream)
Specifies whether thePassphraseEncryptedOutputStream
should write the generatedPassphraseEncryptedStreamHeader
to the wrapped output stream before starting the encrypted data so that aPassphraseEncryptedInputStream
can read it to obtain the necessary information for decrypting the data. If this isfalse
, then the necessary metadata should be stored elsewhere so that it can be used to decrypt the data.- Parameters:
writeHeaderToStream
- Indicates whether thePassphraseEncryptedOutputStream
should write the generatedPassphraseEncryptedStreamHeader
to the wrapped output stream before starting the encrypted data.
-
getKeyFactoryIterationCount
public int getKeyFactoryIterationCount()
Retrieves the iteration count that will be used when generating the encryption key from the passphrase.- Returns:
- The iteration count that will be used when generating the encryption key from the passphrase.
-
setKeyFactoryIterationCount
public void setKeyFactoryIterationCount(@Nullable java.lang.Integer keyFactoryIterationCount)
Specifies the iteration count that will be used when generating the encryption key from the passphrase.- Parameters:
keyFactoryIterationCount
- The iteration count that will be used when generating the encryption key from the passphrase. If this isnull
, then the cipher type's key factory iteration count will be used.
-
getKeyIdentifier
@Nullable public java.lang.String getKeyIdentifier()
Retrieves a key identifier that may be used to associate the encryption details with information in another system. This is primarily intended for use in conjunction with the UnboundID/Ping Identity server products, but it may be useful in other systems as well.- Returns:
- A key identifier that may be used to associate the encryption
details with information in another system, or
null
if no key identifier should be used.
-
setKeyIdentifier
public void setKeyIdentifier(@Nullable java.lang.String keyIdentifier)
Specifies a key identifier that may be used to associate the encryption details with information in another system. This is primarily intended for use in conjunction with the UnboundID/Ping Identity server products, but it may be useful in other systems as well.- Parameters:
keyIdentifier
- A key identifier that may be used to associate the encryption details with information in another system. It may benull
if no key identifier should be used.
-
toString
@NotNull public java.lang.String toString()
Retrieves a string representation of these properties.- Overrides:
toString
in classjava.lang.Object
- Returns:
- A string representation of these properties.
-
-