login about faq

I downloaded the evaluation software and testing the encryption for s/mime. The code fails at the following line. Could you please me know what could be wrong? Thank you.

success = mime.Encrypt(cert);

Here is the LastErrorText message:

ChilkatLog:
  SaveMime:
     DllDate: Aug 5 2012
     UnlockPrefix:30-day trail
     Username:
     Architecture: Little Endian; 32-bit
     Language: .NET 4.0
     VerboseLogging: 0
     hcCurDate: Fri, 07 Dec 2012
     hcExpire: 7/2012
     filename: unencrypted.txt
     success.
   --SaveMime.
--ChilkatLog

Here is my code.

        Chilkat.Mime mime = new Chilkat.Mime();
        //Any string passed to UnlockComponent begins the 30-day trial
        success = mime.UnlockComponent("30-day trial");
        if (success == false)
        {
            Console.WriteLine(mime.LastErrorText);
            return;
        }
        success = mime.SetBodyFromPlainText("This is a message containing a GIF image file.");
        if (success == false)
        {
            Console.WriteLine(mime.LastErrorText);
            return;
        }
        success = mime.AppendPartFromFile("dude.gif");
        if (success == false)
        {
            Console.WriteLine(mime.LastErrorText);
            return;
        }
        success = mime.SaveMime("unencrypted.txt");
        if (success == false)
        {
            Console.WriteLine(mime.LastErrorText);
            return;
        }

        // Locate a certificate in the Current User Store (in the registry)
        // There are many different ways of locating and using certificates
        // using Cert, CertStore and CreateCS.
        Chilkat.CreateCS ccs = new Chilkat.CreateCS();
        Chilkat.CertStore certStore = ccs.OpenCurrentUserStore();
        Chilkat.Cert cert = certStore.FindCertForEmail("matt@chilkatsoft.com");

        // Use the certificate for encryption.
        // This creates an x-pkcs7-mime enveloped message.
        success = mime.Encrypt(cert);
        if (success == false)
        {
            Console.WriteLine(mime.LastErrorText);
            return;
        }
        success = mime.SaveMime("encrypted.txt");
        if (success == false)
        {
            Console.WriteLine(mime.LastErrorText);
            return;
        }

asked Dec 07 '12 at 10:45

nav100's gravatar image

nav100
16334


You've provided the LastErrorText for the "SaveMime" method call, not the "Encrypt" method call. See this: The Basic Concept of LastErrorText

link

answered Dec 07 '12 at 10:54

chilkat's gravatar image

chilkat ♦♦
11.8k316358420

The 'cert' is null.It couldn't find this certificate. Chilkat.Cert cert = certStore.FindCertForEmail("matt@chilkatsoft.com");

(Dec 07 '12 at 10:55) nav100

Could you please let me know what could be wrong? We are evaluating this software before we buy a license.

(Dec 07 '12 at 13:10) nav100

It works after creating a test certificate.

(Dec 07 '12 at 14:49) nav100
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:

×31
×15

Asked: Dec 07 '12 at 10:45

Seen: 1,160 times

Last updated: Dec 07 '12 at 14:49

powered by OSQA