Skip to content
This repository has been archived by the owner on Jan 6, 2022. It is now read-only.

SmimeUtil is missing the API to return the "Signed by <from-address>", which email clients generally display #5

Open
bbottema opened this issue Apr 13, 2019 · 1 comment

Comments

@bbottema
Copy link

bbottema commented Apr 13, 2019

If you open a signed message in for example Outlook or Thunderbird, they will show a field right under "To:", named "Signed by:". After a lot of research, it turns out it is the subject of a certificate, the person's address to which the certificate was issued to.

I'll provide a pull-request that pulls out this subject from the first available certificate in the message (partially based on this SO answer):

X509Certificate cert = ...;

X500Name x500name = new JcaX509CertificateHolder(cert).getSubject();
RDN cn = x500name.getRDNs(BCStyle.CN)[0];

return IETFUtils.valueToString(cn.getFirst().getValue());
bbottema added a commit to bbottema/java-utils-mail-smime-fork that referenced this issue Apr 13, 2019
…ertificate on a MimePart. This subject is actually the email address of the person to which the certificate was issued to, a value often used by email clients to display "Signed by: <from-address>".
@bbottema bbottema changed the title SmimeUtil is missing the API to return the "Signed by" address, which email clients generally display SmimeUtil is missing the API to return the "Signed by <from-address>", which email clients generally display Apr 13, 2019
@bbottema
Copy link
Author

I provided the pull request.

The only thing I'm not sure about is whether the first certificate will always have the relevant "issued to" CN subject, or that we should run through all certificates' verifiers until the first non-empty subject was found.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant