aboutsummaryrefslogtreecommitdiffstats
path: root/libraries/spongycastle/pg/src
diff options
context:
space:
mode:
Diffstat (limited to 'libraries/spongycastle/pg/src')
-rw-r--r--libraries/spongycastle/pg/src/main/java/org/spongycastle/bcpg/SignaturePacket.java2
-rw-r--r--libraries/spongycastle/pg/src/main/java/org/spongycastle/openpgp/PGPSignatureSubpacketVector.java26
2 files changed, 27 insertions, 1 deletions
diff --git a/libraries/spongycastle/pg/src/main/java/org/spongycastle/bcpg/SignaturePacket.java b/libraries/spongycastle/pg/src/main/java/org/spongycastle/bcpg/SignaturePacket.java
index 38c06ccb5..8428abfc9 100644
--- a/libraries/spongycastle/pg/src/main/java/org/spongycastle/bcpg/SignaturePacket.java
+++ b/libraries/spongycastle/pg/src/main/java/org/spongycastle/bcpg/SignaturePacket.java
@@ -27,7 +27,7 @@ public class SignaturePacket
private SignatureSubpacket[] unhashedData;
private byte[] signatureEncoding;
- SignaturePacket(
+ public SignaturePacket(
BCPGInputStream in)
throws IOException
{
diff --git a/libraries/spongycastle/pg/src/main/java/org/spongycastle/openpgp/PGPSignatureSubpacketVector.java b/libraries/spongycastle/pg/src/main/java/org/spongycastle/openpgp/PGPSignatureSubpacketVector.java
index 738828997..9cb6dc51f 100644
--- a/libraries/spongycastle/pg/src/main/java/org/spongycastle/openpgp/PGPSignatureSubpacketVector.java
+++ b/libraries/spongycastle/pg/src/main/java/org/spongycastle/openpgp/PGPSignatureSubpacketVector.java
@@ -1,9 +1,13 @@
package org.spongycastle.openpgp;
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
+import org.spongycastle.bcpg.BCPGInputStream;
+import org.spongycastle.bcpg.SignaturePacket;
import org.spongycastle.bcpg.SignatureSubpacket;
import org.spongycastle.bcpg.SignatureSubpacketTags;
import org.spongycastle.bcpg.sig.Features;
@@ -16,6 +20,7 @@ import org.spongycastle.bcpg.sig.PrimaryUserID;
import org.spongycastle.bcpg.sig.SignatureCreationTime;
import org.spongycastle.bcpg.sig.SignatureExpirationTime;
import org.spongycastle.bcpg.sig.SignerUserID;
+import org.spongycastle.openpgp.PGPException;
/**
* Container for a list of signature subpackets.
@@ -89,6 +94,27 @@ public class PGPSignatureSubpacketVector
return vals;
}
+ public PGPSignatureList getEmbeddedSignatures() throws IOException, PGPException
+ {
+ SignatureSubpacket[] sigs = getSubpackets(SignatureSubpacketTags.EMBEDDED_SIGNATURE);
+ ArrayList l = new ArrayList();
+ for (int i = 0; i < sigs.length; i++) {
+ byte[] data = sigs[i].getData();
+ PGPSignature tmpSig = null;
+ BCPGInputStream in = new BCPGInputStream(new ByteArrayInputStream(data));
+ try {
+ tmpSig = new PGPSignature(new SignaturePacket(in));
+ } catch (IOException e) {
+ tmpSig = null;
+ } catch (PGPException e) {
+ tmpSig = null;
+ }
+ if (tmpSig != null)
+ l.add(tmpSig);
+ }
+ return new PGPSignatureList((PGPSignature[])l.toArray(new PGPSignature[l.size()]));
+ }
+
public long getIssuerKeyID()
{
SignatureSubpacket p = this.getSubpacket(SignatureSubpacketTags.ISSUER_KEY_ID);