Quantcast
Channel: Chilkat Forum - latest questions
Viewing all 1061 articles
Browse latest View live

Insert a cert in a xml document signed using ws-security


SFTP CreateDir Unicode String(VC++)

$
0
0

CkSFtpW sftp;

//-- Connect sftp server ....

// Create a new directory:

success = sftp.CreateDir(L"家");

if (success != true) {

strOut.appendU(sftp.lastErrorText());

strOut.appendU(L"\r\n");

SetDlgItemText(IDC_EDIT1,strOut.getUnicode());

return;

}

ChilkatLog:

CreateDir:

DllDate: Dec 27 2016

ChilkatVersion: 9.5.0.65

UnlockPrefix: Anything for 30-day trial

Architecture: Little Endian; 32-bit

Language: Visual C++ 9.0 (32-bit)

VerboseLogging: 0

SshVersion: SSH-2.0-WeOnlyDo-wodFTPD 3.3.0.424

SftpVersion: 3

createDir:

  path: 家

  StatusResponseFromServer:

    Request: FXP_MKDIR

    InformationReceivedFromServer:

      StatusCode: 5

      StatusMessage: Bad message

    --InformationReceivedFromServer

  --StatusResponseFromServer

--createDir

Is it impossible to create a directory with Unicode string?

Oauth woocommerce

$
0
0

Hello,

I am trying to connect to woo commerce api with you dll. I am getting the following error -

Microsoft VBScript runtime error '800a01ad'

ActiveX component can't create object: 'Chilkat_9_5_0.Rest'

The code I have so far is below. I do currently use the ChilkatAx-9.5.0-x64.dll for decryption. I believe I downloaded that in February of 2016. Do I need to download the dll again? If so can I just copy it over the current dll or do I need to copy it and register it on my server?

Dim fso, outFile, glob, success, oauth1, rest Set fso = CreateObject("Scripting.FileSystemObject") 'Set outFile = fso.CreateTextFile("output.txt", True)

'__

' The Chilkat API can be unlocked for a fully-functional 30-day trial by passing any ' string to the UnlockBundle method. A program can unlock once at the start. Once unlocked, ' all subsequently instantiated objects are created in the unlocked state. ' ' After licensing Chilkat, replace the "Anything for 30-day trial" with the purchased unlock code. ' To verify the purchased unlock code was recognized, examine the contents of the LastErrorText ' property after unlocking. For example: set glob = CreateObject("Chilkat_9_5_0.Global") success = glob.UnlockBundle("Anything for 30-day trial") If (success <> 1) Then response.write glob.LastErrorText End If

' The LastErrorText can be examined in the success case to see if it was unlocked in ' trial more, or with a purchased unlock code. response.write glob.LastErrorText

'___

' Demonstrates how to do OAuth1 authentication for a Wordpress site using Woo Commerce.

' This example requires the Chilkat API to have been previously unlocked. ' See Global Unlock Sample for sample code.

' Prepare an OAuth 1.0 object for use with the Chilkat REST API. set oauth1 = CreateObject("Chilkat_9_5_0.OAuth1") oauth1.ConsumerKey = "ck_fa3d53ffa360d45a6cafa292389d7a54c4856054" oauth1.ConsumerSecret = "cs_26a2ceb63ad63b6452d731ffb8a162fe7d0980e2"

' The signature method can be HMAC-SHA1 or HMAC-SHA256 oauth1.SignatureMethod = "HMAC-SHA256"

' The OauthUrl property will need to be updated each time a request is sent. ' The domain here must match the domain passed to the Connect method (below). ' The domain must be exact. For example, "www.your-wordpress-site.com" vs. "your-wordpress-site.com". ' One might work while the other does not.. oauth1.OauthUrl = "http://exhibitorparty.com/wc-api/v3/orders"

' The OAuthMethod property will be set automatically when the REST request is sent. ' Setting it here is not actually necessary. oauth1.OauthMethod = "GET"

' Generate an initial nonce so that Chilkat knows the desired size of the nonce. success = oauth1.GenNonce(32)

set rest = CreateObject("Chilkat_9_5_0.Rest")

AES with Outlook?

$
0
0

AES with Outlook seems to be a quite a big problem looking at various forums. Have you had any experience with this issue when using AES256 for encryption algorithm when sending mails using Chilkat ?

email body content is sent as an attachments(ATT00001.htm)

$
0
0

When sending the mail using chilkat.net Mailman, The email body content is sent as an attachments(ATT00001.htm) . On analysis it is due to Microsoft exchange server issue which convert the body content to attachment only when the email has any attachments.

As per the below solution the body content should be set as First before the attachments(hope so in mime file). https://support.microsoft.com/en-gb/help/969854/the-body-of-a-message-is-shown-incorrectly-as-an-attachment-if-you-try-to-use-an-application-in-an-exchange-server-environment-to-send-a-message-that-includes-attachments

below is the .net code used to send the mail.

Email.AddFileAttachment(ImagePath) Email.SetHtmlBody(Htmlcontent) Mailman.SendEmail(Email);

how to achieve this or any other solution to avoid the body content as attachments.

Thanks in Advance Rajesh

Calling CkDkim_Create() crashes

$
0
0

Hi Chilkat,

I'm having problem DKIM signing my emails using the the DKIM functions in Delphi DLL (from Delphi XE2)

I have a general function SendMailUsingChilkat(), that sets up a Mailman and Email object. If useDkim it true, it setups the DKIM object and signes and send the email.

The first time there is no problem and the mail is sent (and even verify using CkDkim_VerifyDkimSignature). The second time it the second time it crashes, when calling CkDkim_Create()

best regards

Torben

Here the code:

procedure SendMailUsingChilkat(Mess: widestring;
        subject: widestring;
        mailaddress : widestring;
        smtpserver : widestring;
        fromAddress : widestring = 'dummy@dummy.com';
        fromName : widestring = '';
        bccAddress : widestring = '';
        asHtml : boolean = false;
        Attachments : TStrings = nil;
        replyToAddress : widestring = '';
        logProc : TLogProc = nil;
        useDkim : boolean = true;
        benchmark : boolean = false);
var
  mailman : HCkMailMan;
  success : boolean;
  html : widestring;
  email : HCkEMail;
  dkim: HCkDkim;
  Recp : TStringList;
  i : integer;
  contentType : pWideChar;
  str : WideString;
  mimeData: HCkByteData;
  dkimSignedMime: HCkByteData;
  strTo: widestring;
  starttime : DWORD;
begin
  if Assigned(logProc) and benchmark then
    starttime := GetTickCount;

  Recp := TStringList.Create;
  mailman := CkMailMan_Create();

  try
    success := CkMailMan_UnlockComponent(mailman,CHILKAT_MAIL_UNLOCK_KEY);

    if (success <> true) then
      raise exception.create('Failed unlocking mailman component. Message: ' + CkMailman__LastErrorText(mailman));

    CkMailMan_putSmtpHost(mailman,PWideChar(smtpserver));
//not needed CkMailMan_putSmtpUsername(mailman,'myLogin');
//not needed CkMailMan_putSmtpPassword(mailman,'myPassword');
//not needed CkMailMan_putSmtpPort(mailman,587);

    email := CkEmail_Create();

    CkEmail_putSubject(email,PWideChar(subject));

    if asHtml then
    begin
      Mess := ubvStringReplace(Mess,#13#10,'',[rfReplaceAll]);
      CkEmail_SetHtmlBody(email,PWideChar(Mess));
      CkEmail_putCharset(email,'UTF-8');
    end
    else
    begin
      CkEmail_putBody(email,PWideChar(Mess));
    end;

    CkEmail_putFrom(email,PWideChar(FromAddress));

    if FromName <> '' then
      CkEmail_putFromName(email,PWideChar(FromName));

    Recp.Text := ubvStringReplace(mailaddress, ';', #13, [rfReplaceAll]);

    for i:=0 to Recp.Count-1 do
    begin
      CkEmail_AddTo(email,PWideChar(Recp[i]),PWideChar(Recp[i]));
    end;

    if bccAddress <> '' then
    begin
      Recp.Text := ubvStringReplace(bccAddress, ';', #13, [rfReplaceAll]);

      for i:=0 to Recp.Count-1 do
      begin
        CkEmail_AddBcc(email,PWideChar(Recp[i]),PWideChar(Recp[i]));
      end;
    end;

    if replyToAddress <> '' then
    begin
      CkEmail_putReplyTo(email,PWideChar(replyToAddress));
    end;

    if Assigned(Attachments) then
    begin
      for i:=0 to Attachments.Count-1 do
      begin
        str := Attachments[i];
        CkEmail__AddFileAttachment(email,PWideChar(str));
        if not CkEmail_getLastMethodSuccess(email) then
          raise exception.Create('Failed to attach file ' + Attachments[i] + ' to email: ' + CkEmail__LastErrorText(email));
      end;
    end;

    if useDkim then
    begin
      try
        //render email to mimeData
        mimeData := CkByteData_Create();
        success := CkMailMan_RenderToMimeBytes(mailman,email,mimeData);
        if (success <> true) then
           raise exception.create('Failed render email to mimebytes. Message: ' + CkMailman__LastErrorText(mailman));

        //setup dkim object
        dkim := CkDkim_Create();    // <--- It always crashes here the second time

        success := CkDkim_UnlockComponent(dkim,CHILKAT_S_MIME_UNLOCK_KEY);
        if (success <> true) then
           raise exception.create('Failed unlocking dkim component. Message: ' + CkDkim__lastErrorText(dkim));

        CkDkim_putDkimDomain(dkim,MAIL_DKIM_DOMAIN);
        CkDkim_putDkimSelector(dkim,MAIL_DKIM_SELECTOR);

        success := CkDkim_LoadDkimPkFile(dkim,MAIL_RSA_PEM_FILE,MAIL_RSA_PEM_FILE_PASSWORD);
        if (success <> true) then
           raise exception.create('Failed to load rsa file ' + MAIL_RSA_PEM_FILE + '. Message: ' + CkDkim__lastErrorText(dkim));

        //add the DKIM-Signature header to mime and returns the new mime with DKIM-Signature added.
        dkimSignedMime := CkByteData_Create();
        success := CkDkim_AddDkimSignature(dkim,mimeData,dkimSignedMime);
        if (success <> true) then
           raise exception.create('Failed to add dkim signature. Message: ' + CkDkim__lastErrorText(dkim));

        //verify signature 
        if CkDkim_VerifyDkimSignature(dkim,0,dkimSignedMime) then
        begin
           if Assigned(logproc) then
             LogProc('Signature in mimeBytes was succesfully verfied');
        end
        else
           raise exception.create('Failed to verify dkim signature. Message: ' + CkDkim__lastErrorText(dkim));

        //send signed mimebytes (email)
        strTo := ubvStringReplace(mailaddress, ';',',', [rfReplaceAll]);
        success := CkMailMan_SendMimeBytes(mailman,PWideChar(FromAddress),PWideChar(strTo),dkimSignedMime);
        if (success <> true) then
           raise exception.create('Failed to send mimebytes / email. Message: ' + CkMailman__LastErrorText(mailman));
      finally
        CkByteData_Dispose(mimeData);
        CkByteData_Dispose(dkimSignedMime);
        CkDkim_Dispose(dkim);
      end;
    end
    else
    begin
      //normal send (without dkim)
      success := CkMailman_SendEmail(mailman,email);
      if (success <> true) then
         raise exception.Create('Sending mail failed with message: ' + CkMailman__LastErrorText(mailman));
  //debug    CkEmail_SaveXml(email,PWideChar(ExtractFilePath(ParamStr(0))+'last_mail.xml'));
    end;

    success := CkMailman_CloseSmtpConnection(mailman);
    if (success <> true) then
       raise exception.Create('Connection to SMTP server not closed cleanly.');
  finally
    FreeAndNil(Recp);
    CkMailMan_Dispose(mailman);
    CkEmail_DropAttachments(email);
    CkEmail_Dispose(email);
    if Assigned(logProc) and benchmark then
       logProc('Total duration of SendMailUsingChilkat(): ' + IntToStr(GetTickCount - starttime) + ' millisec.');
  end;
end;

SSH component not working on all my devices

$
0
0

All:

I've run into a problem with the SSH component for PCs. I've written a class library in C# (VS 2015 community edition). The library uses Chilkat SSH to manage connections and send queries to my video codecs (Cisco C40, C90, SX20). Everything tests and runs fine on my main two main development machines, my laptop development machine (these three are all running Visual Studio) and my Surface Pro 3.

However, when I try to install my application on any other machine (Win7 or 10), the setup package created in Visual Studio fails.

If I copy the files over from my build file from the release folder (including all dlls, my forms) the application does not start. I am not reading/writing to the registry.

I have built the application as AnyCPU, x64, x86, making sure that my target platform, build platform, and .NET framework all match and I still have the problem.

Any idea why I can get this to run smoothly on my development computers, but not my deployment machines. I do not have any relative paths in the code and all dlls are sitting in the application folder.

Thanks for any help. Norm

Ssh returning stdin not a terminal error

$
0
0

I am connecting to an audio signal processor with the SSH component. I am having no problems with connecting (debugged step-by-step) and came out the other side just fine. The problem occurs when I try to send or receive information from the device. I get an "stdin is not a terminal" exception. I'm in C#, the Reference has been added properly, using newest Chilkat software (managed through NuGet - December 2016 version).

Any clues?

Here's my code

Ssh client = new Ssh(); . . Connection/Authentication code follows - tests ok .

          public string GetSerialNumber()
            {
                client.SendReqShell(channelNumber);
                client.ChannelSendString(channelNumber, "DEVICE get serialNumber\r\n","ansi");
                client.ChannelReceiveUntilMatch(channelNumber,"+OK","ansi",false);
                DeviceResponse = client.GetReceivedText(channelNumber, "ansi");
                return DeviceResponse;
            }

Thanks for any help.


Create Woocommerce order with Chilkat DLL

$
0
0

I have been working with the Chilkat Chilkat_9_5_0.Rest to connect to woocommerce API.

I can successfully retrieve a list of orders using this line of code -

responseJson = rest.FullRequestNoBody("GET","/wc-api/v3/orders/")

Now I need to be able to place an order using VBScript. Has anyone done this? I believe I need to call the same orders, but I cannot figure out how to sent the parameters I need to place the order. Does anyone have an example of doing this in VB Script with the Chilkat dll?

Thanks in advance!

PKCS7 enveloping and sign a string

$
0
0

I have a code written in C# to sign and envelop a string to be sent to a web service, this code receives a certificate in the format ".pfx" and the certificate password

        string myString = "Hello World";
        X509Certificate2 cert = new X509Certificate2(@"<MY PFX FILE>", "<MY PASS>");
        CmsSigner signer = new CmsSigner(SubjectIdentifierType.IssuerAndSerialNumber, cert);
        signer.DigestAlgorithm = new Oid("<MY OID>");

        ContentInfo content = new ContentInfo(new Oid("<MY OID>"), new System.Text.UTF8Encoding().GetBytes(myString));
        SignedCms signedCms = new SignedCms(content, false);

        signedCms.ComputeSignature(signer, false);

        var asig = signedCms.Encode();

Now I need to write a code that does exactly the same thing, but in C, after performing several searches on google, I found this lib.

Knowing that I have to write a program that is cross-platform.

I found this example: https://www.example-code.com/C/rsa_sign_base64_pfx.asp

But in this example, the system create a rsa do encrypt the message...

But I did not find how I could sign and envelop the message, just like I am doing in C#, with OID... Thanks in advance if anyone can help me, how can I do the same thing I do in C# in C.

PKCS12 sign a string

$
0
0

I have a code written in C# to sign and envelop a string to be sent to a web service, this code receives a certificate in the format ".pfx" and the certificate password

        string myString = "Hello World";
        X509Certificate2 cert = new X509Certificate2(@"<MY PFX FILE>", "<MY PASS>");
        CmsSigner signer = new CmsSigner(SubjectIdentifierType.IssuerAndSerialNumber, cert);
        signer.DigestAlgorithm = new Oid("<MY OID>");

        ContentInfo content = new ContentInfo(new Oid("<MY OID>"), new System.Text.UTF8Encoding().GetBytes(myString));
        SignedCms signedCms = new SignedCms(content, false);

        signedCms.ComputeSignature(signer, false);

        var asig = signedCms.Encode();

Now I need to write a code that does exactly the same thing, but in C, after performing several searches on google, I found this lib.

Knowing that I have to write a program that is cross-platform.

I found this example: https://www.example-code.com/C/rsa_sign_base64_pfx.asp

When I try this sample, but, the C# version, with my PFX file, the result is complete different...

I did not find how I could sign the string, just like I am doing in C#, with OID... Thanks in advance if anyone can help me, how can I do the same thing I do in C# in C.

Zip :: File names encoding

$
0
0

Hi, I have a zip file (created on a Linux machine) having an EnDash in the file name. When I read the file contents either looping through with GetEntryByIndex() or by reading the structure with GetDirectoryAsXML(), the file name has a "funny" character instead of the EnDash.

The HEX ecnoded name is also wrong.

Is there any way to set how Chilkat zip reads the content?

FTP2 DeleteTree not works with large directory tree, crashes continuosly

$
0
0

ChilkatLog: DeleteTree: DllDate: Nov 12 2016 ChilkatVersion: 9.5.0.64 UnlockPrefix: License_Prefix Architecture: Little Endian; 32-bit Language: ActiveX VerboseLogging: 0 Component successfully unlocked using purchased unlock code. ProgressMonitoring: enabled: yes heartbeatMs: 0 sendBufferSize: 65536 --ProgressMonitoring removeRemoteDir: simplePathCommand: simpleCommand: sendCommand: sendingCommand: RMD BackupSession --sendCommand readCommandResponse: replyLineQP: 250 RMD command successful --readCommandResponse --simpleCommand --simplePathCommand --removeRemoteDir removeRemoteDir: simplePathCommand: simpleCommand: sendCommand: sendingCommand: RMD NoDocumentados_FR --sendCommand readCommandResponse: replyLineQP: 250 RMD command successful --readCommandResponse --simpleCommand --simplePathCommand --removeRemoteDir simplePathCommand: simpleCommand: readCommandResponse: WindowsError: Se ha forzado la interrupción de una conexión existente por el host remoto. (Interruption of an existing connection by the remote host has been forced) WindowsErrorCode: 0x2746 numBytesRequested: 5 Failed to receive data on the TCP socket sockRecv: Socket fatal error. Failed to read beginning of SSL/TLS record. b: 0 dbSize: 0 nReadNBytes: 0 Failed to receive more TLS applicaton data. Failed to read FTP control channel reply. readFtpReply: Socket fatal error. --readCommandResponse --simpleCommand Simple path command failed. socketResults: Socket fatal error. --simplePathCommand Failed to delete file filename: /BisoftLib/Source/BakHistory/FormEnvioEmail_20160509_084730.Zip --DeleteTree --ChilkatLog

Example "Send Email Asynchronously using a Task" not really async for Xojo

$
0
0

I'm trying to send mails with the above example. Sending the mail works fine. However, with the task the UI shouldn't be frozen. Instead I get the pizza and my progress wheel doesn't show up.

Bug, feature, am I doing something wrong?

Xojo 2016r4, Chilkat plugin from June. Mac OS 10.11.

Mit freundlichen Grüßen/Regards

Beatrix Willius

http://www.mothsoftware.com Mail Archiver X: The email archiving solution for professionals

Feature request for Xojo: plugin segmentation

$
0
0

I work in Xojo with a lot of plugins: a few Einhugur, Valentina, MBS and Chilkat. Xojo has a maximum number of functions that can be registered for plugins. A few days ago I ran again into this limit. This makes a nice hard crash in Xojo. I was really very lucky that they had already changed this for an upcoming version.

Therefore my feature request: please think about segmenting your plugin into multiple plugins. At the moment it's not urgent - just something to think about in the future.


How do I parse multipart/digest mails?

$
0
0

I'm trying to parse an old mail that is multipart/digest. When using the example "ExaminEml" I correctly get

multipart/mixed text/plain text/plain multipart/digest message/rfc822 message/rfc822 and so on. text/plain

as result.

But how do I access the parts with multipart/digest and message/rfc822? Both GetPlainTextBody and GetHtmlBody only have the text/plain part. NumAttachedMessages is 0. I've uploaded the email to http://www.mothsoftware.com/downloads/digest.eml .

Xojo 2016r4.1, MacOS 10.11.6, latest Chilkat plugin.

Mit freundlichen Grüßen/Regards

Beatrix Willius

http://www.mothsoftware.com Mail Archiver X: The email archiving solution for professionals

Monitoring SSH command process on unix server

$
0
0

I want to send and execute commands on a unix server.

when I send the command I would like to update the user as to the status of the job. Even being able to say 'The job is still running' would be helpful. Is there a way to do this?

Send Email to more Recipients but one with bad address

$
0
0

Hello if I send an email to multiple recipients including an address it is invalid for example using the Outlook mail is sent and then I get a "Mail Delivery Subsystem" that tells me that the X address is incorrect. If I do the same thing with Chilkat and let AllOrNone = false, the emails start, but the mail is not sent to the wrong address and not getting any "Mail Delivery Subsystem". I need to configure the component in a specific way?

To simplify the problem I tried to send mail to only one recipient. (With deliberately wrong address). Here too, Outlook and then send the SMTP then sends the mail to the sender of "mail Delivery Subsystem" while Chilkat returns false from the Send method and reading the log read:

"Rcpt_to:       SmtpCmdSent: RCPT TO: wertyuss@fdsdfgshadt.it<crlf>       SmtpCmdResp: 550 5.1.1 rnwW1u00G05CKdh01nwWY8 fdsdfgshadt.it invalid domain / invalid destination domain       550 5.1.1 rnwW1u00G05CKdh01nwWY8 fdsdfgshadt.it invalid domain / invalid destination domain       Failed When sending the RCPT TO: wertyuss@fdsdfgshadt.it      lastResponseLine: 550 5.1.1 rnwW1u00G05CKdh01nwWY8 fdsdfgshadt.it invalid domain / invalid destination domain       bad_address: wertyuss@fdsdfgshadt.it "

I need to have the same behavior in Outlook. (In the example I using the same SMTP)

Updating Legacy VB6 from ChilkatEmail DLLs to Active X

$
0
0

I inherited a legacy VB6 app that sends email using Chilkat Mail 5.1 that now needs to use SMTP TLS, but apparently the StartTLS property doesn't exist in Chilkat Mail 5.1. I downloaded and installed the newest Active X component (v9.5) and added the reference to the project, but am having trouble translating methods and properties to the new component.

Let me preface this by saying I have limited experience with VB, but here are my old declarations:

Dim Mailer As New CHILKATMAILLib.ChilkatMailMan
Dim MailFactory As New CHILKATMAILLib.EmailFactory
Dim msg As CHILKATMAILLib.IChilkatEmail

I tried using these declarations...

Dim Mailer As New ChilkatMailMan
Dim MailFactory As New ChilkatEmail
Dim msg As New ChilkatEmail

...but trying to invoke the method Set msg = MailFactory.NewEmail fails. I also tried invoking EmailBundle as MailFactory and use Set msg = MailFactory.AddEmail but that doesn't work either.

I know I'm not giving much to go on, but any help would be greatly appreciated as I an out of my depth here.

Thanks in Advance, vin

C++ Builder: Error detected (LME288) when linking

$
0
0

I get the following error when linking with C++ Builder (XE*)

[ilink32 Warning] Warning: unknown heap name   : 0x08000000 / 0x08000000
[ilink32 Warning] Warning: Error detected (LME288)

What to do?

Viewing all 1061 articles
Browse latest View live