Package sop.operation
Interface Decrypt
-
public interface Decrypt
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods 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.DecryptverifyNotAfter(Date timestamp)Makes the SOP consider signatures after this date invalid.DecryptverifyNotBefore(Date timestamp)Makes the SOP consider signatures before this date invalid.default DecryptverifyWithCert(byte[] cert)Adds one or more verification cert.DecryptverifyWithCert(InputStream cert)Adds one or more verification cert.default DecryptwithKey(byte[] key)Adds one or more decryption key.DecryptwithKey(InputStream key)Adds one or more decryption key.DecryptwithKeyPassword(byte[] password)Provide the decryption password for the secret key.default DecryptwithKeyPassword(String password)Provide the decryption password for the secret key.DecryptwithPassword(String password)Tries to decrypt with the given password.DecryptwithSessionKey(SessionKey sessionKey)Tries to decrypt with the given session key.
-
-
-
Method Detail
-
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 theInputStreamdoesn't provide an OpenPGP certificateSOPGPException.UnsupportedAsymmetricAlgo- if the cert uses an unsupported asymmetric algorithmIOException- 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 certificateSOPGPException.UnsupportedAsymmetricAlgo- if the cert uses an unsupported asymmetric algorithmIOException- 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-readableSOPGPException.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 theInputStreamdoes not provide an OpenPGP keySOPGPException.UnsupportedAsymmetricAlgo- if the key uses an unsupported asymmetric algorithmIOException- 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 keySOPGPException.UnsupportedAsymmetricAlgo- if the key uses an unsupported asymmetric algorithmIOException- 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 passwordsSOPGPException.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 passwordsSOPGPException.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 theInputStreamdoes not provide an OpenPGP messageSOPGPException.MissingArg- if an argument required for decryption was not providedSOPGPException.CannotDecrypt- in case decryption fails for some reasonSOPGPException.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 messageSOPGPException.MissingArg- in case of missing decryption method (password or key required)SOPGPException.CannotDecrypt- in case decryption fails for some reasonSOPGPException.KeyIsProtected- if the decryption key cannot be unlocked (e.g. missing passphrase)IOException- in case of an IO error
-
-