A community member has associated this post with a similar question:
How to Support S/MIME using java mail.

Only moderators can edit this content.

How to support S/MIME using java.

Anonymous
2024-09-10T11:11:41.44+00:00

Hi all,

I want to send S/MIME encrypted mail but, while sending I am getting an error :

image.png

I tried sending an encrypted attachment through Java code but got an error when accessing it after downloading.

image.png

below is the code I am using :

KeyStore keystore = KeyStore.getInstance("PKCS12");
        FileInputStream fis = new FileInputStream("Path/keystore.p12");
        keystore.load(fis, "p12password".toCharArray());
        PrivateKey privateKey = (PrivateKey) keystore.getKey("myalias", "p12password".toCharArray());
        Certificate cert = keystore.getCertificate("myalias");
        Certificate recipientCert = keystore.getCertificate("myalias");


Questions:

  1. How can I install the S/MIME extension?
  2. The Java code I provided is right or wrong?
  3. If not then what is the right to send and read S/MIME encrypted messages using Java code?
Outlook | Windows | Classic Outlook for Windows | For business
Microsoft 365 and Office | Install, redeem, activate | For business | Windows
Microsoft Security | Microsoft Graph
0 comments No comments
{count} votes