1
0
Fork 0
mirror of https://github.com/pgpainless/pgpainless.git synced 2024-12-26 12:58:02 +01:00

Add MessageMetadata.getRecipientKeyIds()

Fixes #376
This commit is contained in:
Paul Schaub 2023-05-03 14:30:08 +02:00
parent a8ab93a49a
commit 15f6cc70b1
Signed by: vanitasvitae
GPG key ID: 62BEE9264BF17311

View file

@ -92,6 +92,21 @@ public class MessageMetadata {
return false;
}
/**
* Return a list containing all recipient keyIDs.
*
* @return list of recipients
*/
public List<Long> getRecipientKeyIds() {
List<Long> keyIds = new ArrayList<>();
Iterator<EncryptedData> encLayers = getEncryptionLayers();
while (encLayers.hasNext()) {
EncryptedData layer = encLayers.next();
keyIds.addAll(layer.getRecipients());
}
return keyIds;
}
public @Nonnull Iterator<EncryptedData> getEncryptionLayers() {
return new LayerIterator<EncryptedData>(message) {
@Override