mirror of
https://github.com/pgpainless/pgpainless.git
synced 2024-11-14 16:32:06 +01:00
KeyRingReader.readPublicKeyRingCollection: Handle secret keys as public keys
This commit is contained in:
parent
16ec6bc5e4
commit
7a777ab914
1 changed files with 7 additions and 0 deletions
|
@ -23,6 +23,7 @@ import org.bouncycastle.openpgp.PGPPublicKeyRingCollection;
|
||||||
import org.bouncycastle.openpgp.PGPSecretKeyRing;
|
import org.bouncycastle.openpgp.PGPSecretKeyRing;
|
||||||
import org.bouncycastle.openpgp.PGPSecretKeyRingCollection;
|
import org.bouncycastle.openpgp.PGPSecretKeyRingCollection;
|
||||||
import org.bouncycastle.util.io.Streams;
|
import org.bouncycastle.util.io.Streams;
|
||||||
|
import org.pgpainless.PGPainless;
|
||||||
import org.pgpainless.implementation.ImplementationFactory;
|
import org.pgpainless.implementation.ImplementationFactory;
|
||||||
import org.pgpainless.key.collection.PGPKeyRingCollection;
|
import org.pgpainless.key.collection.PGPKeyRingCollection;
|
||||||
import org.pgpainless.util.ArmorUtils;
|
import org.pgpainless.util.ArmorUtils;
|
||||||
|
@ -295,6 +296,12 @@ public class KeyRingReader {
|
||||||
}
|
}
|
||||||
if (next instanceof PGPPublicKeyRing) {
|
if (next instanceof PGPPublicKeyRing) {
|
||||||
rings.add((PGPPublicKeyRing) next);
|
rings.add((PGPPublicKeyRing) next);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
// Parse public keys from secret keys
|
||||||
|
if (next instanceof PGPSecretKeyRing) {
|
||||||
|
rings.add(PGPainless.extractCertificate((PGPSecretKeyRing) next));
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
if (next instanceof PGPPublicKeyRingCollection) {
|
if (next instanceof PGPPublicKeyRingCollection) {
|
||||||
PGPPublicKeyRingCollection collection = (PGPPublicKeyRingCollection) next;
|
PGPPublicKeyRingCollection collection = (PGPPublicKeyRingCollection) next;
|
||||||
|
|
Loading…
Reference in a new issue