11package org .bouncycastle .openpgp ;
22
3+ import java .io .IOException ;
34import java .util .ArrayList ;
45import java .util .Date ;
56import java .util .List ;
67
8+ import org .bouncycastle .bcpg .SignaturePacket ;
79import org .bouncycastle .bcpg .SignatureSubpacket ;
810import org .bouncycastle .bcpg .SignatureSubpacketTags ;
911import org .bouncycastle .bcpg .sig .Features ;
@@ -77,7 +79,28 @@ public SignatureSubpacket[] getSubpackets(
7779 return (SignatureSubpacket [])list .toArray (new SignatureSubpacket []{});
7880 }
7981
80- public NotationData [] getNotationDataOccurences ()
82+ public PGPSignatureList getEmbeddedSignatures ()
83+ throws PGPException
84+ {
85+ SignatureSubpacket [] sigs = getSubpackets (SignatureSubpacketTags .EMBEDDED_SIGNATURE );
86+ ArrayList l = new ArrayList ();
87+
88+ for (int i = 0 ; i < sigs .length ; i ++)
89+ {
90+ try
91+ {
92+ l .add (new PGPSignature (SignaturePacket .fromByteArray (sigs [i ].getData ())));
93+ }
94+ catch (IOException e )
95+ {
96+ throw new PGPException ("Unable to parse signature packet: " + e .getMessage (), e );
97+ }
98+ }
99+
100+ return new PGPSignatureList ((PGPSignature [])l .toArray (new PGPSignature [l .size ()]));
101+ }
102+
103+ public NotationData [] getNotationDataOccurrences ()
81104 {
82105 SignatureSubpacket [] notations = getSubpackets (SignatureSubpacketTags .NOTATION_DATA );
83106 NotationData [] vals = new NotationData [notations .length ];
@@ -89,6 +112,14 @@ public NotationData[] getNotationDataOccurences()
89112 return vals ;
90113 }
91114
115+ /**
116+ * @deprecated use getNotationDataOccurrences()
117+ */
118+ public NotationData [] getNotationDataOccurences ()
119+ {
120+ return getNotationDataOccurrences ();
121+ }
122+
92123 public long getIssuerKeyID ()
93124 {
94125 SignatureSubpacket p = this .getSubpacket (SignatureSubpacketTags .ISSUER_KEY_ID );
0 commit comments