Package org.pgpainless.encryption_signing

# Class ProducerOptions

java.lang.Object
org.pgpainless.encryption_signing.ProducerOptions

public final class ProducerOptions extends Object

## Method Summary

Modifier and Type
Method
Description
`ProducerOptions`
`applyCRLFEncoding()`
Apply special encoding of line endings to the input data.
`static ProducerOptions`
`encrypt(EncryptionOptions encryptionOptions)`
Encrypt some data without signing.
`String`
`getComment()`
Return comment set for header in ascii armored output.
`CompressionAlgorithm`
`getCompressionAlgorithmOverride()`
`StreamEncoding`
`getEncoding()`
`EncryptionOptions`
`getEncryptionOptions()`
`String`
`getFileName()`
Return the encrypted files name.
`Date`
`getModificationDate()`
Return the modification date of the encrypted file.
`SigningOptions`
`getSigningOptions()`
`String`
`getVersion()`
Return the version info header in ascii armored output.
`boolean`
`hasComment()`
Return whether a comment was set (!= null).
`boolean`
`hasVersion()`
Return whether a version header was set (!= null).
`boolean`
`isApplyCRLFEncoding()`
Return the input encoding that will be applied before signing / encryption.
`boolean`
`isAsciiArmor()`
Return true if the output of the encryption/signing operation shall be ascii armored.
`boolean`
`isCleartextSigned()`
`boolean`
`isHideArmorHeaders()`
`static ProducerOptions`
`noEncryptionNoSigning()`
Only wrap the data in an OpenPGP packet.
`ProducerOptions`
`overrideCompressionAlgorithm(CompressionAlgorithm compressionAlgorithm)`
Override which compression algorithm shall be used.
`ProducerOptions`
`setAsciiArmor(boolean asciiArmor)`
Specify, whether the result of the encryption/signing operation shall be ascii armored.
`ProducerOptions`
`setCleartextSigned()`
`ProducerOptions`
`setComment(String comment)`
Set the comment header in ASCII armored output.
`ProducerOptions`
`setEncoding(StreamEncoding encoding)`
Deprecated.
options other than the default value of `StreamEncoding.BINARY` are discouraged.
`ProducerOptions`
`setFileName(String fileName)`
Set the name of the encrypted file.
`ProducerOptions`
`setForYourEyesOnly()`
Deprecated.
deprecated since at least crypto-refresh-05.
`ProducerOptions`
`setHideArmorHeaders(boolean hideArmorHeaders)`
If set to
`ProducerOptions`
`setModificationDate(Date modificationDate)`
Set the modification date of the encrypted file.
`ProducerOptions`
`setVersion(String version)`
Set the version header in ASCII armored output.
`static ProducerOptions`
`sign(SigningOptions signingOptions)`
Sign some data without encryption.
`static ProducerOptions`
`signAndEncrypt(EncryptionOptions encryptionOptions, SigningOptions signingOptions)`
Sign and encrypt some data.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Method Details

### signAndEncrypt

public static ProducerOptions signAndEncrypt(EncryptionOptions encryptionOptions, SigningOptions signingOptions)
Sign and encrypt some data.

Parameters:
  `encryptionOptions` - encryption options
  `signingOptions` - signing options
Returns:
  builder

### sign

public static ProducerOptions sign(SigningOptions signingOptions)
Sign some data without encryption.

Parameters:
  `signingOptions` - signing options
Returns:
  builder

### encrypt

public static ProducerOptions encrypt(EncryptionOptions encryptionOptions)
Encrypt some data without signing.

Parameters:
  `encryptionOptions` - encryption options
Returns:
  builder

### noEncryptionNoSigning

public static ProducerOptions noEncryptionNoSigning()
Only wrap the data in an OpenPGP packet. No encryption or signing will be applied.

Returns:
  builder

### setAsciiArmor

public ProducerOptions setAsciiArmor(boolean asciiArmor)
Specify, whether the result of the encryption/signing operation shall be ascii armored. The default value is true.

Parameters:
  `asciiArmor` - ascii armor
Returns:
  builder

### isAsciiArmor

public boolean isAsciiArmor()
Return true if the output of the encryption/signing operation shall be ascii armored.

Returns:
  ascii armored

### setComment

public ProducerOptions setComment(String comment)
Set the comment header in ASCII armored output. The default value is null, which means no comment header is added. Multiline comments are possible using '\\n'.
Note: If a default header comment is set using `ArmoredOutputStreamFactory.setComment(String)`, then both comments will be written to the produced ASCII armor.

Parameters:
  `comment` - comment header text
Returns:
  builder

### setVersion

public ProducerOptions setVersion(String version)
Set the version header in ASCII armored output. The default value is null, which means no version header is added.
Note: If the value is non-null, then this method overrides the default version header set using `ArmoredOutputStreamFactory.setVersionInfo(String)`.

Parameters:
  `version` - version header, or null for no version info.
Returns:
  builder

### getComment

public String getComment()
Return comment set for header in ascii armored output.

Returns:
  comment

### getVersion

public String getVersion()
Return the version info header in ascii armored output.

Returns:
  version info

### hasComment

public boolean hasComment()
Return whether a comment was set (!= null).

Returns:
  true if commend is set

### hasVersion

public boolean hasVersion()
Return whether a version header was set (!= null).

Returns:
  true if version header is set

### setCleartextSigned

public ProducerOptions setCleartextSigned()

### isCleartextSigned

public boolean isCleartextSigned()

### setFileName

public ProducerOptions setFileName(@Nonnull String fileName)
Set the name of the encrypted file. Note: This option cannot be used simultaneously with `setForYourEyesOnly()`.

Parameters:
  `fileName` - name of the encrypted file
Returns:
  this

### getFileName

public String getFileName()
Return the encrypted files name.

Returns:
  file name

### setForYourEyesOnly

@Deprecated public ProducerOptions setForYourEyesOnly()
Deprecated.
deprecated since at least crypto-refresh-05. It is not recommended using this special filename in newly generated literal data packets
Mark the encrypted message as for-your-eyes-only by setting a special file name. Note: Therefore this method cannot be used simultaneously with `setFileName(String)`.

Returns:
  this

### setModificationDate

public ProducerOptions setModificationDate(@Nonnull Date modificationDate)
Set the modification date of the encrypted file.

Parameters:
  `modificationDate` - Modification date of the encrypted file.
Returns:
  this

### getModificationDate

public Date getModificationDate()
Return the modification date of the encrypted file.

Returns:
  modification date

### setEncoding

@Deprecated public ProducerOptions setEncoding(@Nonnull StreamEncoding encoding)
Deprecated.
options other than the default value of `StreamEncoding.BINARY` are discouraged.
Set format metadata field of the literal data packet. Defaults to `StreamEncoding.BINARY`.
This does not change the encoding of the wrapped data itself. To apply CR/LF encoding to your input data before processing, use `applyCRLFEncoding()` instead.

Parameters:
  `encoding` - encoding
Returns:
  this
See Also:
  - RFC4880 §5.9. Literal Data Packet

### getEncoding

public StreamEncoding getEncoding()

### applyCRLFEncoding

public ProducerOptions applyCRLFEncoding()
Apply special encoding of line endings to the input data. By default, this is disabled, which means that the data is not altered.
Enabling it will change the line endings to CR/LF. Note: The encoding will not be reversed when decrypting, so applying CR/LF encoding will result in the identity "decrypt(encrypt(data)) == data == verify(sign(data))".

Returns:
  this

### isApplyCRLFEncoding

public boolean isApplyCRLFEncoding()
Return the input encoding that will be applied before signing / encryption.

Returns:
  input encoding

### overrideCompressionAlgorithm

public ProducerOptions overrideCompressionAlgorithm(CompressionAlgorithm compressionAlgorithm)
Override which compression algorithm shall be used.

Parameters:
  `compressionAlgorithm` - compression algorithm override
Returns:
  builder

### getCompressionAlgorithmOverride

public CompressionAlgorithm getCompressionAlgorithmOverride()

### getEncryptionOptions

@Nullable public EncryptionOptions getEncryptionOptions()

### getSigningOptions

@Nullable public SigningOptions getSigningOptions()

### isHideArmorHeaders

public boolean isHideArmorHeaders()

### setHideArmorHeaders

public ProducerOptions setHideArmorHeaders(boolean hideArmorHeaders)
If set to

    true

, armor headers like version or comments will be omitted from armored output. By default, armor headers are not hidden. Note: If comments are added via `setComment(String)`, those are not omitted, even if `hideArmorHeaders` is set to

    true

.

Parameters:
  `hideArmorHeaders` - true or false
Returns:
  this