Package sop.operation
Interface GenerateKey
-
public interface GenerateKey
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description Ready
generate()
Generate the OpenPGP key and return it encoded as anInputStream
.GenerateKey
noArmor()
Disable ASCII armor encoding.GenerateKey
userId(String userId)
Adds a user-id.default GenerateKey
withKeyPassword(byte[] password)
Set a password for the key.GenerateKey
withKeyPassword(String password)
Set a password for the key.
-
-
-
Method Detail
-
noArmor
GenerateKey noArmor()
Disable ASCII armor encoding.- Returns:
- builder instance
-
userId
GenerateKey userId(String userId)
Adds a user-id.- Parameters:
userId
- user-id- Returns:
- builder instance
-
withKeyPassword
GenerateKey withKeyPassword(String password) throws SOPGPException.PasswordNotHumanReadable, SOPGPException.UnsupportedOption
Set a password for the key.- Parameters:
password
- password to protect the key- Returns:
- builder instance
- Throws:
SOPGPException.UnsupportedOption
- if key passwords are not supportedSOPGPException.PasswordNotHumanReadable
- if the password is not human-readable
-
withKeyPassword
default GenerateKey withKeyPassword(byte[] password) throws SOPGPException.PasswordNotHumanReadable, SOPGPException.UnsupportedOption
Set a password for the key.- Parameters:
password
- password to protect the key- Returns:
- builder instance
- Throws:
SOPGPException.PasswordNotHumanReadable
- if the password is not human-readableSOPGPException.UnsupportedOption
- if key passwords are not supported
-
generate
Ready generate() throws SOPGPException.MissingArg, SOPGPException.UnsupportedAsymmetricAlgo, IOException
Generate the OpenPGP key and return it encoded as anInputStream
.- Returns:
- key
- Throws:
SOPGPException.MissingArg
- if no user-id was providedSOPGPException.UnsupportedAsymmetricAlgo
- if the generated key uses an unsupported asymmetric algorithmIOException
- in case of an IO error
-
-