Package sop.operation

# Interface Encrypt

public interface Encrypt

## Method Summary

Modifier and Type
Method
Description
`Encrypt`
`mode(EncryptAs mode)`
Sets encryption mode.
`Encrypt`
`noArmor()`
Disable ASCII armor encoding.
`default Ready`
`plaintext(byte[] plaintext)`
Encrypt the given data yielding the ciphertext.
`Ready`
`plaintext(InputStream plaintext)`
Encrypt the given data yielding the ciphertext.
`Encrypt`
`profile(String profileName)`
Pass in a profile identifier.
`default Encrypt`
`profile(Profile profile)`
Pass in a profile.
`default Encrypt`
`signWith(byte[] key)`
Adds the signer key.
`Encrypt`
`signWith(InputStream key)`
Adds the signer key.
`default Encrypt`
`withCert(byte[] cert)`
Encrypt with the given cert.
`Encrypt`
`withCert(InputStream cert)`
Encrypt with the given cert.
`Encrypt`
`withKeyPassword(byte[] password)`
Provide the password for the secret key used for signing.
`default Encrypt`
`withKeyPassword(String password)`
Provide the password for the secret key used for signing.
`Encrypt`
`withPassword(String password)`
Encrypt with the given password.

## Method Details

### noArmor

Encrypt noArmor()
Disable ASCII armor encoding.

Returns:
  builder instance

### mode

Encrypt mode(EncryptAs mode) throws SOPGPException.UnsupportedOption
Sets encryption mode.

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

### signWith

Encrypt signWith(InputStream key) throws SOPGPException.KeyCannotSign, SOPGPException.UnsupportedAsymmetricAlgo, SOPGPException.BadData, IOException
Adds the signer key.

Parameters:
  `key` - input stream containing the encoded signer key
Returns:
  builder instance
Throws:
  `SOPGPException.KeyCannotSign` - if the key cannot be used for signing
  `SOPGPException.UnsupportedAsymmetricAlgo` - if the key uses an unsupported asymmetric algorithm
  `SOPGPException.BadData` - if the `InputStream` does not contain an OpenPGP key
  `IOException` - in case of an IO error

### signWith

default Encrypt signWith(byte[] key) throws SOPGPException.KeyCannotSign, SOPGPException.UnsupportedAsymmetricAlgo, SOPGPException.BadData, IOException
Adds the signer key.

Parameters:
  `key` - byte array containing the encoded signer key
Returns:
  builder instance
Throws:
  `SOPGPException.KeyCannotSign` - if the key cannot be used for signing
  `SOPGPException.UnsupportedAsymmetricAlgo` - if the key uses an unsupported asymmetric algorithm
  `SOPGPException.BadData` - if the byte array does not contain an OpenPGP key
  `IOException` - in case of an IO error

### withKeyPassword

default Encrypt withKeyPassword(String password) throws SOPGPException.PasswordNotHumanReadable, SOPGPException.UnsupportedOption
Provide the password for the secret key used for signing.

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

### withKeyPassword

Encrypt withKeyPassword(byte[] password) throws SOPGPException.PasswordNotHumanReadable, SOPGPException.UnsupportedOption
Provide the password for the secret key used for signing.

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

### withPassword

Encrypt withPassword(String password) throws SOPGPException.PasswordNotHumanReadable, SOPGPException.UnsupportedOption
Encrypt 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

### withCert

Encrypt withCert(InputStream cert) throws SOPGPException.CertCannotEncrypt, SOPGPException.UnsupportedAsymmetricAlgo, SOPGPException.BadData, IOException
Encrypt with the given cert.

Parameters:
  `cert` - input stream containing the encoded cert.
Returns:
  builder instance
Throws:
  `SOPGPException.CertCannotEncrypt` - if the certificate is not encryption capable
  `SOPGPException.UnsupportedAsymmetricAlgo` - if the certificate uses an unsupported asymmetric algorithm
  `SOPGPException.BadData` - if the `InputStream` does not contain an OpenPGP certificate
  `IOException` - in case of an IO error

### withCert

default Encrypt withCert(byte[] cert) throws SOPGPException.CertCannotEncrypt, SOPGPException.UnsupportedAsymmetricAlgo, SOPGPException.BadData, IOException
Encrypt with the given cert.

Parameters:
  `cert` - byte array containing the encoded cert.
Returns:
  builder instance
Throws:
  `SOPGPException.CertCannotEncrypt` - if the certificate is not encryption capable
  `SOPGPException.UnsupportedAsymmetricAlgo` - if the certificate uses an unsupported asymmetric algorithm
  `SOPGPException.BadData` - if the byte array does not contain an OpenPGP certificate
  `IOException` - in case of an IO error

### profile

default Encrypt profile(Profile profile)
Pass in a profile.

Parameters:
  `profile` - profile
Returns:
  builder instance

### profile

Encrypt profile(String profileName)
Pass in a profile identifier.

Parameters:
  `profileName` - profile identifier
Returns:
  builder instance

### plaintext

Ready plaintext(InputStream plaintext) throws IOException, SOPGPException.KeyIsProtected
Encrypt the given data yielding the ciphertext.

Parameters:
  `plaintext` - plaintext
Returns:
  input stream containing the ciphertext
Throws:
  `IOException` - in case of an IO error
  `SOPGPException.KeyIsProtected` - if at least one signing key cannot be unlocked

### plaintext

default Ready plaintext(byte[] plaintext) throws IOException, SOPGPException.KeyIsProtected
Encrypt the given data yielding the ciphertext.

Parameters:
  `plaintext` - plaintext
Returns:
  input stream containing the ciphertext
Throws:
  `IOException` - in case of an IO error
  `SOPGPException.KeyIsProtected` - if at least one signing key cannot be unlocked