开发者

Running a compiled C++ program as CGI

开发者 https://www.devze.com 2023-02-24 07:39 出处:网络
We\'re going to add Fingerprint authentication to an iPad app; Since we couldn\'t find any actual fingerprint hardware that works with an iPad, we found DigitalPersona, which is a supplier of great fi

We're going to add Fingerprint authentication to an iPad app; Since we couldn't find any actual fingerprint hardware that works with an iPad, we found DigitalPersona, which is a supplier of great fingerprint scanner hardware, as well as an SDK for Linux C/C++. The idea is that the user would tap "authenticate with fingerprint" which would send a RESTful request to the linux box with the fingerprint scanner; the linux box would be running the compiled C++ program which waits for a user to scan their finger, determines a match or no-match, and send that response back to the iPad program's original request.

So... with very little C++ experience, and even less CGI (but lots of PHP and Objective-C), I was wondering if this is technically possible. Can a CGI binary accessed via HTTP actually wait for local user input (at the console) before sending the result to the HTTP request?

The linux box would run headless, and we'd control some LED's to help with letting the user know that the program is waiting for a fingerprint scan.

SOME Additional Details: No PHP is planned on being used. Initially, we want three devices: iPad Linux Server

iPad is running an app which would have a biometric authentication IBOutlet; Linux has the fingerprint scanner on it, and a basic Apache; additionally the C++ SDK for the finger print scanner, which we would use to build the CGI program that, when invoked (by server), waits for a finger scanned, and once scanned, sends a "match" or "no match" to it's requestor. Server would be the requestor. Once it receives a request from the iPad app, it invokes the CGI program on the Linux box, waiting for a "match" or "no match" request.

Another member of my team offered this: iPad is running the app; user clicks 'auth with fingerprint' and the iPad is in a 'waiting' state Linux has the finger print scanner, user 开发者_运维百科scans finger print, and the finger print gets sent via HTTPS to the server Server would receive a finger print, and match it up with a user. then checks if any iPad is in a 'waiting' state, and which user initiated it. If it matches the finger print-authenticated user, it would accept the iPad's data as an authentic punch, and release the iPad from the waiting state.


http://sveinbjorn.org/files/ObjectiveCGI.zip


There are basically two ways of doing this; you could have your PHP function call an external application through exec or you could write an external CGI in C++ directly using RudeCGI, Cgicc or freeCGI. There are a lot of libraries for you to choose from.


Why CGI need to wait for user input? You can rather invoke the CGI after taking input from Iphone and send it to the CGI...You then just have to read CGI response from Iphone...

0

精彩评论

暂无评论...
验证码 换一张
取 消