-
Content Count
1881 -
Joined
-
Last visited
-
Days Won
33
Everything posted by Angus Robertson
-
function SHA1ofStr or Base64Encode fault output
Angus Robertson replied to xauxag's topic in ICS - Internet Component Suite
Correct, and ICS has always used byte arrays in low level functions, the MD5 digest is a byte array, although the Sha1 digest is an AnsiChar array since it was contributed. But there were no TBytes library functions in Delphi 20 years old, so AnsiString was commonly used. I've added a lot of TBytes functions to ICS in the last few years so that support for old compilers has continued, and a TBytes version of Base64 conversion recently. But old code only gets modernised when updated for some reason. Angus -
function SHA1ofStr or Base64Encode fault output
Angus Robertson replied to xauxag's topic in ICS - Internet Component Suite
ICS still supports Delphi 7 and later, so needs AnsiStrings. I am trying to modernise some code, but can not break old functions that people have used in applications for 20 years. I'm expecting some bad feedback as people upgrade to ICS V9.1 which has some non-backward compatible SSL/TLS changes, new units and conceptual changes. SVN notes have all the details. Angus -
function SHA1ofStr or Base64Encode fault output
Angus Robertson replied to xauxag's topic in ICS - Internet Component Suite
This Websocket client problem should be fixed in SVN and the overnight zip, assuming it was an ANSI/Unicode casting problem with non-English character set conversions, which I'm unable to reproduce. It did not affect Websocket server which had no casting, and yet always worked against our client. The real problem is ICS has overloaded versions of many functions for ANSI and Unicode, and the compiler does not always choose the correct version if input and output parameters don't match, fixed by using a specific ANSI function. I'm slowly adding TBytes versions for binary data to avoid such problems. but it's a long job. Angus -
Network scan in Delphi (Windows), get MAC addresses
Angus Robertson replied to ErikT's topic in Network, Cloud and Web
ICS has a new component TIcsNeighbDevices that builds a historic LAN neighbourhood MAC device and IP address table that shows MAC vendor name to help identify devices. Runs in a thread continually checking for new devices. ICS can be installed from Getit. To test it, build the ICS Network Tools sample, it's very similar to the excellent Nirsoft Wireless Network Watcher tool I've run continually for a decade to monitor my LAN. Angus -
I offer clients a REST API service to look-up telecommunication information, using the ICS web application server and MS SQL server. It works well, for low volumes of queries, but most users start a new SSL/TLS session for each query, which becomes a limiting factor with performance. So I want to offer a Websocket API as well, so one SSL/TLS session stays open, with just simple request/response packets sent. But how to adapt the REST HTTP request/response to Websocket? My queries are simple URL parameters, ie codelookapi.htm?numhistory=118118. Should the Websocket message just be the arguments or include the full or partial URL as well? Or something else, like a command? Should the initial Websocket request allow arguments, or just open the connection? Should be Websocket response message be just a JSON block, or include a wrapper of some sort, like the HTTP response header? Has anyone done a similar design? I just want to make it easy for clients using standard Websocket client libraries to integrate the new API. Angus
-
Designing a Websocket API
Angus Robertson replied to Angus Robertson's topic in ICS - Internet Component Suite
The new Websocket API is live, when using streamlined requests, it handles about 100 SQL queries a minute from a single thread, although slower if the requests are sent sequentially waiting for a reply. Supporting JSON-RPC 2.0 on the server should not be hard, but does need POST support, I'll look at adding it to the ICS web server database sample. Client is a little harder since JSON-RPC 2.0 JSON-RPC uses a sequential ID to keep track of requests. Angus -
function SHA1ofStr or Base64Encode fault output
Angus Robertson replied to xauxag's topic in ICS - Internet Component Suite
The output of the hash function is AnsiString and the input to encode is AnsiString, so the String cast is unnecessary. I'll remove it for the new version going to SVN today. Angus -
function SHA1ofStr or Base64Encode fault output
Angus Robertson replied to xauxag's topic in ICS - Internet Component Suite
The Base64Encode and SHA1ofStr functions were written 20 to 25 years ago before Unicode, we convert to UTF-8 before calling them if needed. In this unit, the input to create the server key is a Base64 encoded random number we created and sent to the server earlier and a GUID so all simple ASCII. Angus -
function SHA1ofStr or Base64Encode fault output
Angus Robertson replied to xauxag's topic in ICS - Internet Component Suite
I will need to reproduce connection failures before I look into fixing them. So I need a Websocket server to test against. My only suggestion is to try the client against other servers and see if any fail, because no-one else has reported any problems. Angus -
function SHA1ofStr or Base64Encode fault output
Angus Robertson replied to xauxag's topic in ICS - Internet Component Suite
Are you suggesting there is a problem with the Base64Encode function creating incorrect output? Have you attempted to debug and fix the problem yourself, or are you expecting someone else to do it? I've been testing the OverbyteIcsWebSocketCli unit this week and it works fine. Angus -
help needed -ICS v8 in Delphi11 vs ICS v9 on Delphi12
Angus Robertson replied to rudy999's topic in ICS - Internet Component Suite
As the comments in the code say, the MsUserAuthority setting depends on the account type that the credentials relate to, mainly for corporate accounts, common and consumer are for general email accounts, the older version defaulted to consumer. Angus- 4 replies
-
- sslsmtpclient
- sslcontext
-
(and 1 more)
Tagged with:
-
help needed -ICS v8 in Delphi11 vs ICS v9 on Delphi12
Angus Robertson replied to rudy999's topic in ICS - Internet Component Suite
The URLs used for Rest Email are at the top of the OverbyteIcsSslHttpOAuth.pas unit, and have not changed since the unit was created, except to allow <MsUserAuth> instead of consumer, are you setting MsUserAuthority correctly? Angus- 4 replies
-
- sslsmtpclient
- sslcontext
-
(and 1 more)
Tagged with:
-
Designing a Websocket API
Angus Robertson replied to Angus Robertson's topic in ICS - Internet Component Suite
No idea why this client is not using keep-alive, perhaps their REST library does not support it? The basic Websocket API is working, and the client can access another Websocket interface on the server so seem to know their stuff, now just need to design the pipelining, so that queued queries get returned to the correct client. I'll look at JSON-RPC 2.0 for next time. Angus -
Private key in User Store, Could not export private key - The parameter is incorrect (#-2146893785)
Angus Robertson replied to mv2023's topic in ICS - Internet Component Suite
Sorry, no quick solution. There are OpenSSL providers to access private keys on TPM2 devices and to access certificates in the Windows Store (which ICS can now do), but not to access the Windows crypto signing APIs so that other dongles can be supported, at least to my knowledge. Angus -
Private key in User Store, Could not export private key - The parameter is incorrect (#-2146893785)
Angus Robertson replied to mv2023's topic in ICS - Internet Component Suite
Digital certificates are sometimes distributed on USB tokens precisely to stop them being copied by software applications. ICS can only access private keys that are stored in local windows store. The USB token is not a simple storage device, it has an operating system that allows applications to pass data to the token, which is then signed by the private key and passed back to the application as a hash. This signing is normally done by a Windows or OpenSSL API, and they need to be aware of the token and use that instead. All token suppliers provide drivers that allow Windows applications to use their tokens, but not usually for OpenSSL. OpenSSL needs extra code to access USB tokens, in the obsolete versions it was called an engine, with 3.0 and later it's called a provider, but it's just another DLL. I understand there are OpenSSL providers to allow use signing with USB tokens, but they are supplied as C source code not Windows DLLs, and I've never tried any. Integrating such a provider into ICS would not be quick, or maybe some-one has done it already? Angus -
Designing a Websocket API
Angus Robertson replied to Angus Robertson's topic in ICS - Internet Component Suite
Thanks for the comment, yes record ending is important, since this API has simple URL encoded arguments a single CRLF will be fine. In fact, allowing multiple requests in a single message is probably what is really needed. This client tends to do 10,000 odd requests in a single block during the night, takes about 25 minutes at the moment, single server thread, with a new session each time, eight per second. Will need to decide how many requests can be queued, in case they decide to try 1 million. The responses do include the main argument, ie {"success":true,"reccount":16,"records":[{"number":"118118","number_from":"2010-03-10", etc. I should add the API type to the outer wrapper. Then send them back one message at a time. Either the server or client can ping/pong to keep the connection open, I was planning on the server doing that to avoid complexity at the client, they simply close the connection when the batch is over. Angus -
Indeed, no need for threads in ICS. But Windows uses a thread to connect a TCP socket, and typically waits 30 to 40 seconds for a response before the Close event is called with an error, you can not abort it earlier. So the socket can not be re-used for another connection immediately, unlike ICMP. If you are checking a lot of hosts, you need a socket pool where they are not re-used until closed by Windows. Angus
-
You have already discovered two reasons why TCP ping is unreliable, you need a remote open port and TCP timeouts are horrible to work around, that is why everyone uses ICMP ping which is 100 times more useful. If you want to persist with TCP (why???) you should be using the TIcsIpStrmLog component, with the OverbyteIcsIpStmLogTst sample, try to connect to your TCP address and port as TCP Client, there are various setting you can change. That component is used for similar purposes in other places in ICS, despite the name, it is really a high level version of WSocket that can be used as a client or server for TCP or UDP, sending data between instances of itself or other applications. Angus
-
As the others have said, TCP ping does not exist, you can try and open a specific TCP port at an IP address, but Windows has a long timeout while this is attempted and the socket can not be reused until that is over, so it's slow, and you need lots of parallel sockets to make it work, and hope some ports are open. Build the ICS Network Tools sample that got added to ICS V9, the LAN Devices tab uses a new component that scans ranges of IPv4 and IPv6 addresses for devices, using APR, Neighbourhood IPs and pings, and builds a table with host names, MAC addresses and vendor, etc. It's very similar to the excellent Nirsoft Wireless Network Watcher tool I've run continually for a decade to monitor my LAN. Angus
-
OverbyteIcsWebSocketCli: Adjustment suggestion
Angus Robertson replied to e.c's topic in Software Testing and Quality Assurance
Your code looks the same as the original suggestion, which was added to the version in SVN last month. There are other fixes to this unit pending. Seems to be quite an interest in the new ICS websocket components. Angus -
ICS V9.0 - mobile platforms
Angus Robertson replied to wright's topic in ICS - Internet Component Suite
I've asked him to send me the changed units, I'll incorporate any safe Android changes I've not already made in the next couple of weeks, busy with low level SSL improvements. Angus -
thttpappsrv Put Handler does not get dispatched
Angus Robertson replied to omnibrain's topic in ICS - Internet Component Suite
Thanks, those checks are not in the POST handler and I thought I'd removed them since my PUT tests all worked, but now gone. SVN may be a few days. Angus -
How to attach a DigiCert Token certificate to exeutable
Angus Robertson replied to Bart Kindt's topic in Delphi IDE and APIs
My pre and post command jobs do other stuff as well as signing, copy files to various directories. Beware the signtool /a command only works when there is just one certificate available... Angus -
How to attach a DigiCert Token certificate to exeutable
Angus Robertson replied to Bart Kindt's topic in Delphi IDE and APIs
I have batch command files that handle all the signing, and then sign the final setup file, using InnoSetup pre and post compile steps. Better to use CMD extension for Windows 11, BAT is deprecated. [PostCompile] Name: "signsetup.bat" [PreCompile] Name: "compress.bat" Angus -
How to attach a DigiCert Token certificate to exeutable
Angus Robertson replied to Bart Kindt's topic in Delphi IDE and APIs
Not used the signcode /sha1 argument before, it is more common to use : /a /s MY /n "Common name" (this all replaces /f in my earlier example) where /a automatically looks for a signing certificate, /s is the Windows store (MY is the name for Personal), and the Common Name is usually your company name, but whatever is shown on the General certificate dialog tab for 'Issued to', or CN= under Subject on the Details tab. Angus