LOGGER.debug(
"Decrypting pkcsPkiEnvelope using key belonging to [issuer={}; serial={}]",
recipient.getIssuerDN(), recipient.getSerialNumber());
final RecipientInformationStore recipientInfos = pkcsPkiEnvelope
.getRecipientInfos();
RecipientInformation info = recipientInfos
.get(new JceKeyTransRecipientId(recipient));
if (info == null) {
throw new MessageDecodingException(
"Missing expected key transfer recipient");
}
LOGGER.debug("pkcsPkiEnvelope encryption algorithm: {}", info
.getKeyEncryptionAlgorithm().getAlgorithm());
try {
byte[] messageData = info.getContent(getKeyTransRecipient());
LOGGER.debug("Finished decoding pkcsPkiEnvelope");
return messageData;
} catch (CMSException e) {
throw new MessageDecodingException(e);
}