Jump to content

Davide Angeli

Members
  • Content Count

    107
  • Joined

  • Last visited

  • Days Won

    2

Posts posted by Davide Angeli


  1. I am also using the IDE on an HIDPI monitor and simultaneously on a regular one.

     

    I also find that the toolbars are all moved or gradually enlarged. In my case, it seems to me that the problem occurs when returning from a computer standby (returning from a lunch break) or even when only the monitor goes into standby because it has been inactive for a few minutes; in these cases, when the PC or monitor reactivates, I see the IDE flickering, and I find the toolbars messed up.

     

    To fix them, I also do right-click on the toolbars, select "customize," choose the displayed toolbars, and click the "reset" button, and almost always everything goes back to normal.

     

    With this issue, I have often found the sizes of the forms open in the IDE at that moment messed up. Now I am getting into the habit of closing the IDE when I'm not using it and if I have to step away from the PC (which is ridiculous!).

    • Like 1

  2. 768341683_F2084InternalError.thumb.png.2dbcaadda73952e2ff67bb4e7bf438ff.png

     

    With Delphi 12.1, this error has reappeared quite annoyingly... With Delphi 11.3, I had practically forgotten about it (it never happened to me). Obviously, the error is completely random and disappears when closing and reopening the IDE. But is there no way to get more information from the compiler about the error to understand if it's possible to do something to prevent it? However, it always occurs in the context of a global recompilation of a project group that contains both runtime packages, DLLs, and executables.


  3. 6 hours ago, Dave Nottage said:

    The biggest problem is when you create descendant forms (i.e. at design-time) where the ancestor contains frames. Otherwise, for me they're totally fine.

    Yes I totally agree I'm using frames in my projects sometimes in descendant forms and this is the biggest problem I have encountered. Especially in managing events on descendant frame components that often become disconnected. At some point I started managing and connecting them at runtime.

    • Like 1

  4. Hi, I'm using D11.3 on HIDPI monitor 3840x2160 with 200% zoom (Windows 11).

     

    I've just updated GExpert to latest r4210 and now I'm experiencing some annoying problems realated to hidpi:

    • "Procedure List" is unusable: the form is opened incredibly big it is even larger than the screen and only the first column with a very large font is visible. The only way to move is to press alt-space
    • The "Grep Results" window is a mess: has some parts very small, some big same normal..

     

    Grep Results:

    1642892848_GrepResults.thumb.png.c23c75301cd03802931d9cdc968ae1c1.png

     

    Procedure List

    979256734_procedurelist.thumb.png.432b6940b12c47818532916e4efed5bf.png


  5. I don't know if this can help and perhaps you have already done this, but according to FB4 documentation, to use embedded version to connect to one database from several applications, you need to set the parameter "ServerMode" as "Classic" in firebird.conf (this was the default behaviour of FB2.5 embedded now changed in FB4 in "Super").

     

    https://ib-aid.com/download/docs/fb4migrationguide.html (read section "1.5 Installing Embedded")

     

    firebird.conf comments:

    # ============================
    # Settings for Architecture Configuration
    # ============================
    
    #
    # Controls the method Firebird engine uses to work with databases and
    # related Firebird server startup parameters.
    #
    # The values are:
    # Super / ThreadedDedicated - databases are opened exclusive by single server process,
    #	attachments share single DB pages cache inside process
    # SuperClassic / ThreadedShared - databases are opened by single server process,
    #	but it does not prevent opening them in other processes (embedded access),
    #	each attachment has its own DB pages cache
    # Classic / MultiProcess - for each attachment to server a separate process is started,
    #	each database may be opened by multiple processes (including local ones for
    #	embedded access), each attachment (process) has its own DB pages cache
    #
    # Type: string
    #
    #ServerMode = Super
    

     

     

     

    • Like 1

  6. I spent some time to deep analize the MadExcept callstack and I discovered that the thread in exception was created by another thread not even executing (I can't find his "father" in the thread list reported by madExcept).

    Now I've rearranged same things in the steps involved in the app terminating phase to avoid this; I've also moved the IOmniTimedTask instance as a global variable to avoid strange dependencies. Now I cannot reproduce the error.

     

    So OTL seems working fine as usual!  It's always a mess working with threads!


  7. 1 hour ago, Lars Fosdal said:

    Does this trick have any effect?

    I abandoned that trail: the problem is not the REST call. I've substituted it with a sleep(1000) and I get the same random error... The problem is somewhere else. Still investigating...


  8. 28 minutes ago, Davide Angeli said:

    I don't know how the WiRL client works at a low level. Now I'll delve deeper.

    WiRL client seems using THTTPClient.Get and then THTTPClient.DoExecute to execute my REST operation (a PATCH). So I suppose that it is synchronous.


  9. 35 minutes ago, Lars Fosdal said:

    If a REST call is in progress when you terminate - will the code hangup and close the REST related thread(s) ?

    I rely on the fact that by calling the stop method it waits and completes any ongoing operations. When the application ends, each TimedTask is stopped and its end is awaited. But in fact, if the REST execution is asynchronous, this might still be running. I don't know how the WiRL client works at a low level. Now I'll delve deeper.


  10. 2 hours ago, Tommi Prami said:

    Could you run  the app in debugger and put break points at the end of DoSometing1 and DoSometing2, and be sure that you exit from them cleanly?

    It's not so easy to debug this;  when I debug and put breakpoints inside threads, thanking our beloved IDE, I get often debugger freezes. 

     

    In my case "DoSomething" code is a simple rest call (I use WiRL client to send data to WiRL server); the rest call is incapsulated in a try except to avoid errors.

     

    Til now my "DoSomething" was an anonymous method. Now I've changed my code and I pass a normal procedure to timedtask.execute. Things seem to going better but I don't think this was the cause of the error.


  11. 1 hour ago, Lars Fosdal said:

    Do you stop the tasks and wait for completion of any running task before stopping the application?

    Before posting I tried several solutions, some of these suggested in this post: 

     

    According to Primoz OTL book it seems to be enough to assign the IOmniTimedTask instance to nil to get the call to Terminate(INFINITE) and Terminate should stop the task... This works perfectley in a little sample demo. In my case leads to random errors (the app is very complex).

     

    I've tried calling the Stop method and then assign the instance to nil but I get the random errors too.

     

    I've tried calling also Stop + Terminate(INFINTE) + WaitFor(INFINITE) + assigning to nil without results

     

     


  12. I recently started using Parallel.TimedTask and now when I close the application I get the same error in completely random mode. I can't simulate the problem in a small project. I'm using D11.3 and the latest OTL version. Some idea?


  13. 7 hours ago, AndrewHoward said:

    I tried File -> New -> Other -> WSDL Importer -> enter the above link but I get an error.

     

    Maybe the problem could be that the WSDL contains an xsl stylesheet. 

    Have you tried downloading the wsdl source to a disk file and then importing into Delphi from that local file?


  14. I solved this thanks to the kind collaboration of the nSoftware assistance service (SecureBlackBox's developer). 

     

    There were many challenges to solve to achieve the goal and very little can be found online. It is my understanding that this type of security is not used much in the Delphi environment. However I solved by combining several components provided with the SecurityBlackBox suite:

    • TsbxCertificateStorage to read JKS file to reach public key (used to encrypt the request and verify the signed response) and private key (used to sign the request and decrypt the response)

    • TsbxSOAPSigner to sign the SOAP request (to produce a WSSSignature)
    • TsbxXMLEncryptor to embed in the request the encryption key (transported with RSA-OAEP sha1) and to crypt the SOAP request body (with AES128 algorithm)
    • TsbxXMLDecryptor to decrypt the response (two items encrypted in the response: the sign and the body)
    • TsbxSOAPVerifier to verifiy the sign in the response

    I've injected this encryption/decryption stuff in THTTPRio events, somthing like this;

    procedure TMultyAssociativeServiceWrapper.SOAPOnBeforeExecute(const MethodName: String; SOAPRequest: TStream);
    begin
      // save the original request (created by THTTPRio) for debug purpose
      SOAPRequest.Seek(0,0);
      (SOAPRequest as TMemoryStream).SaveToFile(FFileRequestOriginal);
    
      // sign and encrypt the original request
      SBBSoapSignAndEncryptWithJKS(FFileRequestOriginal, FFileRequestToSend, FCertificateFileJKS, OnPasswordNeeded);
      
      // ... do some other stuff ?
    
      // update the outcoming request with the signed crypted version
      SOAPRequest.Seek(0,0);
      (SOAPRequest as TMemoryStream).LoadFromFile(FFileRequestToSend);
    end;
    
    procedure TMultyAssociativeServiceWrapper.SOAPOnAfterExecute(const MethodName: String; SOAPResponse: TStream);
    begin
      // save te orginal response arrived from service for debug purpose
      SOAPResponse.Seek(0,0);
      (SOAPResponse as TMemoryStream).SaveToFile(FFileResponseOriginal);
    
      // decrypt and verify sign of response
      SBBSoapDecryptAndVerifyWithJKS(FFileResponseOriginal, FFileResponseDecoded, FCertificateFileJKS,  OnPasswordNeeded);
      
      //... do some other stuff?
    
      // update the incoming response with the decrypted data
      SOAPResponse.Seek(0,0);
      (SOAPResponse as TMemoryStream).LoadFromFile(FFileResponseDecoded);
    end;

     

    SBBSoapSignAndEncryptWithJKS does sign + encryption stuff.

    SBBSoapDecryptAndVerifyWithJKS does decrypt and verify sign stuff.

     

    I hope this can be helpful for someone else who runs into this need. If you need the code of the two SBB procedures described above please ask me.

     

    I've used SecureBlackBox components but I think that same stuff could be reached also with ChilKat library. I did some tests with the demo library, it works at a lower level of SBB but there are several examples online that could be combined to reach the goal.

    • Like 2
    • Thanks 1

  15. On 1/28/2023 at 9:55 AM, mjustin said:

    Have you compared the requests from SoapUI with the requests sent from your code?

    Yes, with SBB is not possibile to reach the same request without doing some further manipulation of the xml and it misses also the reference list for decryption. I'm working on that and another problem I think should be the order of doing operations: I'm doing crypt+sign but I'm investigating  if service aspect sign and then crypt.  I will do theese changes but I could not test because of server down for maintenance. I'll report the results.


  16. Hi all,

     

    I'm really becaming crazy trying to do this with Delphi... I've to interact with a SOAP service that implements WSS security with X.509 certificate so:

    • they give me the WSDL file 
    • they give me a Java Keystore (jks file) containg a certificate, a public key and a private key password protected
    • the SOAP request must be signed and crypted with the jks data
    • the SOAP response must be decrypted and signed verified

     

    a request like this one:

    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:fut="....." xmlns:ass="...." xmlns:com="....">
       <soapenv:Header/>
       <soapenv:Body>
          <fut:FutureConvocationsRequest>
             <associativeServicesGenericRequest>
                <ass:locale>
                   <com:language>it</com:language>
                	<com:country>IT</com:country>
                </ass:locale>
                <ass:consumer>Me</ass:consumer>
                <ass:associationCode>aaaa</ass:associationCode>
                <ass:sectionCode>bbbbb</ass:sectionCode>
                <ass:startDate></ass:startDate>
                <ass:endDate></ass:endDate>
             </associativeServicesGenericRequest>
          </fut:FutureConvocationsRequest>
       </soapenv:Body>
    </soapenv:Envelope>

     

    must become like this one (grabbed it from SoapUI logs that interact well with this service):

    <soapenv:Envelope xmlns:ass="..." xmlns:com="..." xmlns:fut="..." xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
       <soapenv:Header>
          <wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
             <xenc:EncryptedKey Id="EK-6085B5AE3B1746C574167481306190992" xmlns:xenc="http://www.w3.org/2001/04/xmlenc#">
                <xenc:EncryptionMethod Algorithm="http://www.w3.org/2001/04/xmlenc#rsa-oaep-mgf1p"/>
                <ds:KeyInfo xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
                   <wsse:SecurityTokenReference>
                      <ds:X509Data>
                         <ds:X509IssuerSerial>
                            <ds:X509IssuerName>....</ds:X509IssuerName>
                            <ds:X509SerialNumber>....</ds:X509SerialNumber>
                         </ds:X509IssuerSerial>
                      </ds:X509Data>
                   </wsse:SecurityTokenReference>
                </ds:KeyInfo>
                <xenc:CipherData>
                   <xenc:CipherValue>....</xenc:CipherValue>
                </xenc:CipherData>
                <xenc:ReferenceList>
                   <xenc:DataReference URI="#ED-6085B5AE3B1746C574167481306190993"/>
                </xenc:ReferenceList>
             </xenc:EncryptedKey>
             <wsse:BinarySecurityToken EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary" ValueType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#X509v3" wsu:Id="X509-6085B5AE3B1746C574167481306190587">....</wsse:BinarySecurityToken>
             <wsu:Timestamp wsu:Id="TS-6085B5AE3B1746C574167481306190486">
                <wsu:Created>2023-01-27T09:51:01Z</wsu:Created>
                <wsu:Expires>2023-01-27T09:56:01Z</wsu:Expires>
             </wsu:Timestamp>
             <ds:Signature Id="SIG-6085B5AE3B1746C574167481306190591" xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
                <ds:SignedInfo>
                   <ds:CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#">
                      <ec:InclusiveNamespaces PrefixList="ass com fut soapenv" xmlns:ec="http://www.w3.org/2001/10/xml-exc-c14n#"/>
                   </ds:CanonicalizationMethod>
                   <ds:SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"/>
                   <ds:Reference URI="#id-6085B5AE3B1746C574167481306190590">
                      <ds:Transforms>
                         <ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#">
                            <ec:InclusiveNamespaces PrefixList="ass com fut" xmlns:ec="http://www.w3.org/2001/10/xml-exc-c14n#"/>
                         </ds:Transform>
                      </ds:Transforms>
                      <ds:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/>
                      <ds:DigestValue>7APwAAzaHndcDEHSBYlA6b/rihY=</ds:DigestValue>
                   </ds:Reference>
                </ds:SignedInfo>
                <ds:SignatureValue>....</ds:SignatureValue>
                <ds:KeyInfo Id="KI-6085B5AE3B1746C574167481306190588">
                   <wsse:SecurityTokenReference wsu:Id="STR-6085B5AE3B1746C574167481306190589">
                      <wsse:Reference URI="#X509-6085B5AE3B1746C574167481306190587" ValueType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#X509v3"/>
                   </wsse:SecurityTokenReference>
                </ds:KeyInfo>
             </ds:Signature>
          </wsse:Security>
       </soapenv:Header>
       <soapenv:Body wsu:Id="id-6085B5AE3B1746C574167481306190590" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
          <xenc:EncryptedData Id="ED-6085B5AE3B1746C574167481306190993" Type="http://www.w3.org/2001/04/xmlenc#Content" xmlns:xenc="http://www.w3.org/2001/04/xmlenc#">
             <xenc:EncryptionMethod Algorithm="http://www.w3.org/2001/04/xmlenc#aes128-cbc"/>
             <ds:KeyInfo xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
                <wsse:SecurityTokenReference wsse11:TokenType="http://docs.oasis-open.org/wss/oasis-wss-soap-message-security-1.1#EncryptedKey" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsse11="http://docs.oasis-open.org/wss/oasis-wss-wssecurity-secext-1.1.xsd">
                   <wsse:Reference URI="#EK-6085B5AE3B1746C574167481306190992"/>
                </wsse:SecurityTokenReference>
             </ds:KeyInfo>
             <xenc:CipherData>
                <xenc:CipherValue>....</xenc:CipherValue>
             </xenc:CipherData>
          </xenc:EncryptedData>
       </soapenv:Body>
    </soapenv:Envelope>

     

    I've used several SOAP service but never with this kind of security so til now I've always used default THTTPRio with WSDL importer. I don't know if in this case this is the best approach but I've imported the WSDL file in Delphi creating all SOAP objects to use with THTTPRIO . Then I've coded the THTTPRio.OnBeforeExecute to inject the necessary data and trasform the request as needed. I've a regular license of SecureBlackBox components so I can easily read the certificate data from Keystore and using the SOAPSigner + XMLEncryptor components (with some post processing to adjust some Secureblackbox issues), I'm capable to transform the request as needed but when I send it to the service I got always an error like "The signature or decryption was invalid" (Unfortunately I can't get quick answers from the service provider because it is a government agency and not very responsive...). I suppose that could be an encryption problem because the XML soap request just signed (not encrypted) seems ok (just tested with SecureBlackbox SOAPVerifier).

     

    If there is here some SOAP Delphi guru my questions are:

    - do you know if exists a good tool to verify if the request is well formed? If the encryption is well done? If the sign is correct?

    - SecureBlackBox suite is very complex to configure... do you know if exists some other Delphi solution to obtain the result easier?

     

×