mirror of
https://github.com/pgpainless/pgpainless.git
synced 2025-12-10 06:11:08 +01:00
More code cleanup and tests
This commit is contained in:
parent
bd9a580600
commit
c35154813a
3 changed files with 38 additions and 20 deletions
|
|
@ -38,10 +38,8 @@ import org.bouncycastle.openpgp.PGPSecretKeyRingCollection;
|
|||
import org.bouncycastle.openpgp.PGPSignature;
|
||||
import org.bouncycastle.openpgp.PGPSignatureSubpacketVector;
|
||||
import org.bouncycastle.openpgp.PGPUtil;
|
||||
import org.bouncycastle.openpgp.operator.KeyFingerPrintCalculator;
|
||||
import org.bouncycastle.util.io.Streams;
|
||||
import org.pgpainless.algorithm.KeyFlag;
|
||||
import org.pgpainless.implementation.ImplementationFactory;
|
||||
import org.pgpainless.key.selection.key.PublicKeySelectionStrategy;
|
||||
import org.pgpainless.key.selection.key.impl.NoRevocation;
|
||||
import org.pgpainless.key.selection.key.impl.SignedByMasterKey;
|
||||
|
|
@ -185,24 +183,6 @@ public class BCUtil {
|
|||
return cleaned;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the {@link PGPPublicKey} which is the master key of the key ring.
|
||||
*
|
||||
* @param ring key ring
|
||||
* @return master key
|
||||
*/
|
||||
public static PGPPublicKey getMasterKeyFrom(@Nonnull PGPPublicKeyRing ring) {
|
||||
Iterator<PGPPublicKey> it = ring.getPublicKeys();
|
||||
while (it.hasNext()) {
|
||||
PGPPublicKey k = it.next();
|
||||
if (k.isMasterKey()) {
|
||||
// There can only be one master key, so we can immediately return
|
||||
return k;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static PGPPublicKey getMasterKeyFrom(@Nonnull PGPKeyRing ring) {
|
||||
Iterator<PGPPublicKey> it = ring.getPublicKeys();
|
||||
while (it.hasNext()) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue