August 25, 2008

Chilkat v8.6.0.0 New Features

Filed under: release notes — Tags: — admin @ 7:08 am

Chilkat v8.6.0.0 is being released today. Here’s a list of the major new features/fixes. Documentation and new examples will appear soon after the new version is available at http://www.chilkatsoft.com/downloads.asp

Zip:

  • ZIP64 extensions are now supported. There is effectively no limitation on the size of individual files that can be zipped or unzipped. There is also no limitation for the total zip size. There is no longer a limitation on how many files may be included within a .zip. (The previous limitation was 65536 because the zip file format uses a 2-byte unsigned int for the file count, but this limitation is removed with the ZIP64 file format.)
  • Unicode extensions are now supported.  It is possible to create zip archives with mixtures of filenames in any language.  (Previously, it was possible to create zip archives containing filenames in any language, but you couldn’t mix languages, except for us-ascii + any other language.)
  • Performance should be improved.
  • Optimizations for “storing” already-compressed files will also improve performance. As an example, if a .zip is present in a directory tree that is zipped, you’ll have a .zip within a .zip. Re-compressing a .zip is generally a waste of CPU cycles because no additional compression typically occurs. Files like this are simply “stored” within the .zip without re-compressing.

Ftp2:

  • Automatically handles One-Time Password (OTP), also known as S/KEY authentication.

RSA Private Keys:

  • Able to read/write the encrypted PKCS8 key file format.

SSL:

  • Bug fixed if an SSL server issues a renegotiate. This underlying fix applies to all components that support SSL/TLS: POP3, SMTP, IMAP, FTP, HTTP, Socket, etc.

Socket:

  • New functions available for converting existing connections to/from SSL/TLS.

DSA:

  • The DSA component is fully functional and released. Documentation and examples will be posted soon.

Diffie-Hellman:

  • The DH component is fully functional and released. Documentation and examples will be posted soon.

SSH Keys:

  • The long-awaited SSH component will make its first appearance with the release of the supporting SshKey class/object that will provide the ability to read/write Putty and OpenSSH format keys. RSA and DSA keys are supported, as well as encrypted/non-encrypted, and public/private keys. The SshKey class is freeware because it is a supporting class. The upcoming “Chilkat SSH” component will not be freeware.

August 24, 2008

System.BadImageFormatException

Filed under: x64 — Tags: — admin @ 7:44 pm

This usually happens when trying to use the Chilkat 32-bit .NET 2.0 Assembly on a 64-bit system. Download and use the x64 build for the Chilkat .NET 2.0 Framework at http://www.chilkatsoft.com/downloads.asp

Also, it’s likely that your development environment is 32-bit. You should add a reference to the 32-bit ChilkatDotNet2.dll, but deploy the 64-bit ChilkatDotNet2.dll to the x64 computer. Make sure the versions agree because the .NET runtime enforces version agreement.

Chilkat C++ Libraries safe for multi-threading?

Filed under: C# — Tags: — admin @ 7:19 pm

Question:
Are the Chilkat C++ libraries safe for multi-threading?

Answer:
Yes. However, it is best practice that you don’t allow multiple threads to call methods on the same object instance at the same time.

Also, objects that communicate via an Internet protocol, such as SMTP, POP3, IMAP, FTP, HTTP, etc. should not be shared between threads. It is OK to have separate instances of a MailMan object (for example) that each has it’s own POP3 and/or SMTP session. But it doesn’t make sense for multiple threads to be trying to share the same POP3/SMTP/FTP/HTTP/IMAP/… session. The reason is that these protocols are stateful and not designed for “multiple conversations” to be occuring simultaneously w/ multiple clients in a single TCP/IP connected session.

August 20, 2008

No messages in POP3 mailbox?

Filed under: pop3 — Tags: — admin @ 5:19 am

Question:
I am reading my POP3 mailbox by calling mailman.CopyMail. It returns a bundle object, but the bundle.MessageCount = 0. I know there are emails in the mailbox. What happened?

Answer:
The most common mistake is that you’re looking at your email using a program such as Outlook and your emails have already been downloaded and removed from the POP3 server. After calling CopyMail, check the contents of the mailman’s Pop3SessionLog property — it is a string that may be displayed in your application. You should see the entire conversation between POP3 client (the Chilkat email component) and the POP3 server, including the response from the POP3 server that indicates 0 messages in the mailbox.

August 18, 2008

C# Encrypting/Decrypting with Stream

Filed under: C#, Encryption, stream — Tags: , , , , — admin @ 9:34 am

This C# example demonstrates how to use Chilkat.Crypt2 to encrypt and decrypting using the .NET FileStream class:

    Chilkat.Crypt2 crypt = new Chilkat.Crypt2();
    bool success = crypt.UnlockComponent("Anything for 30-day trial");
    if (!success)
    {
        MessageBox.Show(crypt.LastErrorText);
        return;
    }

    crypt.CryptAlgorithm = "aes";
    crypt.CipherMode = "cbc";
    crypt.KeyLength = 128;

    crypt.SetEncodedIV("0000000000000000", "hex");
    crypt.SetEncodedKey("abcdefghijklmnop", "ascii");

    // Open input and output files as file streams...
    FileStream fsIn = File.OpenRead("hamlet.xml");
    FileStream fsOut = File.Create("encrypted.dat");

    crypt.FirstChunk = true;
    crypt.LastChunk = false;
    byte [] encryptedChunk;

    // Encrypt the stream in 1024 byte chunks.
    byte[] b = new byte[1024];

    int n;
    while ((n = fsIn.Read(b, 0, b.Length)) > 0)
    {
        if (n < b.Length)
        {
            // Don’t encrypt the full 1024 bytes, only the amount read…
            byte[] tmp = new byte[n];
            int i;
            for (i = 0; i < n; i++) tmp[i] = b[i];
            encryptedChunk = crypt.EncryptBytes(tmp);
        }
        else
        {
            encryptedChunk = crypt.EncryptBytes(b);
        }

        fsOut.Write(encryptedChunk, 0, encryptedChunk.Length);
        crypt.FirstChunk = false;
    }
    fsIn.Close();

    // Flush any remaining encrypted data.
    crypt.LastChunk = true;
    byte[] empty = { };
    encryptedChunk = crypt.EncryptBytes(empty);
    if (encryptedChunk.Length > 0)
    {
        fsOut.Write(encryptedChunk, 0, encryptedChunk.Length);
    }
    fsOut.Close();

    // Now decrypt in chunks.  The decryptor must know when the last
    // block is being processed so it may unpad it correctly.

    System.IO.FileInfo fi = new System.IO.FileInfo("encrypted.dat");
    long fileSize = fi.Length;
    int numChunks = (int)fileSize / b.Length;

    fsIn = File.OpenRead("encrypted.dat");
    fsOut = File.Create("decrypted.xml");

    crypt.FirstChunk = true;
    crypt.LastChunk = false;
    byte[] decryptedChunk;

    int idx;
    for (idx = 0; idx <= numChunks; idx++)
    {
        n = fsIn.Read(b, 0, b.Length);

        // Is this the last chunk?
        if (idx == numChunks)
        {
            // Decrypt only the amount read…
            byte[] lastBlock = new byte[n];
            int i;
            for (i = 0; i < n; i++) lastBlock[i] = b[i];
            crypt.LastChunk = true;
            decryptedChunk = crypt.DecryptBytes(lastBlock);
        }
        else
        {
            decryptedChunk = crypt.DecryptBytes(b);
        }

        fsOut.Write(decryptedChunk, 0, decryptedChunk.Length);
        crypt.FirstChunk = false;
    }
    fsIn.Close();
    fsOut.Close();

    MessageBox.Show("Finished!");

August 6, 2008

UIDL Max Size? (for POP3)

Filed under: pop3 — Tags: , — admin @ 6:15 am

Question:
I’m trying to find out the maximum size of the POP3 UIDL.
I’ve found various POP3 specs, but they dont list field sizes.
Do you know the max size or can you give me any links to this info?

Answer:

The unique-id of a message is an arbitrary server-determined
string, consisting of one to 70 characters in the range 0×21
to 0×7E, which uniquely identifies a message within a
maildrop and which persists across sessions. This
persistence is required even if a session ends without
entering the UPDATE state. The server should never reuse an
unique-id in a given maildrop, for as long as the entity
using the unique-id exists.

August 4, 2008

Bandwidth throttling small amounts of data.

Filed under: HTTP — Tags: — admin @ 8:04 am

Question:
I’m sending ~50kb jpeg files alongside a very bandwidth-intensive
application, so I want to make sure that my application doesn’t use
more than 10kb/s, so that even those with slow connections will not have
this other application impacted by mine.

Answer:
Concerning bandwidth throttling — it only makes sense with larger amounts of data (much more than 50K). Here’s why: Sockets are used for sending and receiving data over TCP/IP connections. Buffering occurs at both the software (within Microsoft’s Winsock) and hardware levels. Therefore, an application might pass 50K to a socket “send” call and it would return immediately. It’s very difficult for an application to throttle a connection until a large stream of data is being sent (much larger than 50K). (We know this because throttling is implemented in Chilkat’s FTP2 component.) I would say that it make sense to “throttle” by delaying between 50K sends. Allowing the 50K in a “burst” but throttling many 50K transfers over time is probably the best you can do anyway.

POP3 Change Password Programmatically?

Filed under: pop3 — Tags: — admin @ 7:23 am

Question:

Is it possible to change the password for a POP3 account or create a POP3 account?

Answer:

Account management is not part of the POP3 protocol and therefore it is not possible to change POP3 passwords programmatically.

POP3 and SMTP multithread-safe?

Filed under: multi-threading — Tags: , , — admin @ 7:21 am

Question:
Is your component fully threadable? Is it thread safe to use in a multithreaded application?
Does it Supports multiple (simultaneous) connections?

Answer:

Yes, it’s safe for multi-threading. However, you cannot have several threads all trying to share the same POP3 or SMTP session at the same time because they would all interfere with each other — for example, one thread sends a message but another thread receives the response.

This applies to all Chilkat components that communicate with servers: FTP, HTTP, POP3, IMAP, SMTP, etc. the are all thread-safe, but you cannot expect multiple threads to be sending/receiving messages using the same instance of a Chilkat object simultaneously because they would all interfere with each other.

You may achieve multiple (simultaneous) connections by instantiating multiple instances of the mailman object — each would have its own session.

Download for Vista x64 (64-bit Microsoft Vista)

Filed under: Vista, x64 — Tags: , — admin @ 6:24 am

Question:
I get an error when trying to load ChilkatDotNet2.dll on Vista x64:

An attempt was made to load a program with an incorrect format.

Does Chilkat have an x64-compatible .NET assembly?

Answer:
Yes, download the x64-compatible DLL from this URL:
x64 compatible ChilkatDotNet2.dll

Make sure you deploy the x64 DLL to the 64-bit Vista system. You may develop your application on a 32-bit system using the 32-bit ChilkatDotNet2.dll, just make sure you’re deploying the same version of the x64 ChilkatDotNet2.dll. The .NET runtime will not allow you to reference one version and use another at runtime.

Newer Posts »