public Object getEntity(Class t, Type gt, Annotation[] ann, PrivateKey pKey, X509Certificate cert) { MimeBodyPart decrypted = null; try { MimeBodyPart encryptedBodyPart = body; SMIMEEnveloped m = new SMIMEEnveloped(encryptedBodyPart); JceKeyTransRecipientId recId = new JceKeyTransRecipientId(cert); RecipientInformationStore recipients = m.getRecipientInfos(); RecipientInformation recipient = recipients.get(recId); JceKeyTransRecipient pKeyRecp = new JceKeyTransEnvelopedRecipient(pKey); decrypted = SMIMEUtil.toMimeBodyPart(recipient.getContent(pKeyRecp)); } catch (Exception e1) { throw new RuntimeException(e1); } return extractEntity(t, gt, ann, decrypted, providers); }
final RecipientInformationStore recipients = m.getRecipientInfos(); final RecipientInformation recipient = recipients.get(recId); final JceKeyTransEnvelopedRecipient recip = new JceKeyTransEnvelopedRecipient(entry);
private MimeBodyPart decryptPart(MimeBodyPart part) throws Exception { SMIMEEnveloped smimeEnveloped = new SMIMEEnveloped(part); RecipientInformationStore recipients = smimeEnveloped.getRecipientInfos(); RecipientInformation recipient = recipients.get(recId); if (null == recipient) { StringBuilder errorMessage = new StringBuilder(); errorMessage.append("This email wasn't encrypted with \"" + recId.toString() + "\".\n"); errorMessage.append("The encryption recId is: "); for (Object rec : recipients.getRecipients()) { if (rec instanceof RecipientInformation) { RecipientId recipientId = ((RecipientInformation) rec).getRID(); errorMessage.append("\"" + recipientId.toString() + "\"\n"); } } throw new Exception(errorMessage.toString()); } return toMimeBodyPart(recipient.getContent(ks.getKey(decryptionKeyAlias, null), BOUNCY_CASTLE_PROVIDER)); }
final RecipientInformationStore recipients = env.getRecipientInfos(); Collection<RecipientInformation> reps = recipients.getRecipients(); for (RecipientInformation repInfo : reps)
RecipientInformationStore recipients = m.getRecipientInfos(); RecipientInformation recipient = recipients.get(recId);
RecipientInformationStore recipientInfoStore = envelope.getRecipientInfos();
aRecipient = aEnvelope.getRecipientInfos ().get (aRecipientID);
SMIMEEnveloped m = new SMIMEEnveloped(msg); RecipientInformationStore recipients = m.getRecipientInfos(); RecipientInformation recipient = recipients.get(recId); PrivateKey privateKey = (PrivateKey) ks.getKey(aliasOrCN, certPassword.toCharArray());
try { SMIMEEnveloped env = new SMIMEEnveloped(message); RecipientInformationStore informationStore = env.getRecipientInfos(); Collection<RecipientInformation> recipients = informationStore.getRecipients(); for (RecipientInformation info : recipients) {
final RecipientInformationStore recipients = m.getRecipientInfos(); final RecipientInformation recipient = recipients.get(recId); if (recipient == null)