Jump to content


  • Content Count

  • Joined

  • Last visited

Community Reputation

0 Neutral

Technical Information

  • Delphi-Version
    Delphi 10.4 Sydney

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Thank you for your reply! I wrote test applications to append them here. When I was done, I tested a bit. And I found out, that this works: MemoryMappedFile.OpenExisting(mmfName); But if I use MemoryMappedFileRights.Read (which works in Delphi) or MemoryMappedFileRights.ReadWrite, it does not work anymore. I could use API Monitor to dig deeper, but for the moment I am glad that it works. I'll append the test projects soon.
  2. Hello, I used memory-mapped files a few times already, but it was always a Delphi application. I had no problems to create a MMF and open it with another Delphi application. Now I tried to connect to a MMF created by a Delphi application, but this time I tried it from a C# application. Unfortunately it does not find the MMF. If I prepend Global\, I need administrator privileges, but it does not work either. The code is straightforward: // Delphi side: CreateFileMapping($FFFFFFFF, nil, PAGE_READWRITE, 0, MMFSize, PChar(MMFName)); // C# side: MemoryMappedFile.OpenExisting(mmfName, MemoryMappedFileRights.ReadWrite); I thought about using the API functions directly, but I did not try it yet. Is anything wrong with this code? Why doesn't it work? Thank you Sebastian
  3. Thank you very much for your efforts. I'll take a look at it. I had already begun to doubt myself... In the meanwhile I found out, that the internal rest client of Delphi supports client based authentication... the problem is, that it can't be used, because there is no way to set the properties needed... So I made a quality entry: https://quality.embarcadero.com/browse/RSP-34451 I redirected the virtual methods, so it works for me, but it is no good way, because everything is declared inside the implementation section. So having no RTTI I have to use the cpu view to find the VMT table and memory offsets to the addresses, which I have to redirect. The next problem is, that I can use the .NET class X509Certificate2 to open a certificate, for which I can get the public key afterwards by simply using GetPublicKey(). But if I try this using Delphi and your ICS classes or using other ways, I always have to provide a password, which I do not have (and do not need when using .NET). I tried an empty password as well, but it did not work. I do not know, whether this does not work or whether I made an error when loading the certificate data.
  4. I found the demo application with TSslHttpAppSrv, where I have this property. After I had a short look at the possibilities I have with those components, I think it is the best solution I have seen yet. I'll have a deeper look at it soon. Thank you again!
  5. I have one question left: Is it possible to use ICS to build a HTTP server where clients authenticate themselves using client certificates? I had a short look, but did not see, whether this is possible. I don't find a way using this function, but it already works, so it does not matter. This is very interesting indeed as I don't need to call openssl.exe externally anymore with this functionality. THTTPRIO us used to use automatically generated client classes to communicate with a SOAP server. This way you do not need to build and analyze the XML contents manually. It would only be possible to change the engine behind by changing a few RTL units, so this is no option for general purpose. Thank you very much!
  6. Because I did not find another way to apply the certificate including the private key to the request. Should CertCreateCertificateContext work with the contents of a .pfx file including the private key too? It did not work for me and I did not find anything except the hint to use PFXImportCertStore. Perhaps I did something wrong there too. That would be interesting. At the moment I use openssl.exe externally to convert .pem + .key --> .pfx. But I found no way to do this using the API. If this conversion would not be necessary, it would be even better of course. Could ICS be used somehow with THTTPRIO for SOAP communication including client certificate authentication? If this would work, it would be really great. But as there is no official way to change the engine behind THTTPRIO, it would not be easy (if possible at all). And as ICS works asynchronously (what I like), the process flow is so different, that it won't match the way THTTPRIO works anyway. So I have little hope. 😉 Thank you for your reply! Sebastian
  7. SOLVED Unfortunately I got no hint for an error when calling PFXImportCertStore, but the format of the parameter was wrong. This does not explain why the other way using the store did not work, but this would have been only a workaround anyway. What I can say at this point: The implementation of Embarcadero really is not good. There is already working code, but one cannot use it, because the functionality is completely unreachable.
  8. No idea? Nobody? Well, in the meanwhile I checked the certicate files using "openssl -v -info" and they contain the private key as they should. I imported the .pfx file by using certlm.msc directly. The import works and the private key is visible there. The certificate is found by TWinHTTPClient correctly and I can select it in OnNeedClientCertificate. But nevertheless the result is the same: I get error 12185 (ERROR_WINHTTP_CLIENT_CERT_NO_PRIVATE_KEY). Is there anything that needs to be done in addition?
  9. Hello, I would like to use THTTPRIO / Soap and thus TWinHTTPClient with WinHttpSendRequest. Client side certificates are used for authentication. This all works in the old version under XE4 with Indy. There you can also load a certificate from a file etc. without installing it. Now I want to update this to Delphi 10.4.2. Unfortunately I found out that TWinHTTPClient is declared under implementation without Rtti information and uses hard-coded the MY store. So I see three possibilities: Load the certificate to MY store, bypass MY store and load a certificate directly as context, bypass MY store and load a certificate as store and fetch the context. So I have redirected the virtual method DoClientCertificateAccepted by VMT pointer, so that I can use WinHttpSetOption with WINHTTP_OPTION_CLIENT_CERT_CONTEXT. The fact that the reference to the request is not accessible from outside is no big deal either. No beautiful code, but at least it works and is easy to adapt for future versions of Delphi. The problem now is to get a certificate context. I get it loaded with CertCreateCertificateContext from a .pfx file. Unfortunately the link to the private key is missing. I haven't found a way to add it with e.g. CertSetCertificateContextProperty. Consequently, I get the error message that the private key is missing when I make the request. So I tried it with PFXImportCertStore. This way I can load the .pfx file too, can get the context, but unfortunately the private key seems not to be in it, at least after the call of CertSetCertificateContextProperty I get the value 80092004 when I call GetLastError. That means that the property was not found. Also a try with the Clever Internet Suite did not work. Long story short: I have a .p12 file as source, I have a .pem file with the certificate and a .key file with the private key, I have also already made a .pfx out of it. With this I would like to do the authentication via client certificate. Which way would you recommend and how can I do it? Thanks a lot Greetings Sebastian
  10. jaenicke

    Layouts in IDE

    The simple solution would be to save the standard template under a different name and the custom layout under the standard name. This way everything works for the normal layout and a custom debug layout can be configured directly. So for me it works as I need it (use a custom layout, but be able to switch to standard). But if I select a different layout in 10.2, the IDE remembers this selection when I restart it. (Tested with Delphi 10.2 Version 25.0.26309.314 with MMX and CnPack as well as with Delphi 10.2 Version 25.0.27659.1188 with both addons)