mirror of
https://github.com/pgpainless/pgpainless.git
synced 2024-11-26 22:32:07 +01:00
Rename user-id deletion methods
This commit is contained in:
parent
74609e0ef7
commit
021fd7846e
2 changed files with 5 additions and 5 deletions
|
@ -167,7 +167,7 @@ public final class KeyRingUtils {
|
|||
* @return modified secret keys
|
||||
*/
|
||||
@Deprecated
|
||||
public static PGPSecretKeyRing deleteUserIdFromSecretKeyRing(PGPSecretKeyRing secretKeys, String userId) {
|
||||
public static PGPSecretKeyRing deleteUserId(PGPSecretKeyRing secretKeys, String userId) {
|
||||
PGPSecretKey secretKey = secretKeys.getSecretKey(); // user-ids are located on primary key only
|
||||
PGPPublicKey publicKey = secretKey.getPublicKey(); // user-ids are placed on the public key part
|
||||
publicKey = PGPPublicKey.removeCertification(publicKey, userId);
|
||||
|
@ -191,7 +191,7 @@ public final class KeyRingUtils {
|
|||
* @return modified secret keys
|
||||
*/
|
||||
@Deprecated
|
||||
public static PGPPublicKeyRing deleteUserIdFromPublicKeyRing(PGPPublicKeyRing publicKeys, String userId) {
|
||||
public static PGPPublicKeyRing deleteUserId(PGPPublicKeyRing publicKeys, String userId) {
|
||||
PGPPublicKey publicKey = publicKeys.getPublicKey(); // user-ids are located on primary key only
|
||||
publicKey = PGPPublicKey.removeCertification(publicKey, userId);
|
||||
if (publicKey == null) {
|
||||
|
|
|
@ -32,7 +32,7 @@ public class KeyRingUtilTest {
|
|||
.done();
|
||||
assertEquals(2, CollectionUtils.iteratorToList(secretKeys.getPublicKey().getUserIDs()).size());
|
||||
|
||||
secretKeys = KeyRingUtils.deleteUserIdFromSecretKeyRing(secretKeys, "Bob");
|
||||
secretKeys = KeyRingUtils.deleteUserId(secretKeys, "Bob");
|
||||
|
||||
assertEquals(1, CollectionUtils.iteratorToList(secretKeys.getPublicKey().getUserIDs()).size());
|
||||
}
|
||||
|
@ -49,7 +49,7 @@ public class KeyRingUtilTest {
|
|||
PGPPublicKeyRing publicKeys = PGPainless.extractCertificate(secretKeys);
|
||||
assertEquals(2, CollectionUtils.iteratorToList(publicKeys.getPublicKey().getUserIDs()).size());
|
||||
|
||||
publicKeys = KeyRingUtils.deleteUserIdFromPublicKeyRing(publicKeys, "Alice");
|
||||
publicKeys = KeyRingUtils.deleteUserId(publicKeys, "Alice");
|
||||
|
||||
assertEquals(1, CollectionUtils.iteratorToList(publicKeys.getPublicKey().getUserIDs()).size());
|
||||
}
|
||||
|
@ -61,6 +61,6 @@ public class KeyRingUtilTest {
|
|||
.modernKeyRing("Alice", null);
|
||||
|
||||
assertThrows(NoSuchElementException.class,
|
||||
() -> KeyRingUtils.deleteUserIdFromSecretKeyRing(secretKeys, "Charlie"));
|
||||
() -> KeyRingUtils.deleteUserId(secretKeys, "Charlie"));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue