mirror of
https://github.com/moparisthebest/open-keychain
synced 2024-11-27 11:12:15 -05:00
re-enable getEmbeddedSignatures
This commit is contained in:
parent
e094d295ea
commit
4071ce8550
@ -973,16 +973,16 @@ public class PgpOperation {
|
|||||||
boolean primkeyBinding_isok = false;
|
boolean primkeyBinding_isok = false;
|
||||||
JcaPGPContentVerifierBuilderProvider contentVerifierBuilderProvider = new JcaPGPContentVerifierBuilderProvider()
|
JcaPGPContentVerifierBuilderProvider contentVerifierBuilderProvider = new JcaPGPContentVerifierBuilderProvider()
|
||||||
.setProvider(Constants.BOUNCY_CASTLE_PROVIDER_NAME);
|
.setProvider(Constants.BOUNCY_CASTLE_PROVIDER_NAME);
|
||||||
PGPSignatureList eSigList = null;
|
PGPSignatureList eSigList;
|
||||||
|
|
||||||
if (Pkts.hasSubpacket(SignatureSubpacketTags.EMBEDDED_SIGNATURE)) {
|
if (Pkts.hasSubpacket(SignatureSubpacketTags.EMBEDDED_SIGNATURE)) {
|
||||||
// try {
|
try {
|
||||||
// eSigList = Pkts.getEmbeddedSignatures();
|
eSigList = Pkts.getEmbeddedSignatures();
|
||||||
// } catch (IOException e) {
|
} catch (IOException e) {
|
||||||
// return false;
|
return false;
|
||||||
// } catch (PGPException e) {
|
} catch (PGPException e) {
|
||||||
// return false;
|
return false;
|
||||||
// }
|
}
|
||||||
for (int j = 0; j < eSigList.size(); ++j) {
|
for (int j = 0; j < eSigList.size(); ++j) {
|
||||||
PGPSignature emSig = eSigList.get(j);
|
PGPSignature emSig = eSigList.get(j);
|
||||||
if (emSig.getSignatureType() == PGPSignature.PRIMARYKEY_BINDING) {
|
if (emSig.getSignatureType() == PGPSignature.PRIMARYKEY_BINDING) {
|
||||||
|
@ -27,7 +27,7 @@ public class SignaturePacket
|
|||||||
private SignatureSubpacket[] unhashedData;
|
private SignatureSubpacket[] unhashedData;
|
||||||
private byte[] signatureEncoding;
|
private byte[] signatureEncoding;
|
||||||
|
|
||||||
SignaturePacket(
|
public SignaturePacket(
|
||||||
BCPGInputStream in)
|
BCPGInputStream in)
|
||||||
throws IOException
|
throws IOException
|
||||||
{
|
{
|
||||||
|
@ -1,9 +1,13 @@
|
|||||||
package org.spongycastle.openpgp;
|
package org.spongycastle.openpgp;
|
||||||
|
|
||||||
|
import java.io.ByteArrayInputStream;
|
||||||
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.spongycastle.bcpg.BCPGInputStream;
|
||||||
|
import org.spongycastle.bcpg.SignaturePacket;
|
||||||
import org.spongycastle.bcpg.SignatureSubpacket;
|
import org.spongycastle.bcpg.SignatureSubpacket;
|
||||||
import org.spongycastle.bcpg.SignatureSubpacketTags;
|
import org.spongycastle.bcpg.SignatureSubpacketTags;
|
||||||
import org.spongycastle.bcpg.sig.Features;
|
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.SignatureCreationTime;
|
||||||
import org.spongycastle.bcpg.sig.SignatureExpirationTime;
|
import org.spongycastle.bcpg.sig.SignatureExpirationTime;
|
||||||
import org.spongycastle.bcpg.sig.SignerUserID;
|
import org.spongycastle.bcpg.sig.SignerUserID;
|
||||||
|
import org.spongycastle.openpgp.PGPException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Container for a list of signature subpackets.
|
* Container for a list of signature subpackets.
|
||||||
@ -89,6 +94,27 @@ public class PGPSignatureSubpacketVector
|
|||||||
return vals;
|
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()
|
public long getIssuerKeyID()
|
||||||
{
|
{
|
||||||
SignatureSubpacket p = this.getSubpacket(SignatureSubpacketTags.ISSUER_KEY_ID);
|
SignatureSubpacket p = this.getSubpacket(SignatureSubpacketTags.ISSUER_KEY_ID);
|
||||||
|
Loading…
Reference in New Issue
Block a user