Hello,

This is a licensed version of Secure Mail component. I'm using the same code indicated in S/MIME Tutorial page as follows:

` private void buttonLoadEml_Click(object sender, EventArgs e) { try { string emlFileName = GetEmlFilePath(); if (string.IsNullOrEmpty(emlFileName)) { return; } MailMessage message = new MailMessage(); message.Load(emlFileName);

            // decrypt the message if it is encrypted 
            if (message.IsEncrypted)
            {
                if (!message.CanDecrypt)
                    throw new ApplicationException
                    (
                      "Message cannot be decrypted. You do not have the private key."
                    );

                message.Decrypt();
            }

            this.textBox1.Text = message.BodyText;
        }
        catch (Exception ex)
        {
            this.textBox1.Text = ex.ToString();
        }
    }

`

Here are the exception details:

System.FormatException: Input string was not in a correct format. at System.Text.StringBuilder.AppendFormat(IFormatProvider provider, String format, Object[] args) at System.String.Format(IFormatProvider provider, String format, Object[] args) at AzIwhU.bjJTWY.bbBzTnZ(Byte[] ) at Rebex.Security.Cryptography.Pkcs.EnvelopedData.Decrypt() at Rebex.Mime.MimeEntity.Decrypt() at Rebex.Mail.MailMessage.Decrypt() at CertificateEnumerator.MainForm.buttonLoadEml_Click(Object sender, EventArgs e) in C:\Users\inm\Documents\Visual Studio 2008\Projects\CertificateEnumerator\CertificateEnumerator\MainForm.cs:line 173

asked 16 Sep '10, 16:18

M.%20Inam's gravatar image

M. Inam
16
accept rate: 0%


Hello,

it seems us that you encountered the known bug of the Rebex Secure Mail. We fixed it in 2010-07-20 (version 1.0.3854.0).

Most probably you should obtain a CryptographicException with error message "Unsupported encryption algorithm" due to missing AES cryptography support. AES was added only in recent time so you need the fresh code for it.

We recommend to you to download the latest component version. It should solve the problem. If not, please let us know again.

link

answered 17 Sep '10, 13:40

Vit%20Zyka's gravatar image

Vit Zyka
912
accept rate: 8%

edited 17 Sep '10, 15:09

Rebex%20KB's gravatar image

Rebex KB ♦♦
258519

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×11

Asked: 16 Sep '10, 16:18

Seen: 550 times

Last updated: 17 Sep '10, 15:09