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.Pass in a profile identifier.default GenerateKey
Pass in a profile.If this options is set, the generated key will not be capable of encryption / decryption.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
-
profile
Pass in a profile.- Parameters:
profile
- profile- Returns:
- builder instance
-
profile
Pass in a profile identifier.- Parameters:
profile
- profile identifier- Returns:
- builder instance
-
signingOnly
GenerateKey signingOnly()If this options is set, the generated key will not be capable of encryption / decryption.- Returns:
- builder instance
-
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
-