Class SecretKeyRingEditor
- java.lang.Object
-
- org.pgpainless.key.modification.secretkeyring.SecretKeyRingEditor
-
- All Implemented Interfaces:
SecretKeyRingEditorInterface
public class SecretKeyRingEditor extends java.lang.Object implements SecretKeyRingEditorInterface
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.pgpainless.key.modification.secretkeyring.SecretKeyRingEditorInterface
SecretKeyRingEditorInterface.WithKeyRingEncryptionSettings, SecretKeyRingEditorInterface.WithPassphrase
-
-
Constructor Summary
Constructors Constructor Description SecretKeyRingEditor(org.bouncycastle.openpgp.PGPSecretKeyRing secretKeyRing)SecretKeyRingEditor(org.bouncycastle.openpgp.PGPSecretKeyRing secretKeyRing, java.util.Date referenceTime)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SecretKeyRingEditorInterfaceaddPrimaryUserId(java.lang.CharSequence userId, SecretKeyRingProtector protector)Add a user-id to the key ring and mark it as primary.SecretKeyRingEditorInterfaceaddSubKey(org.bouncycastle.openpgp.PGPKeyPair subkey, SelfSignatureSubpackets.Callback bindingSignatureCallback, SecretKeyRingProtector subkeyProtector, SecretKeyRingProtector primaryKeyProtector, KeyFlag keyFlag, KeyFlag... additionalKeyFlags)Add a subkey to the key ring.SecretKeyRingEditorInterfaceaddSubKey(KeySpec keySpec, Passphrase subKeyPassphrase, SecretKeyRingProtector secretKeyRingProtector)Add a subkey to the key ring.SecretKeyRingEditorInterfaceaddSubKey(KeySpec keySpec, Passphrase subkeyPassphrase, SelfSignatureSubpackets.Callback subpacketsCallback, SecretKeyRingProtector secretKeyRingProtector)Add a subkey to the key ring.SecretKeyRingEditorInterfaceaddUserId(java.lang.CharSequence userId, SecretKeyRingProtector secretKeyRingProtector)Add a user-id to the key ring.SecretKeyRingEditorInterfaceaddUserId(java.lang.CharSequence userId, SelfSignatureSubpackets.Callback signatureSubpacketCallback, SecretKeyRingProtector protector)Add a user-id to the key ring.SecretKeyRingEditorInterface.WithKeyRingEncryptionSettingschangePassphraseFromOldPassphrase(Passphrase oldPassphrase, KeyRingProtectionSettings oldProtectionSettings)Change the passphrase of the whole key ring.SecretKeyRingEditorInterface.WithKeyRingEncryptionSettingschangeSubKeyPassphraseFromOldPassphrase(java.lang.Long keyId, Passphrase oldPassphrase, KeyRingProtectionSettings oldProtectionSettings)org.bouncycastle.openpgp.PGPPublicKeyRingcreateMinimalRevocationCertificate(SecretKeyRingProtector secretKeyRingProtector, RevocationAttributes keyRevocationAttributes)Create a minimal, self-authorizing revocation certificate, containing only the primary key and a revocation signature.org.bouncycastle.openpgp.PGPSignaturecreateRevocation(long subkeyId, SecretKeyRingProtector secretKeyRingProtector, RevocationAttributes revocationAttributes)Create a detached revocation certificate, which can be used to revoke the specified subkey.org.bouncycastle.openpgp.PGPSignaturecreateRevocation(long subkeyId, SecretKeyRingProtector secretKeyRingProtector, RevocationSignatureSubpackets.Callback certificateSubpacketsCallback)Create a detached revocation certificate, which can be used to revoke the specified subkey.org.bouncycastle.openpgp.PGPSignaturecreateRevocation(SecretKeyRingProtector secretKeyRingProtector, RevocationAttributes revocationAttributes)Create a detached revocation certificate, which can be used to revoke the whole key.org.bouncycastle.openpgp.PGPSecretKeyRingdone()Return thePGPSecretKeyRing.java.util.DategetReferenceTime()Return the editors reference time.SecretKeyRingEditorInterfaceremoveUserId(java.lang.CharSequence userId, SecretKeyRingProtector protector)Convenience method to revoke a single user-id using a soft revocation signature.SecretKeyRingEditorInterfaceremoveUserId(SelectUserId userIdSelector, SecretKeyRingProtector protector)Convenience method to revoke selected user-ids using soft revocation signatures.SecretKeyRingEditorInterfacereplaceUserId(java.lang.CharSequence oldUserId, java.lang.CharSequence newUserId, SecretKeyRingProtector protector)Replace a user-id on the key with a new one.SecretKeyRingEditorInterfacerevoke(SecretKeyRingProtector secretKeyRingProtector, RevocationAttributes revocationAttributes)Revoke the key ring using the provided revocation attributes.SecretKeyRingEditorInterfacerevoke(SecretKeyRingProtector secretKeyRingProtector, RevocationSignatureSubpackets.Callback subpacketsCallback)Revoke the key ring.SecretKeyRingEditorInterfacerevokeSubKey(long subKeyId, SecretKeyRingProtector protector, RevocationAttributes revocationAttributes)Revoke the subkey binding signature of a subkey.SecretKeyRingEditorInterfacerevokeSubKey(long keyID, SecretKeyRingProtector secretKeyRingProtector, RevocationSignatureSubpackets.Callback subpacketsCallback)Revoke the subkey binding signature of a subkey.SecretKeyRingEditorInterfacerevokeUserId(java.lang.CharSequence userId, SecretKeyRingProtector secretKeyRingProtector, RevocationAttributes revocationAttributes)Revoke the given userID using the provided revocation attributes.SecretKeyRingEditorInterfacerevokeUserId(java.lang.CharSequence userId, SecretKeyRingProtector secretKeyRingProtector, RevocationSignatureSubpackets.Callback subpacketCallback)Revoke the provided user-id.SecretKeyRingEditorInterfacerevokeUserIds(SelectUserId userIdSelector, SecretKeyRingProtector secretKeyRingProtector, RevocationAttributes revocationAttributes)Revoke all user-ids that match the providedSelectUserIdfilter.SecretKeyRingEditorInterfacerevokeUserIds(SelectUserId userIdSelector, SecretKeyRingProtector secretKeyRingProtector, RevocationSignatureSubpackets.Callback subpacketsCallback)Revoke all user-ids that match the providedSelectUserIdfilter.SecretKeyRingEditorInterfacesetExpirationDate(java.util.Date expiration, SecretKeyRingProtector secretKeyRingProtector)Set the expiration date for the primary key of the key ring.SecretKeyRingEditorInterfacesetExpirationDateOfSubkey(java.util.Date expiration, long keyId, SecretKeyRingProtector secretKeyRingProtector)Set the expiration date for the subkey identified by the given keyId to the given expiration date.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.pgpainless.key.modification.secretkeyring.SecretKeyRingEditorInterface
changePassphraseFromOldPassphrase, changeSubKeyPassphraseFromOldPassphrase, createRevocation, revoke, revokeSubKey, revokeSubKey, revokeSubKey, revokeUserId
-
-
-
-
Method Detail
-
getReferenceTime
@Nonnull public java.util.Date getReferenceTime()
Description copied from interface:SecretKeyRingEditorInterfaceReturn the editors reference time.- Specified by:
getReferenceTimein interfaceSecretKeyRingEditorInterface- Returns:
- reference time
-
addUserId
public SecretKeyRingEditorInterface addUserId(@Nonnull java.lang.CharSequence userId, @Nonnull SecretKeyRingProtector secretKeyRingProtector) throws org.bouncycastle.openpgp.PGPException
Description copied from interface:SecretKeyRingEditorInterfaceAdd a user-id to the key ring.- Specified by:
addUserIdin interfaceSecretKeyRingEditorInterface- Parameters:
userId- user-idsecretKeyRingProtector- protector to unlock the secret key- Returns:
- the builder
- Throws:
org.bouncycastle.openpgp.PGPException- in case we cannot generate a signature for the user-id
-
addUserId
public SecretKeyRingEditorInterface addUserId(@Nonnull java.lang.CharSequence userId, @Nullable SelfSignatureSubpackets.Callback signatureSubpacketCallback, @Nonnull SecretKeyRingProtector protector) throws org.bouncycastle.openpgp.PGPException
Description copied from interface:SecretKeyRingEditorInterfaceAdd a user-id to the key ring.- Specified by:
addUserIdin interfaceSecretKeyRingEditorInterface- Parameters:
userId- user-idsignatureSubpacketCallback- callback that can be used to modify signature subpackets of the certification signature.protector- protector to unlock the primary secret key- Returns:
- the builder
- Throws:
org.bouncycastle.openpgp.PGPException- in case we cannot generate a signature for the user-id
-
addPrimaryUserId
public SecretKeyRingEditorInterface addPrimaryUserId(@Nonnull java.lang.CharSequence userId, @Nonnull SecretKeyRingProtector protector) throws org.bouncycastle.openpgp.PGPException
Description copied from interface:SecretKeyRingEditorInterfaceAdd a user-id to the key ring and mark it as primary. If the user-id is already present, a new certification signature will be created.- Specified by:
addPrimaryUserIdin interfaceSecretKeyRingEditorInterface- Parameters:
userId- user idprotector- protector to unlock the secret key- Returns:
- the builder
- Throws:
org.bouncycastle.openpgp.PGPException- in case we cannot generate a signature for the user-id
-
removeUserId
public SecretKeyRingEditorInterface removeUserId(SelectUserId userIdSelector, SecretKeyRingProtector protector) throws org.bouncycastle.openpgp.PGPException
Description copied from interface:SecretKeyRingEditorInterfaceConvenience method to revoke selected user-ids using soft revocation signatures. The revocation will useRevocationAttributes.Reason.USER_ID_NO_LONGER_VALID, so that the user-id can be re-certified at a later point.- Specified by:
removeUserIdin interfaceSecretKeyRingEditorInterface- Parameters:
userIdSelector- selector to select user-idsprotector- protector to unlock the primary key- Returns:
- the builder
- Throws:
org.bouncycastle.openpgp.PGPException- in case we cannot generate a revocation signature for the user-id
-
removeUserId
public SecretKeyRingEditorInterface removeUserId(java.lang.CharSequence userId, SecretKeyRingProtector protector) throws org.bouncycastle.openpgp.PGPException
Description copied from interface:SecretKeyRingEditorInterfaceConvenience method to revoke a single user-id using a soft revocation signature. The revocation will useRevocationAttributes.Reason.USER_ID_NO_LONGER_VALID. so that the user-id can be re-certified at a later point.- Specified by:
removeUserIdin interfaceSecretKeyRingEditorInterface- Parameters:
userId- user-id to revokeprotector- protector to unlock the primary key- Returns:
- the builder
- Throws:
org.bouncycastle.openpgp.PGPException- in case we cannot generate a revocation signature for the user-id
-
replaceUserId
public SecretKeyRingEditorInterface replaceUserId(@Nonnull java.lang.CharSequence oldUserId, @Nonnull java.lang.CharSequence newUserId, @Nonnull SecretKeyRingProtector protector) throws org.bouncycastle.openpgp.PGPException
Description copied from interface:SecretKeyRingEditorInterfaceReplace a user-id on the key with a new one. The old user-id gets soft revoked and the new user-id gets bound with the same signature subpackets as the old one, with one exception: If the old user-id was implicitly primary (did not carry aPrimaryUserIDpacket, but effectively was primary, then the new user-id will be explicitly marked as primary.- Specified by:
replaceUserIdin interfaceSecretKeyRingEditorInterface- Parameters:
oldUserId- old user-idnewUserId- new user-idprotector- protector to unlock the secret key- Returns:
- the builder
- Throws:
org.bouncycastle.openpgp.PGPException- in case we cannot generate a revocation and certification signature
-
addSubKey
public SecretKeyRingEditorInterface addSubKey(@Nonnull KeySpec keySpec, @Nonnull Passphrase subKeyPassphrase, @Nonnull SecretKeyRingProtector secretKeyRingProtector) throws java.security.InvalidAlgorithmParameterException, java.security.NoSuchAlgorithmException, org.bouncycastle.openpgp.PGPException, java.io.IOException
Description copied from interface:SecretKeyRingEditorInterfaceAdd a subkey to the key ring. The subkey will be generated from the providedKeySpec.- Specified by:
addSubKeyin interfaceSecretKeyRingEditorInterface- Parameters:
keySpec- key specificationsubKeyPassphrase- passphrase to encrypt the sub keysecretKeyRingProtector- protector to unlock the secret key of the key ring- Returns:
- the builder
- Throws:
java.security.InvalidAlgorithmParameterException- in case the user wants to use invalid parameters for the keyjava.security.NoSuchAlgorithmException- in case of missing algorithm support in the crypto backendorg.bouncycastle.openpgp.PGPException- in case we cannot generate a binding signature for the subkeyjava.io.IOException- in case of an IO error
-
addSubKey
public SecretKeyRingEditorInterface addSubKey(@Nonnull KeySpec keySpec, @Nullable Passphrase subkeyPassphrase, @Nullable SelfSignatureSubpackets.Callback subpacketsCallback, @Nonnull SecretKeyRingProtector secretKeyRingProtector) throws org.bouncycastle.openpgp.PGPException, java.security.InvalidAlgorithmParameterException, java.security.NoSuchAlgorithmException, java.io.IOException
Description copied from interface:SecretKeyRingEditorInterfaceAdd a subkey to the key ring. The subkey will be generated from the providedKeySpec.- Specified by:
addSubKeyin interfaceSecretKeyRingEditorInterface- Parameters:
keySpec- key spec of the subkeysubkeyPassphrase- passphrase to encrypt the subkeysubpacketsCallback- callback to modify the subpackets of the subkey binding signaturesecretKeyRingProtector- protector to unlock the primary key- Returns:
- builder
- Throws:
org.bouncycastle.openpgp.PGPException- in case we cannot generate a binding signature for the subkeyjava.security.InvalidAlgorithmParameterException- in case the user wants to use invalid parameters for the keyjava.security.NoSuchAlgorithmException- in case of missing algorithm support in the crypto backendjava.io.IOException- in case of an IO error
-
addSubKey
public SecretKeyRingEditorInterface addSubKey(@Nonnull org.bouncycastle.openpgp.PGPKeyPair subkey, @Nullable SelfSignatureSubpackets.Callback bindingSignatureCallback, @Nonnull SecretKeyRingProtector subkeyProtector, @Nonnull SecretKeyRingProtector primaryKeyProtector, @Nonnull KeyFlag keyFlag, KeyFlag... additionalKeyFlags) throws org.bouncycastle.openpgp.PGPException, java.io.IOException
Description copied from interface:SecretKeyRingEditorInterfaceAdd a subkey to the key ring.- Specified by:
addSubKeyin interfaceSecretKeyRingEditorInterface- Parameters:
subkey- subkey key pairbindingSignatureCallback- callback to modify the subpackets of the subkey binding signaturesubkeyProtector- protector to unlock and encrypt the subkeyprimaryKeyProtector- protector to unlock the primary keykeyFlag- first key flag for the subkeyadditionalKeyFlags- optional additional key flags- Returns:
- builder
- Throws:
org.bouncycastle.openpgp.PGPException- in case we cannot generate a binding signature for the subkeyjava.io.IOException- in case of an IO error
-
revoke
public SecretKeyRingEditorInterface revoke(@Nonnull SecretKeyRingProtector secretKeyRingProtector, @Nullable RevocationAttributes revocationAttributes) throws org.bouncycastle.openpgp.PGPException
Description copied from interface:SecretKeyRingEditorInterfaceRevoke the key ring using the provided revocation attributes. The attributes define, whether the revocation was a hard revocation or not.- Specified by:
revokein interfaceSecretKeyRingEditorInterface- Parameters:
secretKeyRingProtector- protector of the primary keyrevocationAttributes- reason for the revocation- Returns:
- the builder
- Throws:
org.bouncycastle.openpgp.PGPException- in case we cannot generate a revocation signature
-
revoke
public SecretKeyRingEditorInterface revoke(@Nonnull SecretKeyRingProtector secretKeyRingProtector, @Nullable RevocationSignatureSubpackets.Callback subpacketsCallback) throws org.bouncycastle.openpgp.PGPException
Description copied from interface:SecretKeyRingEditorInterfaceRevoke the key ring. You can use theRevocationSignatureSubpackets.Callbackto modify the revocation signatures subpackets, e.g. in order to define whether this is a hard or soft revocation.- Specified by:
revokein interfaceSecretKeyRingEditorInterface- Parameters:
secretKeyRingProtector- protector to unlock the primary secret keysubpacketsCallback- callback to modify the revocations subpackets- Returns:
- builder
- Throws:
org.bouncycastle.openpgp.PGPException- in case we cannot generate a revocation signature
-
revokeSubKey
public SecretKeyRingEditorInterface revokeSubKey(long subKeyId, SecretKeyRingProtector protector, RevocationAttributes revocationAttributes) throws org.bouncycastle.openpgp.PGPException
Description copied from interface:SecretKeyRingEditorInterfaceRevoke the subkey binding signature of a subkey. The subkey with the provided key-id will be revoked. If no suitable subkey is found, aNoSuchElementExceptionwill be thrown.- Specified by:
revokeSubKeyin interfaceSecretKeyRingEditorInterface- Parameters:
subKeyId- id of the subkeyprotector- protector to unlock the primary keyrevocationAttributes- reason for the revocation- Returns:
- the builder
- Throws:
org.bouncycastle.openpgp.PGPException- in case we cannot generate a revocation signature for the subkey
-
revokeSubKey
public SecretKeyRingEditorInterface revokeSubKey(long keyID, @Nonnull SecretKeyRingProtector secretKeyRingProtector, @Nullable RevocationSignatureSubpackets.Callback subpacketsCallback) throws org.bouncycastle.openpgp.PGPException
Description copied from interface:SecretKeyRingEditorInterfaceRevoke the subkey binding signature of a subkey. The subkey with the provided key-id will be revoked. If no suitable subkey is found, qNoSuchElementExceptionwill be thrown. The provided subpackets callback is used to modify the revocation signatures subpackets.- Specified by:
revokeSubKeyin interfaceSecretKeyRingEditorInterface- Parameters:
keyID- id of the subkeysecretKeyRingProtector- protector to unlock the secret key ringsubpacketsCallback- callback which can be used to modify the subpackets of the revocation signature- Returns:
- the builder
- Throws:
org.bouncycastle.openpgp.PGPException- in case we cannot generate a revocation signature for the subkey
-
createRevocation
public org.bouncycastle.openpgp.PGPSignature createRevocation(@Nonnull SecretKeyRingProtector secretKeyRingProtector, @Nullable RevocationAttributes revocationAttributes) throws org.bouncycastle.openpgp.PGPExceptionDescription copied from interface:SecretKeyRingEditorInterfaceCreate a detached revocation certificate, which can be used to revoke the whole key. The original key will not be modified by this method.- Specified by:
createRevocationin interfaceSecretKeyRingEditorInterface- Parameters:
secretKeyRingProtector- protector to unlock the primary key.revocationAttributes- reason for the revocation- Returns:
- revocation certificate
- Throws:
org.bouncycastle.openpgp.PGPException- in case we cannot generate a revocation certificate
-
createRevocation
public org.bouncycastle.openpgp.PGPSignature createRevocation(long subkeyId, @Nonnull SecretKeyRingProtector secretKeyRingProtector, @Nullable RevocationAttributes revocationAttributes) throws org.bouncycastle.openpgp.PGPExceptionDescription copied from interface:SecretKeyRingEditorInterfaceCreate a detached revocation certificate, which can be used to revoke the specified subkey. The original key will not be modified by this method.- Specified by:
createRevocationin interfaceSecretKeyRingEditorInterface- Parameters:
subkeyId- id of the subkey to be revokedsecretKeyRingProtector- protector to unlock the primary key.revocationAttributes- reason for the revocation- Returns:
- revocation certificate
- Throws:
org.bouncycastle.openpgp.PGPException- in case we cannot generate a revocation certificate
-
createRevocation
public org.bouncycastle.openpgp.PGPSignature createRevocation(long subkeyId, @Nonnull SecretKeyRingProtector secretKeyRingProtector, @Nullable RevocationSignatureSubpackets.Callback certificateSubpacketsCallback) throws org.bouncycastle.openpgp.PGPExceptionDescription copied from interface:SecretKeyRingEditorInterfaceCreate a detached revocation certificate, which can be used to revoke the specified subkey. The original key will not be modified by this method.- Specified by:
createRevocationin interfaceSecretKeyRingEditorInterface- Parameters:
subkeyId- id of the subkey to be revokedsecretKeyRingProtector- protector to unlock the primary key.certificateSubpacketsCallback- callback to modify the subpackets of the revocation certificate.- Returns:
- revocation certificate
- Throws:
org.bouncycastle.openpgp.PGPException- in case we cannot generate a revocation certificate
-
revokeUserId
public SecretKeyRingEditorInterface revokeUserId(@Nonnull java.lang.CharSequence userId, @Nonnull SecretKeyRingProtector secretKeyRingProtector, @Nullable RevocationAttributes revocationAttributes) throws org.bouncycastle.openpgp.PGPException
Description copied from interface:SecretKeyRingEditorInterfaceRevoke the given userID using the provided revocation attributes.- Specified by:
revokeUserIdin interfaceSecretKeyRingEditorInterface- Parameters:
userId- userId to revokesecretKeyRingProtector- protector to unlock the primary keyrevocationAttributes- reason for the revocation- Returns:
- the builder
- Throws:
org.bouncycastle.openpgp.PGPException- in case we cannot generate a revocation signature for the user-id
-
revokeUserId
public SecretKeyRingEditorInterface revokeUserId(@Nonnull java.lang.CharSequence userId, @Nonnull SecretKeyRingProtector secretKeyRingProtector, @Nullable RevocationSignatureSubpackets.Callback subpacketCallback) throws org.bouncycastle.openpgp.PGPException
Description copied from interface:SecretKeyRingEditorInterfaceRevoke the provided user-id. Note: If you don't provide aRevocationSignatureSubpackets.Callbackwhich sets a revocation reason (RevocationAttributes), the revocation might be considered hard. So if you intend to re-certify the user-id at a later point to make it valid again, make sure to set a soft revocation reason in the signatures hashed area using the subpacket callback.- Specified by:
revokeUserIdin interfaceSecretKeyRingEditorInterface- Parameters:
userId- userid to be revokedsecretKeyRingProtector- protector to unlock the primary secret keysubpacketCallback- callback to modify the revocations subpackets- Returns:
- builder
- Throws:
org.bouncycastle.openpgp.PGPException- in case we cannot generate a revocation signature for the user-id
-
revokeUserIds
public SecretKeyRingEditorInterface revokeUserIds(@Nonnull SelectUserId userIdSelector, @Nonnull SecretKeyRingProtector secretKeyRingProtector, @Nullable RevocationAttributes revocationAttributes) throws org.bouncycastle.openpgp.PGPException
Description copied from interface:SecretKeyRingEditorInterfaceRevoke all user-ids that match the providedSelectUserIdfilter. The providedRevocationAttributeswill be set as reason for revocation in each revocation signature. Note: If you intend to re-certify these user-ids at a later point, make sure to choose a soft revocation reason. SeeRevocationAttributes.Reasonfor more information.- Specified by:
revokeUserIdsin interfaceSecretKeyRingEditorInterface- Parameters:
userIdSelector- user-id selectorsecretKeyRingProtector- protector to unlock the primary secret keyrevocationAttributes- revocation attributes- Returns:
- builder
- Throws:
org.bouncycastle.openpgp.PGPException- in case we cannot generate a revocation signature for the user-id
-
revokeUserIds
public SecretKeyRingEditorInterface revokeUserIds(@Nonnull SelectUserId userIdSelector, @Nonnull SecretKeyRingProtector secretKeyRingProtector, @Nullable RevocationSignatureSubpackets.Callback subpacketsCallback) throws org.bouncycastle.openpgp.PGPException
Description copied from interface:SecretKeyRingEditorInterfaceRevoke all user-ids that match the providedSelectUserIdfilter. The providedRevocationSignatureSubpackets.Callbackwill be used to modify the revocation signatures subpackets. Note: If you intend to re-certify these user-ids at a later point, make sure to set a soft revocation reason in the revocation signatures hashed subpacket area using the callback. SeeRevocationAttributes.Reasonfor more information.- Specified by:
revokeUserIdsin interfaceSecretKeyRingEditorInterface- Parameters:
userIdSelector- user-id selectorsecretKeyRingProtector- protector to unlock the primary secret keysubpacketsCallback- callback to modify the revocations subpackets- Returns:
- builder
- Throws:
org.bouncycastle.openpgp.PGPException- in case we cannot generate a revocation signature for the user-id
-
setExpirationDate
public SecretKeyRingEditorInterface setExpirationDate(@Nullable java.util.Date expiration, @Nonnull SecretKeyRingProtector secretKeyRingProtector) throws org.bouncycastle.openpgp.PGPException
Description copied from interface:SecretKeyRingEditorInterfaceSet the expiration date for the primary key of the key ring. If the key is supposed to never expire, then an expiration date of null is expected.- Specified by:
setExpirationDatein interfaceSecretKeyRingEditorInterface- Parameters:
expiration- new expiration date or nullsecretKeyRingProtector- to unlock the secret key- Returns:
- the builder
- Throws:
org.bouncycastle.openpgp.PGPException- in case we cannot generate a new self-signature with the changed expiration date
-
setExpirationDateOfSubkey
public SecretKeyRingEditorInterface setExpirationDateOfSubkey(@Nullable java.util.Date expiration, long keyId, @Nonnull SecretKeyRingProtector secretKeyRingProtector) throws org.bouncycastle.openpgp.PGPException
Description copied from interface:SecretKeyRingEditorInterfaceSet the expiration date for the subkey identified by the given keyId to the given expiration date. If the key is supposed to never expire, then an expiration date of null is expected.- Specified by:
setExpirationDateOfSubkeyin interfaceSecretKeyRingEditorInterface- Parameters:
expiration- new expiration date of nullkeyId- id of the subkeysecretKeyRingProtector- to unlock the secret key- Returns:
- the builder
- Throws:
org.bouncycastle.openpgp.PGPException- in case we cannot generate a new subkey-binding or self-signature with the changed expiration date
-
createMinimalRevocationCertificate
public org.bouncycastle.openpgp.PGPPublicKeyRing createMinimalRevocationCertificate(@Nonnull SecretKeyRingProtector secretKeyRingProtector, @Nullable RevocationAttributes keyRevocationAttributes) throws org.bouncycastle.openpgp.PGPExceptionDescription copied from interface:SecretKeyRingEditorInterfaceCreate a minimal, self-authorizing revocation certificate, containing only the primary key and a revocation signature. This type of revocation certificates was introduced in OpenPGP v6. This method has no side effects on the original key and will leave it intact.- Specified by:
createMinimalRevocationCertificatein interfaceSecretKeyRingEditorInterface- Parameters:
secretKeyRingProtector- protector to unlock the primary key.keyRevocationAttributes- reason for the revocation (key revocation)- Returns:
- minimal revocation certificate
- Throws:
org.bouncycastle.openpgp.PGPException- in case we cannot generate a revocation signature
-
changePassphraseFromOldPassphrase
public SecretKeyRingEditorInterface.WithKeyRingEncryptionSettings changePassphraseFromOldPassphrase(@Nullable Passphrase oldPassphrase, @Nonnull KeyRingProtectionSettings oldProtectionSettings)
Description copied from interface:SecretKeyRingEditorInterfaceChange the passphrase of the whole key ring.- Specified by:
changePassphraseFromOldPassphrasein interfaceSecretKeyRingEditorInterface- Parameters:
oldPassphrase- old passphrase or null, if the key was unprotectedoldProtectionSettings- custom settings for the old passphrase- Returns:
- next builder step
-
changeSubKeyPassphraseFromOldPassphrase
public SecretKeyRingEditorInterface.WithKeyRingEncryptionSettings changeSubKeyPassphraseFromOldPassphrase(@Nonnull java.lang.Long keyId, @Nullable Passphrase oldPassphrase, @Nonnull KeyRingProtectionSettings oldProtectionSettings)
- Specified by:
changeSubKeyPassphraseFromOldPassphrasein interfaceSecretKeyRingEditorInterface
-
done
public org.bouncycastle.openpgp.PGPSecretKeyRing done()
Description copied from interface:SecretKeyRingEditorInterfaceReturn thePGPSecretKeyRing.- Specified by:
donein interfaceSecretKeyRingEditorInterface- Returns:
- the key
-
-