January 26, 2012

Undefined symbol: _res_9_query

Filed under: IOS, Linking, MAC OS X — Tags: , , — admin @ 2:33 pm

Question:

I had some IMAP code working with Chilkat iOS 9.2.1 version. Tried upgrading to 9.3.0 (wanted to use the new attachments functionality) and got the following error:

Undefined symbols for architecture i386:
“_res_9_query”, referenced from:
ChilkatResolve::mxLookup(char const*, ScoredStrings&, LogBase&, bool) in libchilkatIos.a(ChilkatResolve.o)
ChilkatResolve::dkimLookup(char const*, StringBuffer&, LogBase&, bool) in libchilkatIos.a(ChilkatResolve.o)
ChilkatResolve::bestMxLookup(char const*, StringBuffer&, LogBase&, bool) in libchilkatIos.a(ChilkatResolve.o)
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)

It is building fine for Device scheme, and only fails for Simulator scheme.
Any advice?

Answer:

Add “-lresolv” to your list of link libraries.

(A quick way to find a solution for unresolved externals such as this is to Google “Undefined symbol _res_9_query”.    It surprises me how many programmers never think to use Google to quickly find a solution…)

January 24, 2012

(FTPS) 530 No client certificate presented.

Filed under: FTP — Tags: , , — admin @ 7:43 am

If this FTP server response is seen in the LastErrorText, it means that the SSL/TLS connection requires a client-side certificate with private key.   Prior to connecting, the client-side certificate should be specified by calling the SetSslClientCert, or SetSslClientCertPfx.  Make sure to check the return value of these methods for success/failure.  If the SetSslClientCert* method fails, then no client-side certificate has been set, and the Chilkat SSL/TLS handshake implementation will send a 0-length client-side certificate, which is the correct response for servers that request a client-side cert but don’t actually require it.

If the certificate object passed to SetSslClientCert is a pre-installed certificate on the Windows operating system, then make sure it was installed from the PFX such that the private key is exportable.  Chilkat’s SSL/TLS handshake code needs access to the client-side private key when a client-side cert is required.

January 19, 2012

Chilkat supports CAdES-BES and CAdES-EPES digital signatures

Filed under: CAdES, MIME, Signature — Tags: , , — admin @ 10:27 am

Chilkat v9.3.0, being released this week, now supports the ability to create CAdES-BES and CAdES-EPES digital signatures via the MailMan, Mime, and Crypt2 objects.   All three objects/classes now include the following new properties:

bool CadesEnabled;
string CadesSigPolicyId;
string CadesSigPolicyUri;
string CadesSigPolicyHash;  (base64 encoded representation of hash)

To create a CAdES-BES signature, simply set the CadesEnabled property = true.

For CAdES-EPES, set each of the other new properties.  For example:

crypt.CadesSigPolicyId = “2.16.76.1.7.1.1.1″;
crypt.CadesSigPolicyUri = “http://politicas.icpbrasil.gov.br/PA_AD_RB.der”;
crypt.CadesSigPolicyHash = “rySugyKaMhiMR8Y/o5yuU2A2bF0=”;

If you set these properties prior to calling any method that creates a signature, then a CAdES signature is created.

IMAP: Download email without attachments and downloading attachments separately.

Filed under: IMAP — Tags: — admin @ 10:14 am

Chilkat version 9.3.0, being released this week, includes new IMAP functionality to fetch emails without downloading attachments, and then subsequently fetch attachments one at a time separately.

There is a new boolean property named “AutoDownloadAttachments”, which has  a default value of True (YES).  If set to False (NO), then all Fetch* methods will not download attachments.

Note:  “related” items are downloaded.  These are images, style sheets, etc. that are embedded within the
HTML body of an email, and are not considered attachments.

Also:  All signed and/or encrypted emails must be downloaded in full.

When an email is downloaded without attachments, the attachment information is included in header fields.  The header fields have names beginning with “ckx-imap-”.  The attachment information can be obtained via the following methods:

imap.GetMailNumAttach
imap.GetMailAttachFilename
imap.GetMailAttachSize

Individual attachments can be downloaded via the newly added FetchAttachment* methods:

  1. FetchAttachment:  Downloads an attachment and saves to a file.
  2. FetchAttachmentBytes:  Downloads an attachment to an in-memory byte array.
  3. FetchAttachmentString: Downloads an attachment to a string variable.

Here are the FetchAttachment* method signatures in Objective-C:

// method: FetchAttachment
- (BOOL)FetchAttachment: (CkoEmail *)email
attachIndex: (NSNumber *)attachIndex
saveToPath: (NSString *)saveToPath;

// method: FetchAttachmentBytes
- (NSData *)FetchAttachmentBytes: (CkoEmail *)email
attachIndex: (NSNumber *)attachIndex;

// method: FetchAttachmentString
- (NSString *)FetchAttachmentString: (CkoEmail *)email
attachIndex: (NSNumber *)attachIndex
charset: (NSString *)charset;

Cocoa Asynchronous Methods and Event Callbacks

Filed under: asynchronous, cocoa, events, release notes — Tags: , , , , — admin @ 9:46 am

Chilkat v9.3.0 for Cocoa now includes the asynchronous functionality and event callback functionality that has been available in the C++ libs.

Asynchronous methods run in a background thread such that the call immediately returns to the application.  Events are not fired w/ asynchronous method calls — your app would periodically check to see if the background task is finished.

To implement an event callback, your app would define/implement a class that inherits from one of the Cko*Progress base classes.  You provide method implementations to override the methods specified in the Cko*Progress classes (see the header files).  The callback object is specified via the EventCallbackObject property.  For example:

// property setter: EventCallbackObject
- (void)setEventCallbackObject: (CkoFtp2Progress *)eventObj;

Chilkat v9.3.0 Release Notes

Filed under: release notes — Tags: — admin @ 9:31 am

Chilkat v9.3.0 is in the process of being released this week.  The release notes (below) detail the changes, fixes, new features, etc. regarding the new version.

  1. (Crypt2, MIME, MailMan) Now supports the ability to create CAdES-BES and CAdES-EPES digital signatures.   See CAdES for more information.
  2. (IMAP) Added the ability to download emails without attachments, and to download attachments separately.  See Download email without attachments and downloading attachments separately for more information.
  3. (MACOSX, IOS) Eliminated the SIGPIPE exception that can occur when a socket write is attempted after the previously connected peer disconnects.
  4. (Email) No longer includes the “This is a multi-part message in MIME format.” line in multipart/mixed messages.  Note: The presence of this line is very common and transparent (i.e. it is not visibly seen when viewing an email in an email client such as Outlook or Thunderbird).
  5. (IMAP) The “ckx-imap-internaldate” header field is now added to emails downloaded from IMAP servers.  This allows for subsequent calls to AppendMail to restore the same internal date when uploading the email to a new IMAP server or to another mailbox on the same IMAP server.
  6. (IMAP) Exception in CRAM-MD5 authentication fixed.
  7. (Email) Modified the automatic generation of the Message-ID header field so that it never tries to fetch the hostname via DNS.  The simple instantiation of an email object should never do anything that would implicitly require network communications.
  8. (Compression) PPMD is not yet available in 64-bit non-Windows apps.  Any attempt to use it in CkCompression (CkoCompression) will result in a false return status indicating failure.  Use Deflate, Bzip2, or Lzo instead.
  9. (Ftp2, HTTP, Socket) Asynchronous functionality is now enabled for all non-Windows operating systems.  See Cocoa Asynchronous Methods and Event Callbacks for more information.
  10. (Self-Extracting EXE) The self-extracing EXE’s now correctly maintain last-modification dates/times.
  11. (Charset) Fixed Charset.HtmlEntityDecode to handle non-ANSI HTML.
  12. (C++ on Linux, MacOSX, IOS, Android) May need to link with the system libraries “-lresolv” and “-lpthread”.
  13. DKIM and SSH Tunneling now supported across all operating systems/programming languages, with the exception that DKIM is not yet available on Android.
  14. (Atom on ActiveX) Fixed ChilkatAtom.GetEntry method.
  15. (XML) Added Xml.GetChildWithAttr method.
  16. (FTP2) Added HTTP proxy support to FTP2 (forces Passive mode if an HTTP proxy is used).
  17. (Bounce) Added BounceType 15 (for abuse/fraud feedback reports).
  18. (Zip) Fixed Zip date/time issues for years after 2037.
  19. (XML) Fixed memory leaks in RemoveChildByIndex and RemoveChildWithContent methods.
  20. (Upload) Fixed the PercentUploaded property — a divide-by-zero exception occurred if first access happened while the total is still 0.
  21. (SSH / SFTP) Added the ForceCipher property to allow the encryption algorithm to be explicitly chosen.
  22. (MacOSX C++) Mac C++ libs have changed to these new names:
    libDyn/libchilkat.dylib
    libStatic/libchilkat.a
    libDyn/libchilkat_i386.dylib
    libStatic/libchilkat_i386.a
    libDyn/libchilkat_x86_64.dylib
    libStatic/libchilkat_x86_64.a
    The dynamic libs now use “@executable_path”, so the .dylib (if used) can be placed in the same directory as your EXE.
  23. (CSV) Csv.LoadFromString always returned false even when successful.  This is now fixed.
  24. (RSA) Somewhat rare OAEP padding related decrypt issue fixed.  (The problem was on the decrypt side, not on the encrypt side.)
  25. (XML) Added the CopyRef method.
  26. (Crypt2) Added new methods for signature date/times: GetSignatureSigningTime and HasSignatureSigningTime.
  27. (RSA) Fixed PSS padding issue for signatures using PSS padding.
  28. (MailMan/C++) CkMailMan::SetProgressCallback is deprecated.  Use put_EventCallbackObject instead.
  29. (Zip/C++) CkZip methods with “CkZipProgress *” as final argument are deprecated.  Use put_EventCallbackObject in combination with the methods that do NOT include the “CkZipProgress *” argument.
  30. (FTP2) Internally, the “EPRT” command (instead of “PORT”) is automatically used if the TCP connection is IPv6.
  31. (XML ) The GetXml method now includes the XML declaration when getting the XML of the document root, otherwise it does not.  The extra blank line between the XML declaration and the root node is now removed.
  32. (HTTP) Added the DownloadHash method, which allows a file to be downloaded such that the downloaded bytes are discarded and a hash of the bytes is returned.
  33. (PHP) This error is fixed:undefined symbol: zend_error_noreturn in Unknown on line 0This error does not occur in PHP 5.3.8 or later. The error is a bug in PHP and is described here:
    http://stackoverflow.com/questions/2556113/swig-generated-code-fails-to-run-on-php-5-3-2-undefined-symbol-zend-error-noret
  34. (MacOSX) Objective-C libs compiled with -fobjc-gc  so that both GC and retain/release logic is present.
  35. (HTML-to-Text) Added the SuppressLinks property to suppress the inclusion of URLs found in links.  To maintain backward compatibility, false/0 is default property value.
  36. (HTML-to-Text) Added  the DecodeHtmlEntities property so that HTML entities can be automatically decoded.  To maintain backward compatibility, false/0 is default property value.
  37. (Compression) The Charset property had an undefined default value.  It now defaults to “utf-8″.
  38. (Email) The AddRelateData and AddRelatedData2 methods were missing for Java, Perl, Python, Ruby, and PHP.  These methods have been added.
  39. (HTTP) DownloadAppend and ResumeDownload methods fixed for Gzipped HTTP responses.
  40. (HTTP) The PostJson method was added to make JSON POST’s easy.
  41. (MailMan) Added the AutoSmtpRset property.  The default value is True, making it backward compatible so that the behavior is unchanged w/ previous versions.  When True, the “RSET” SMTP command is sent at the beginning of each email on an already-open connection (meaning it is not the 1st email sent on a connection).  This is done to ensure that the state of the connection is valid, clean, and ready for a new email.  A case was found where one SMTP server delayed by approx. 5 seconds in responding to the RSET command.  The AutoSmtpRset property provides a way to control whether the RSET command is automatically sent.
  42. (SshTunnel) Added the ClearTunnelErrors method (to clear TunnelErrors read-only property).
  43. (Zip) Added the SkippedForUnzip event , which is called if a file is not unzipped because it is not newer (for UnzipNewer method), or if a file is not unzipped because it would overwrite an existing file (when OverwriteExisting = false).
  44. (HTTP) Added the HttpResponse.SaveBodyBinary and SaveBodyText methods.   Makes it possible to save large responses directly to a file.
  45. (MIME) Added the UseXPkcs7 boolean property.   The default value is True to make it backward compatible.  This controls whether “x-pkcs7-signature” or “pkcs7-signature” is used for the Content-Type for PKCS7 signatures.    It also controls whether “x-pkcs7-mime” or “pkcs7-mime” is used for the Content-Type in PKCS7 encryption.   If UseXPkcs7 is True, then “x-pkcs-*” is used.
  46. (ActiveX) Versioning for all ActiveX DLL’s will now match the overall version (v9.3.0).
    If a new version of an individual DLL is released prior to the release of the next full-set version, it will be a sub-version, such as v9.3.0.1
  47. (ActiveX Email) The ChilkatMail_v8.dll ActiveX changed name to ChilkatMail2.dll   The “2″ reflects that the ActiveX object names, which have not changed, are ChilkatMailMan2, ChilkatEmail2, ChilkatEmailBundle2.    (This makes it consistent with other ActiveX DLLs/objects such as ChilkatZip2.dll, ChilkatCrypt2.dll, ChilkatFtp2.dll, etc.)

December 27, 2011

__dyld__dyld_start error when launching your iOS app

Filed under: IOS — Tags: — admin @ 9:00 am

A note from a Chilkat customer using the IOS 4.3/5.0 libraries:

…when running in the simulator, it ended up in gdb with a “__dlyd__dlyd_start message.

I looked around on Google and found this:

http://blog.ginzburgconsulting.com/__dyld__dyld_start-error-when-launching-your-ios-app/

So I added the -weak-lSystem flag in Xcode (Targets -> Your target -> Build Setting tab) and it’s running now.

December 5, 2011

Running Chilkat .NET 4.0 on Azure

Filed under: 4.0 Framework, Azure — Tags: — admin @ 7:34 am

See this Microsoft TechNet blog discussion about the solution:

http://social.technet.microsoft.com/Forums/en-US/windowsazuredevelopment/thread/8d7a39cc-0e14-49c0-9102-e705c2eec934#498ddad1-d250-418c-9463-2b8958329af3

In summary:

Connect with RDP to Azure image and install vcredist_x64.exe.

How to configure Azure RDP, you can find here:
http://msdn.microsoft.com/en-us/library/gg443832.aspx

Also See:
http://www.cknotes.com/?p=311

November 8, 2011

Format of AES, Blowfish, Twofish, 3DES, etc. Symmetric Encrypted Data?

Filed under: Encryption, aes, blowfish — Tags: — admin @ 7:11 am

Question:

I know it isn’t listed in the documentation, but is there any method to test whether a file has been previously encrypted or not?  I would like to perform decryption on a file, but only if it is already encrypted.

Answer:

A symmetric encryption algorithm is simply a transformation of bytes such that the output has the properties of randomly generated byte data.  There is no file format, and each byte value from 0×00 to 0xFF is virtually equally probable.

There is no single test that can be performed to determine if a file is already encrypted.  There are two solutions:

  1. Create your own test based on the  type of file being encrypted.  For example, if XML files are encrypted, then test to see if “<xml” is found in the beginning.
  2. Create your own simple “encrytped file format”.  For example, it could be as easy as writing a 4-byte “marker” at the beginning of every file containing encrypted data.  The marker would be a constant value, such as 0×01020304.  Your application could read the 1st 4 bytes of a file, and if equal to 0×01, 0×02, 0×03, 0×04, then it discards the marker and knows the remainder is the encrypted file data..

October 24, 2011

Java System.loadLibrary w/ GlassFish application server

Filed under: Java — Tags: , , — admin @ 2:40 pm

** The following is a helpful note from a Chilkat customer using the Chilkat Java API in a GlassFish environment:

FYI I managed to solve the problem. The following is what I did (in case you may want to help others with a similar need in future) to enable the RSA component to run within a Java EE6 web application using GlassFish v3

1. Copy the Chilkat native library to a path listed in java.library.path. The default on a Mac (OS X 10.6) is \System\Library\Java\Extensions.

2. Create a singleton class object in Java and place the call System.loadLibrary(String) within a static block (i.e. static { try { System.loadLibrary(”chilkat”); } catch (UnsatisfiedLinkError e) {//say or do something clever}}). There is excellent guidance about creating singletons at http://www.javacoffeebreak.com/articles/designpatterns/index.html and https://www.securecoding.cert.org/confluence/display/java/MSC07-J.+Prevent+multiple+instantiations+of+singleton+objects. Also create all necessary component manipulation methods (e.g. encrypt/decrypt) within the singleton.

3. Compile the singleton class into a jar file and make it available to the web application as a library resource.

4. Call the singleton from a convenient web application bean.

Newer Posts »