Search in sources :

Example 1 with PasswordRecipientInformation

use of org.bouncycastle.cms.PasswordRecipientInformation in project xipki by xipki.

the class PbmMacCmpCaClient method decrypt.

private byte[] decrypt(EnvelopedData ed0) throws Exception {
    ContentInfo ci = new ContentInfo(CMSObjectIdentifiers.envelopedData, ed0);
    CMSEnvelopedData ed = new CMSEnvelopedData(ci);
    RecipientInformationStore recipients = ed.getRecipientInfos();
    Iterator<RecipientInformation> it = recipients.getRecipients().iterator();
    PasswordRecipientInformation recipient = (PasswordRecipientInformation) it.next();
    return recipient.getContent(new BcPasswordEnvelopedRecipient(password));
}
Also used : CMSEnvelopedData(org.bouncycastle.cms.CMSEnvelopedData) PasswordRecipientInformation(org.bouncycastle.cms.PasswordRecipientInformation) RecipientInformation(org.bouncycastle.cms.RecipientInformation) ContentInfo(org.bouncycastle.asn1.cms.ContentInfo) RecipientInformationStore(org.bouncycastle.cms.RecipientInformationStore) PasswordRecipientInformation(org.bouncycastle.cms.PasswordRecipientInformation) BcPasswordEnvelopedRecipient(org.bouncycastle.cms.bc.BcPasswordEnvelopedRecipient)

Aggregations

ContentInfo (org.bouncycastle.asn1.cms.ContentInfo)1 CMSEnvelopedData (org.bouncycastle.cms.CMSEnvelopedData)1 PasswordRecipientInformation (org.bouncycastle.cms.PasswordRecipientInformation)1 RecipientInformation (org.bouncycastle.cms.RecipientInformation)1 RecipientInformationStore (org.bouncycastle.cms.RecipientInformationStore)1 BcPasswordEnvelopedRecipient (org.bouncycastle.cms.bc.BcPasswordEnvelopedRecipient)1