Package sop.operation

# Interface Decrypt

public interface Decrypt

## Method Summary

Modifier and Type
Method
Description
`default ReadyWithResult<DecryptionResult>`
`ciphertext(byte[] ciphertext)`
Decrypts the given ciphertext, returning verification results and plaintext.
`ReadyWithResult<DecryptionResult>`
`ciphertext(InputStream ciphertext)`
Decrypts the given ciphertext, returning verification results and plaintext.
`Decrypt`
`verifyNotAfter(Date timestamp)`
Makes the SOP consider signatures after this date invalid.
`Decrypt`
`verifyNotBefore(Date timestamp)`
Makes the SOP consider signatures before this date invalid.
`default Decrypt`
`verifyWithCert(byte[] cert)`
Adds one or more verification cert.
`Decrypt`
`verifyWithCert(InputStream cert)`
Adds one or more verification cert.
`default Decrypt`
`withKey(byte[] key)`
Adds one or more decryption key.
`Decrypt`
`withKey(InputStream key)`
Adds one or more decryption key.
`Decrypt`
`withKeyPassword(byte[] password)`
Provide the decryption password for the secret key.
`default Decrypt`
`withKeyPassword(String password)`
Provide the decryption password for the secret key.
`Decrypt`
`withPassword(String password)`
Tries to decrypt with the given password.
`Decrypt`
`withSessionKey(SessionKey sessionKey)`
Tries to decrypt with the given session key.

## Method Details

### verifyNotBefore

Decrypt verifyNotBefore(Date timestamp) throws SOPGPException.UnsupportedOption
Makes the SOP consider signatures before this date invalid.

Parameters:
  `timestamp` - timestamp
Returns:
  builder instance
Throws:
  `SOPGPException.UnsupportedOption` - if this option is not supported

### verifyNotAfter

Decrypt verifyNotAfter(Date timestamp) throws SOPGPException.UnsupportedOption
Makes the SOP consider signatures after this date invalid.

Parameters:
  `timestamp` - timestamp
Returns:
  builder instance
Throws:
  `SOPGPException.UnsupportedOption` - if this option is not supported

### verifyWithCert

Decrypt verifyWithCert(InputStream cert) throws SOPGPException.BadData, SOPGPException.UnsupportedAsymmetricAlgo, IOException
Adds one or more verification cert.

Parameters:
  `cert` - input stream containing the cert(s)
Returns:
  builder instance
Throws:
  `SOPGPException.BadData` - if the `InputStream` doesn't provide an OpenPGP certificate
  `SOPGPException.UnsupportedAsymmetricAlgo` - if the cert uses an unsupported asymmetric algorithm
  `IOException` - in case of an IO error

### verifyWithCert

default Decrypt verifyWithCert(byte[] cert) throws SOPGPException.BadData, SOPGPException.UnsupportedAsymmetricAlgo, IOException
Adds one or more verification cert.

Parameters:
  `cert` - byte array containing the cert(s)
Returns:
  builder instance
Throws:
  `SOPGPException.BadData` - if the byte array doesn't contain an OpenPGP certificate
  `SOPGPException.UnsupportedAsymmetricAlgo` - if the cert uses an unsupported asymmetric algorithm
  `IOException` - in case of an IO error

### withSessionKey

Decrypt withSessionKey(SessionKey sessionKey) throws SOPGPException.UnsupportedOption
Tries to decrypt with the given session key.

Parameters:
  `sessionKey` - session key
Returns:
  builder instance
Throws:
  `SOPGPException.UnsupportedOption` - if this option is not supported

### withPassword

Decrypt withPassword(String password) throws SOPGPException.PasswordNotHumanReadable, SOPGPException.UnsupportedOption
Tries to decrypt with the given password.

Parameters:
  `password` - password
Returns:
  builder instance
Throws:
  `SOPGPException.PasswordNotHumanReadable` - if the password is not human-readable
  `SOPGPException.UnsupportedOption` - if this option is not supported

### withKey

Decrypt withKey(InputStream key) throws SOPGPException.BadData, SOPGPException.UnsupportedAsymmetricAlgo, IOException
Adds one or more decryption key.

Parameters:
  `key` - input stream containing the key(s)
Returns:
  builder instance
Throws:
  `SOPGPException.BadData` - if the `InputStream` does not provide an OpenPGP key
  `SOPGPException.UnsupportedAsymmetricAlgo` - if the key uses an unsupported asymmetric algorithm
  `IOException` - in case of an IO error

### withKey

default Decrypt withKey(byte[] key) throws SOPGPException.BadData, SOPGPException.UnsupportedAsymmetricAlgo, IOException
Adds one or more decryption key.

Parameters:
  `key` - byte array containing the key(s)
Returns:
  builder instance
Throws:
  `SOPGPException.BadData` - if the byte array does not contain an OpenPGP key
  `SOPGPException.UnsupportedAsymmetricAlgo` - if the key uses an unsupported asymmetric algorithm
  `IOException` - in case of an IO error

### withKeyPassword

default Decrypt withKeyPassword(String password) throws SOPGPException.UnsupportedOption, SOPGPException.PasswordNotHumanReadable
Provide the decryption password for the secret key.

Parameters:
  `password` - password
Returns:
  builder instance
Throws:
  `SOPGPException.UnsupportedOption` - if the implementation does not support key passwords
  `SOPGPException.PasswordNotHumanReadable` - if the password is not human-readable

### withKeyPassword

Decrypt withKeyPassword(byte[] password) throws SOPGPException.UnsupportedOption, SOPGPException.PasswordNotHumanReadable
Provide the decryption password for the secret key.

Parameters:
  `password` - password
Returns:
  builder instance
Throws:
  `SOPGPException.UnsupportedOption` - if the implementation does not support key passwords
  `SOPGPException.PasswordNotHumanReadable` - if the password is not human-readable

### ciphertext

ReadyWithResult<DecryptionResult> ciphertext(InputStream ciphertext) throws SOPGPException.BadData, SOPGPException.MissingArg, SOPGPException.CannotDecrypt, SOPGPException.KeyIsProtected, IOException
Decrypts the given ciphertext, returning verification results and plaintext.

Parameters:
  `ciphertext` - ciphertext
Returns:
  ready with result
Throws:
  `SOPGPException.BadData` - if the `InputStream` does not provide an OpenPGP message
  `SOPGPException.MissingArg` - if an argument required for decryption was not provided
  `SOPGPException.CannotDecrypt` - in case decryption fails for some reason
  `SOPGPException.KeyIsProtected` - if the decryption key cannot be unlocked (e.g. missing passphrase)
  `IOException` - in case of an IO error

### ciphertext

default ReadyWithResult<DecryptionResult> ciphertext(byte[] ciphertext) throws SOPGPException.BadData, SOPGPException.MissingArg, SOPGPException.CannotDecrypt, SOPGPException.KeyIsProtected, IOException
Decrypts the given ciphertext, returning verification results and plaintext.

Parameters:
  `ciphertext` - ciphertext
Returns:
  ready with result
Throws:
  `SOPGPException.BadData` - if the byte array does not contain an encrypted OpenPGP message
  `SOPGPException.MissingArg` - in case of missing decryption method (password or key required)
  `SOPGPException.CannotDecrypt` - in case decryption fails for some reason
  `SOPGPException.KeyIsProtected` - if the decryption key cannot be unlocked (e.g. missing passphrase)
  `IOException` - in case of an IO error