ContentInfo contentInfo)
throws CMSException
{
this.contentInfo = contentInfo;
EnvelopedData envData = EnvelopedData.getInstance(contentInfo.getContent());
//
// read the encrypted content info
//
EncryptedContentInfo encInfo = envData.getEncryptedContentInfo();
this.encAlg = encInfo.getContentEncryptionAlgorithm();
//
// load the RecipientInfoStore
//
ASN1Set s = envData.getRecipientInfos();
List infos = new ArrayList();
byte[] contentOctets = encInfo.getEncryptedContent().getOctets();
for (int i = 0; i != s.size(); i++)
{
RecipientInfo info = RecipientInfo.getInstance(s.getObjectAt(i));
InputStream contentStream = new ByteArrayInputStream(contentOctets);
Object type = info.getInfo();
if (type instanceof KeyTransRecipientInfo)
{
infos.add(new KeyTransRecipientInformation(
(KeyTransRecipientInfo)type, encAlg, contentStream));
}
else if (type instanceof KEKRecipientInfo)
{
infos.add(new KEKRecipientInformation(
(KEKRecipientInfo)type, encAlg, contentStream));
}
else if (type instanceof KeyAgreeRecipientInfo)
{
infos.add(new KeyAgreeRecipientInformation(
(KeyAgreeRecipientInfo)type, encAlg, contentStream));
}
else if (type instanceof PasswordRecipientInfo)
{
infos.add(new PasswordRecipientInformation(
(PasswordRecipientInfo)type, encAlg, contentStream));
}
}
this.recipientInfoStore = new RecipientInformationStore(infos);
this.unprotectedAttributes = envData.getUnprotectedAttrs();
}