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
1 changed files with 15 additions and 0 deletions

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