Interface SecretKeyRingEditorInterface
-
- All Known Implementing Classes:
SecretKeyRingEditor
public interface SecretKeyRingEditorInterface
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interfaceSecretKeyRingEditorInterface.WithKeyRingEncryptionSettingsstatic interfaceSecretKeyRingEditorInterface.WithPassphrase
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description SecretKeyRingEditorInterfaceaddSubKey(org.bouncycastle.openpgp.PGPSecretKey subKey, SecretKeyRingProtector subKeyProtector, SecretKeyRingProtector keyRingProtector)SecretKeyRingEditorInterfaceaddSubKey(KeySpec keySpec, Passphrase subKeyPassphrase, SecretKeyRingProtector secretKeyRingProtector)Add a subkey to the key ring.SecretKeyRingEditorInterfaceaddUserId(long keyId, java.lang.String userId, SecretKeyRingProtector secretKeyRingProtector)default SecretKeyRingEditorInterfaceaddUserId(long keyId, UserId userId, SecretKeyRingProtector secretKeyRingProtector)SecretKeyRingEditorInterfaceaddUserId(java.lang.String userId, SecretKeyRingProtector secretKeyRingProtector)Add a user-id to the primary key of the key ring.default SecretKeyRingEditorInterfaceaddUserId(OpenPgpV4Fingerprint fingerprint, java.lang.String userId, SecretKeyRingProtector secretKeyRingProtector)default SecretKeyRingEditorInterfaceaddUserId(OpenPgpV4Fingerprint fingerprint, UserId userId, SecretKeyRingProtector secretKeyRingProtector)default SecretKeyRingEditorInterfaceaddUserId(UserId userId, SecretKeyRingProtector secretKeyRingProtector)default SecretKeyRingEditorInterface.WithKeyRingEncryptionSettingschangePassphraseFromOldPassphrase(Passphrase oldPassphrase)Change the passphrase of the whole key ring.SecretKeyRingEditorInterface.WithKeyRingEncryptionSettingschangePassphraseFromOldPassphrase(Passphrase oldPassphrase, KeyRingProtectionSettings oldProtectionSettings)Change the passphrase of the whole key ring.default SecretKeyRingEditorInterface.WithKeyRingEncryptionSettingschangeSubKeyPassphraseFromOldPassphrase(java.lang.Long keyId, Passphrase oldPassphrase)Change the passphrase of a single subkey in the key ring.SecretKeyRingEditorInterface.WithKeyRingEncryptionSettingschangeSubKeyPassphraseFromOldPassphrase(java.lang.Long keyId, Passphrase oldPassphrase, KeyRingProtectionSettings oldProtectionSettings)org.bouncycastle.openpgp.PGPSignaturecreateRevocationCertificate(long subKeyId, SecretKeyRingProtector secretKeyRingProtector, RevocationAttributes revocationAttributes)Create a detached revocation certificate, which can be used to revoke the specified key.org.bouncycastle.openpgp.PGPSignaturecreateRevocationCertificate(OpenPgpV4Fingerprint fingerprint, SecretKeyRingProtector secretKeyRingProtector, RevocationAttributes revocationAttributes)Create a detached revocation certificate, which can be used to revoke the specified key.SecretKeyRingEditorInterfacedeleteSubKey(long subKeyId, SecretKeyRingProtector secretKeyRingProtector)Delete a subkey from the key ring.SecretKeyRingEditorInterfacedeleteSubKey(OpenPgpV4Fingerprint fingerprint, SecretKeyRingProtector secretKeyRingProtector)Delete a subkey from the key ring.default SecretKeyRingEditorInterfacedeleteUserId(long keyId, java.lang.String userId, SecretKeyRingProtector secretKeyRingProtector)SecretKeyRingEditorInterfacedeleteUserId(java.lang.String userId, SecretKeyRingProtector secretKeyRingProtector)Remove a user-id from the primary key of the key ring.default SecretKeyRingEditorInterfacedeleteUserId(OpenPgpV4Fingerprint fingerprint, java.lang.String userId, SecretKeyRingProtector secretKeyRingProtector)SecretKeyRingEditorInterfacedeleteUserIds(long keyId, SelectUserId selectionStrategy, SecretKeyRingProtector secretKeyRingProtector)default SecretKeyRingEditorInterfacedeleteUserIds(OpenPgpV4Fingerprint fingerprint, SelectUserId selectionStrategy, SecretKeyRingProtector secretKeyRingProtector)SecretKeyRingEditorInterfacedeleteUserIds(SelectUserId selectionStrategy, SecretKeyRingProtector secretKeyRingProtector)org.bouncycastle.openpgp.PGPSecretKeyRingdone()Return thePGPSecretKeyRing.default SecretKeyRingEditorInterfacerevoke(SecretKeyRingProtector secretKeyRingProtector)Revoke the key ring.SecretKeyRingEditorInterfacerevoke(SecretKeyRingProtector secretKeyRingProtector, RevocationAttributes revocationAttributes)Revoke the key ring.default SecretKeyRingEditorInterfacerevokeSubKey(long subKeyId, SecretKeyRingProtector secretKeyRingProtector)Revoke the subkey binding signature of a subkey.SecretKeyRingEditorInterfacerevokeSubKey(long subKeyId, SecretKeyRingProtector secretKeyRingProtector, RevocationAttributes revocationAttributes)Revoke the subkey binding signature of a subkey.default SecretKeyRingEditorInterfacerevokeSubKey(OpenPgpV4Fingerprint fingerprint, SecretKeyRingProtector secretKeyRingProtector)Revoke the subkey binding signature of a subkey.SecretKeyRingEditorInterfacerevokeSubKey(OpenPgpV4Fingerprint fingerprint, SecretKeyRingProtector secretKeyRingProtector, RevocationAttributes revocationAttributes)Revoke the subkey binding signature of a subkey.default SecretKeyRingEditorInterfacerevokeUserId(java.lang.String userId, long subKeyId, SecretKeyRingProtector secretKeyRingProtector)Revoke the given userID on the key that belongs to the given key ID.SecretKeyRingEditorInterfacerevokeUserId(java.lang.String userId, long subkeyId, SecretKeyRingProtector secretKeyRingProtector, RevocationAttributes revocationAttributes)Revoke the given userID on the key that belongs to the given key ID.default SecretKeyRingEditorInterfacerevokeUserId(java.lang.String userId, OpenPgpV4Fingerprint subkeyFingerprint, SecretKeyRingProtector secretKeyRingProtector)Revoke the given userID on the key that belongs to the given fingerprint.SecretKeyRingEditorInterfacerevokeUserId(java.lang.String userId, OpenPgpV4Fingerprint subkeyFingerprint, SecretKeyRingProtector secretKeyRingProtector, RevocationAttributes revocationAttributes)Revoke the given userID on the key that belongs to the given fingerprint.default SecretKeyRingEditorInterfacerevokeUserIdOnAllSubkeys(java.lang.String userId, SecretKeyRingProtector secretKeyRingProtector)Revoke the given userID on any key in the key ring that is currently carrying the userID.SecretKeyRingEditorInterfacerevokeUserIdOnAllSubkeys(java.lang.String userId, SecretKeyRingProtector secretKeyRingProtector, RevocationAttributes revocationAttributes)Revoke the given userID on any key in the key ring that is currently carrying the userID.SecretKeyRingEditorInterfacesetExpirationDate(java.util.Date expiration, SecretKeyRingProtector secretKeyRingProtector)Set the expiration date for the primary key of the key ring.SecretKeyRingEditorInterfacesetExpirationDate(OpenPgpV4Fingerprint fingerprint, java.util.Date expiration, SecretKeyRingProtector secretKeyRingProtector)Set key expiration time.
-
-
-
Method Detail
-
addUserId
default SecretKeyRingEditorInterface addUserId(UserId userId, SecretKeyRingProtector secretKeyRingProtector) throws org.bouncycastle.openpgp.PGPException
- Throws:
org.bouncycastle.openpgp.PGPException
-
addUserId
SecretKeyRingEditorInterface addUserId(java.lang.String userId, SecretKeyRingProtector secretKeyRingProtector) throws org.bouncycastle.openpgp.PGPException
Add a user-id to the primary key of the key ring.- Parameters:
userId- user-idsecretKeyRingProtector- protector to unlock the secret key- Returns:
- the builder
- Throws:
org.bouncycastle.openpgp.PGPException
-
addUserId
default SecretKeyRingEditorInterface addUserId(OpenPgpV4Fingerprint fingerprint, UserId userId, SecretKeyRingProtector secretKeyRingProtector) throws org.bouncycastle.openpgp.PGPException
- Throws:
org.bouncycastle.openpgp.PGPException
-
addUserId
default SecretKeyRingEditorInterface addUserId(OpenPgpV4Fingerprint fingerprint, java.lang.String userId, SecretKeyRingProtector secretKeyRingProtector) throws org.bouncycastle.openpgp.PGPException
- Throws:
org.bouncycastle.openpgp.PGPException
-
addUserId
default SecretKeyRingEditorInterface addUserId(long keyId, UserId userId, SecretKeyRingProtector secretKeyRingProtector) throws org.bouncycastle.openpgp.PGPException
- Throws:
org.bouncycastle.openpgp.PGPException
-
addUserId
SecretKeyRingEditorInterface addUserId(long keyId, java.lang.String userId, SecretKeyRingProtector secretKeyRingProtector) throws org.bouncycastle.openpgp.PGPException
- Throws:
org.bouncycastle.openpgp.PGPException
-
deleteUserId
SecretKeyRingEditorInterface deleteUserId(java.lang.String userId, SecretKeyRingProtector secretKeyRingProtector)
Remove a user-id from the primary key of the key ring.- Parameters:
userId- exact user-id to be removedsecretKeyRingProtector- protector to unlock the secret key- Returns:
- the builder
-
deleteUserId
default SecretKeyRingEditorInterface deleteUserId(OpenPgpV4Fingerprint fingerprint, java.lang.String userId, SecretKeyRingProtector secretKeyRingProtector)
-
deleteUserId
default SecretKeyRingEditorInterface deleteUserId(long keyId, java.lang.String userId, SecretKeyRingProtector secretKeyRingProtector)
-
deleteUserIds
SecretKeyRingEditorInterface deleteUserIds(SelectUserId selectionStrategy, SecretKeyRingProtector secretKeyRingProtector)
-
deleteUserIds
default SecretKeyRingEditorInterface deleteUserIds(OpenPgpV4Fingerprint fingerprint, SelectUserId selectionStrategy, SecretKeyRingProtector secretKeyRingProtector)
-
deleteUserIds
SecretKeyRingEditorInterface deleteUserIds(long keyId, SelectUserId selectionStrategy, SecretKeyRingProtector secretKeyRingProtector)
-
addSubKey
SecretKeyRingEditorInterface addSubKey(@Nonnull KeySpec keySpec, @Nonnull Passphrase subKeyPassphrase, SecretKeyRingProtector secretKeyRingProtector) throws java.security.InvalidAlgorithmParameterException, java.security.NoSuchAlgorithmException, org.bouncycastle.openpgp.PGPException
Add a subkey to the key ring. The subkey will be generated from the providedKeySpec.- 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.InvalidAlgorithmParameterExceptionjava.security.NoSuchAlgorithmExceptionorg.bouncycastle.openpgp.PGPException
-
addSubKey
SecretKeyRingEditorInterface addSubKey(org.bouncycastle.openpgp.PGPSecretKey subKey, SecretKeyRingProtector subKeyProtector, SecretKeyRingProtector keyRingProtector) throws org.bouncycastle.openpgp.PGPException
- Throws:
org.bouncycastle.openpgp.PGPException
-
deleteSubKey
SecretKeyRingEditorInterface deleteSubKey(OpenPgpV4Fingerprint fingerprint, SecretKeyRingProtector secretKeyRingProtector)
Delete a subkey from the key ring. The subkey with the provided fingerprint will be remove from the key ring. If no suitable subkey is found, aNoSuchElementExceptionwill be thrown.- Parameters:
fingerprint- fingerprint of the subkey to be removedsecretKeyRingProtector- protector to unlock the secret key ring- Returns:
- the builder
-
deleteSubKey
SecretKeyRingEditorInterface deleteSubKey(long subKeyId, SecretKeyRingProtector secretKeyRingProtector)
Delete a subkey from the key ring. The subkey with the provided key-id will be removed from the key ring. If no suitable subkey is found, aNoSuchElementExceptionwill be thrown.- Parameters:
subKeyId- id of the subkeysecretKeyRingProtector- protector to unlock the secret key ring- Returns:
- the builder
-
revoke
default SecretKeyRingEditorInterface revoke(SecretKeyRingProtector secretKeyRingProtector) throws org.bouncycastle.openpgp.PGPException
Revoke the key ring.- Parameters:
secretKeyRingProtector- protector of the primary key- Returns:
- the builder
- Throws:
org.bouncycastle.openpgp.PGPException
-
revoke
SecretKeyRingEditorInterface revoke(SecretKeyRingProtector secretKeyRingProtector, RevocationAttributes revocationAttributes) throws org.bouncycastle.openpgp.PGPException
Revoke the key ring.- Parameters:
secretKeyRingProtector- protector of the primary keyrevocationAttributes- reason for the revocation- Returns:
- the builder
- Throws:
org.bouncycastle.openpgp.PGPException
-
revokeSubKey
default SecretKeyRingEditorInterface revokeSubKey(OpenPgpV4Fingerprint fingerprint, SecretKeyRingProtector secretKeyRingProtector) throws org.bouncycastle.openpgp.PGPException
Revoke the subkey binding signature of a subkey. The subkey with the provided fingerprint will be revoked. If no suitable subkey is found, aNoSuchElementExceptionwill be thrown.- Parameters:
fingerprint- fingerprint of the subkey to be revokedsecretKeyRingProtector- protector to unlock the secret key ring- Returns:
- the builder
- Throws:
org.bouncycastle.openpgp.PGPException
-
revokeSubKey
SecretKeyRingEditorInterface revokeSubKey(OpenPgpV4Fingerprint fingerprint, SecretKeyRingProtector secretKeyRingProtector, RevocationAttributes revocationAttributes) throws org.bouncycastle.openpgp.PGPException
Revoke the subkey binding signature of a subkey. The subkey with the provided fingerprint will be revoked. If no suitable subkey is found, aNoSuchElementExceptionwill be thrown.- Parameters:
fingerprint- fingerprint of the subkey to be revokedsecretKeyRingProtector- protector to unlock the primary keyrevocationAttributes- reason for the revocation- Returns:
- the builder
- Throws:
org.bouncycastle.openpgp.PGPException
-
revokeSubKey
default SecretKeyRingEditorInterface revokeSubKey(long subKeyId, SecretKeyRingProtector secretKeyRingProtector) throws org.bouncycastle.openpgp.PGPException
Revoke 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.- Parameters:
subKeyId- id of the subkeysecretKeyRingProtector- protector to unlock the secret key ring- Returns:
- the builder
- Throws:
org.bouncycastle.openpgp.PGPException
-
revokeSubKey
SecretKeyRingEditorInterface revokeSubKey(long subKeyId, SecretKeyRingProtector secretKeyRingProtector, RevocationAttributes revocationAttributes) throws org.bouncycastle.openpgp.PGPException
Revoke 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.- Parameters:
subKeyId- id of the subkeysecretKeyRingProtector- protector to unlock the primary keyrevocationAttributes- reason for the revocation- Returns:
- the builder
- Throws:
org.bouncycastle.openpgp.PGPException
-
revokeUserIdOnAllSubkeys
default SecretKeyRingEditorInterface revokeUserIdOnAllSubkeys(java.lang.String userId, SecretKeyRingProtector secretKeyRingProtector) throws org.bouncycastle.openpgp.PGPException
Revoke the given userID on any key in the key ring that is currently carrying the userID.- Parameters:
userId- userId to revokesecretKeyRingProtector- protector to unlock the primary key- Returns:
- the builder
- Throws:
org.bouncycastle.openpgp.PGPException
-
revokeUserIdOnAllSubkeys
SecretKeyRingEditorInterface revokeUserIdOnAllSubkeys(java.lang.String userId, SecretKeyRingProtector secretKeyRingProtector, RevocationAttributes revocationAttributes) throws org.bouncycastle.openpgp.PGPException
Revoke the given userID on any key in the key ring that is currently carrying the userID.- Parameters:
userId- userId to revokesecretKeyRingProtector- protector to unlock the primary keyrevocationAttributes- reason for the revocation- Returns:
- the builder
- Throws:
org.bouncycastle.openpgp.PGPException
-
revokeUserId
default SecretKeyRingEditorInterface revokeUserId(java.lang.String userId, OpenPgpV4Fingerprint subkeyFingerprint, SecretKeyRingProtector secretKeyRingProtector) throws org.bouncycastle.openpgp.PGPException
Revoke the given userID on the key that belongs to the given fingerprint.- Parameters:
userId- userId to revokesubkeyFingerprint- fingerprint of the key on which the userID should be revokedsecretKeyRingProtector- protector to unlock the primary key- Returns:
- the builder
- Throws:
org.bouncycastle.openpgp.PGPException
-
revokeUserId
SecretKeyRingEditorInterface revokeUserId(java.lang.String userId, OpenPgpV4Fingerprint subkeyFingerprint, SecretKeyRingProtector secretKeyRingProtector, RevocationAttributes revocationAttributes) throws org.bouncycastle.openpgp.PGPException
Revoke the given userID on the key that belongs to the given fingerprint.- Parameters:
userId- userId to revokesubkeyFingerprint- fingerprint of the key on which the userID should be revokedsecretKeyRingProtector- protector to unlock the primary keyrevocationAttributes- reason for the revocation- Returns:
- the builder
- Throws:
org.bouncycastle.openpgp.PGPException
-
revokeUserId
default SecretKeyRingEditorInterface revokeUserId(java.lang.String userId, long subKeyId, SecretKeyRingProtector secretKeyRingProtector) throws org.bouncycastle.openpgp.PGPException
Revoke the given userID on the key that belongs to the given key ID.- Parameters:
userId- userId to revokesubKeyId- ID of the subkey on which we the userID should be revokedsecretKeyRingProtector- protector to unlock the primary key- Returns:
- the builder
- Throws:
org.bouncycastle.openpgp.PGPException
-
revokeUserId
SecretKeyRingEditorInterface revokeUserId(java.lang.String userId, long subkeyId, SecretKeyRingProtector secretKeyRingProtector, RevocationAttributes revocationAttributes) throws org.bouncycastle.openpgp.PGPException
Revoke the given userID on the key that belongs to the given key ID.- Parameters:
userId- userId to revokesubkeyId- ID of the subkey on which we the userID should be revokedsecretKeyRingProtector- protector to unlock the primary keyrevocationAttributes- reason for the revocation- Returns:
- the builder
- Throws:
org.bouncycastle.openpgp.PGPException
-
setExpirationDate
SecretKeyRingEditorInterface setExpirationDate(java.util.Date expiration, SecretKeyRingProtector secretKeyRingProtector) throws org.bouncycastle.openpgp.PGPException
Set 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.- Parameters:
expiration- new expiration date or nullsecretKeyRingProtector-- Returns:
- Throws:
org.bouncycastle.openpgp.PGPException
-
setExpirationDate
SecretKeyRingEditorInterface setExpirationDate(OpenPgpV4Fingerprint fingerprint, java.util.Date expiration, SecretKeyRingProtector secretKeyRingProtector) throws org.bouncycastle.openpgp.PGPException
Set key expiration time.- Parameters:
fingerprint- key that will have its expiration date adjustedexpiration- target expiration time or @{code null} for no expirationsecretKeyRingProtector- protector to unlock the priary key- Returns:
- the builder
- Throws:
org.bouncycastle.openpgp.PGPException
-
createRevocationCertificate
org.bouncycastle.openpgp.PGPSignature createRevocationCertificate(OpenPgpV4Fingerprint fingerprint, SecretKeyRingProtector secretKeyRingProtector, RevocationAttributes revocationAttributes) throws org.bouncycastle.openpgp.PGPException
Create a detached revocation certificate, which can be used to revoke the specified key.- Parameters:
fingerprint- fingerprint of the key to be revoked. Can be primary or sub key.secretKeyRingProtector- protector to unlock the primary key.revocationAttributes- reason for the revocation- Returns:
- revocation certificate
- Throws:
org.bouncycastle.openpgp.PGPException
-
createRevocationCertificate
org.bouncycastle.openpgp.PGPSignature createRevocationCertificate(long subKeyId, SecretKeyRingProtector secretKeyRingProtector, RevocationAttributes revocationAttributes) throws org.bouncycastle.openpgp.PGPExceptionCreate a detached revocation certificate, which can be used to revoke the specified key.- Parameters:
subKeyId- id of the key to be revoked. Can be primary or sub key.secretKeyRingProtector- protector to unlock the primary key.revocationAttributes- reason for the revocation- Returns:
- revocation certificate
- Throws:
org.bouncycastle.openpgp.PGPException
-
changePassphraseFromOldPassphrase
default SecretKeyRingEditorInterface.WithKeyRingEncryptionSettings changePassphraseFromOldPassphrase(@Nullable Passphrase oldPassphrase)
Change the passphrase of the whole key ring.- Parameters:
oldPassphrase- old passphrase or null, if the key was unprotected- Returns:
- next builder step
-
changePassphraseFromOldPassphrase
SecretKeyRingEditorInterface.WithKeyRingEncryptionSettings changePassphraseFromOldPassphrase(@Nullable Passphrase oldPassphrase, @Nonnull KeyRingProtectionSettings oldProtectionSettings)
Change the passphrase of the whole key ring.- Parameters:
oldPassphrase- old passphrase or null, if the key was unprotectedoldProtectionSettings- custom settings for the old passphrase- Returns:
- next builder step
-
changeSubKeyPassphraseFromOldPassphrase
default SecretKeyRingEditorInterface.WithKeyRingEncryptionSettings changeSubKeyPassphraseFromOldPassphrase(@Nonnull java.lang.Long keyId, @Nullable Passphrase oldPassphrase)
Change the passphrase of a single subkey in the key ring. Note: While it is a valid use-case to have different passphrases per subKey, this is one of the reasons why OpenPGP sucks in practice.- Parameters:
keyId- id of the subkeyoldPassphrase- old passphrase- Returns:
- next builder step
-
changeSubKeyPassphraseFromOldPassphrase
SecretKeyRingEditorInterface.WithKeyRingEncryptionSettings changeSubKeyPassphraseFromOldPassphrase(@Nonnull java.lang.Long keyId, @Nullable Passphrase oldPassphrase, @Nonnull KeyRingProtectionSettings oldProtectionSettings)
-
done
org.bouncycastle.openpgp.PGPSecretKeyRing done()
Return thePGPSecretKeyRing.- Returns:
- the key
-
-