Package sop.operation
Interface GenerateKey
public interface GenerateKey
-
Method Summary
Modifier and TypeMethodDescriptiongenerate()
Generate the OpenPGP key and return it encoded as anInputStream
.noArmor()
Disable ASCII armor encoding.Adds a user-id.default GenerateKey
withKeyPassword
(byte[] password) Set a password for the key.withKeyPassword
(String password) Set a password for the key.
-
Method Details
-
noArmor
GenerateKey noArmor()Disable ASCII armor encoding.- Returns:
- builder instance
-
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, IOExceptionGenerate 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
-