Skip to Main Content

Java Security

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

MIMEBodyPart and RecipientId

843811Feb 8 2008 — edited Feb 8 2008
Hi all,

I'm looking at code to decrypt an email message at the moment and I came accross the following lines of code:
Certificate returnedCert = keystore.getCertificate(alias);
RecipientId recId = new RecipientId();

recId.setSerialNumber(((X509Certificate) returnedCert).getSerialNumber());
recId.setIssuer(((X509Certificate) returnedCert).getIssuerX500Principal().getEncoded());
I'm not sure what the RecipientId object does here. Why does it take information from my private key? I was under the impression that I would use my private key to decrypt emails sent to me which were encrypted using my public key. But then these lines:
//Partner's public key alias defined in property file
String keyAlias = owner.getProperty(PropNames.KEY_PUBLIC_ALIAS);
MimeBodyPart res = SMIMEUtil.toMimeBodyPart(recipient.getContent(keystore.getKey(keyAlias, null),"BC"));
seems to be using the senders public key to do something! Any help appreciated!

Thanks,

Illu
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 7 2008
Added on Feb 8 2008
0 comments
134 views