How to decrypt S/MIME?

  1. 2 months ago

    Beatrix W

    Mar 15 Pre-Release Testers Europe (Germany)

    The example at https://www.example-code.com/xojo/smime_verify_signature.asp shows how to decrypt S/MIME. But I think it glosses a bit on how to use the Cert part. Can't I have multiple certificates? Do I need to find the correct certificate or is this handled automatically?

  2. Christian S

    Mar 15 Pre-Release Testers, Xojo Pro, XDC Speakers Germany

    I have some SMIME functions in OpenSSLMBS module. Please take a look.

  3. Beatrix W

    Mar 15 Pre-Release Testers Europe (Germany)

    Here is the example code for decrypting:

    			dim c as X509MBS = X509MBS.Open(ReadFile(GetFolderItem("signer.pem")))
    			dim k as PKeyMBS = PKeyMBS.Open(ReadFile(GetFolderItem("signer.pem")))
    			dim i as string = ReadFile(GetFolderItem("smencr.txt"))
    			
    			dim d as string = OpenSSLMBS.SMimePKCS7Decrypt(i, c, k)
    			
    			WriteFile d, GetFolderItem("encrout.txt")

    Where do I get signer.pem? Isn't this what Cert from the Chilkat plugin manages?

  4. Christian S

    Mar 15 Pre-Release Testers, Xojo Pro, XDC Speakers Germany

    with our plugin you can read PKCS#12 file to get both private key and certificates.
    Or you have them in a pem file like in the example.
    Or you have them in separate files.

  5. Beatrix W

    Mar 15 Pre-Release Testers Europe (Germany)

    I'm a total newbie in this email encryption stuff. Where do I get the pem file? Doesn't the mail client manage these files? Shouldn't the keychain handle the encryption?

or Sign Up to reply!