I'm developing bug reporting, for when a C++ program crashes.
Task:
Program crashes; it sends some info to a server, while user sees "Something bad happened, sorry".
Solution:
I've written a script on the server, which gets the HTTP POST message. My program sends POST messages with helpful info. It is not secure. With some http sniffer, one can find out where the POST messages go, and send lots of fake bug reports. I've decided to use RSA for this. I've used the crypto++ library to do this.
Question:
I have bad feeling, that I am making it really much harder than it has to be. Is there any way to implement this way of bug reporting more easily?
I'd approach this by 1) using an encrypted connection (HTTPS) to your server, and 2) using a private shared key in your application that encodes a time-based token that your server verifies is the correct key and ~roughly the correct time.
Related
I'm programming some kind of browser in c++ using winsock and got struck in some kind of error. The program works just fine for some pages in the internet, but for some reason it doesn't work for all of them.
https://imageshack.com/a/v56q/1
As seen in these images the composed version of Fiddler works while my own program fails.
I thought that maybe the HTTPS connection might be the problem, but it doesn't even seem to need a handshake or something similar. The sending part of the program is certainly not the problem because it works with other pages (e.g. the ones in the comments).
Thanks in advance!
I thought that maybe the HTTPS connection might be the problem, but it doesn't even seem to need a handshake or something similar.
Yes, HTTPS requires that you perform a rather complicated handshake, which is why essentially nobody attempts to implement HTTPS directly on sockets, and instead uses WinHTTP or WinINET, the two HTTP stacks included in Windows.
While Fiddler is running, you can kinda "cheat" by sending your plaintext request (containing a HTTPS url) to Fiddler, which will then perform the proper secure handshake with the remote server on your behalf and then return the response to your client. (Fiddler is acting as a HTTP-to-HTTPS gateway in this scenario.
I have seen many tutorials (http://curl.haxx.se/libcurl/c/smtp-multi.html, VMIME website, etc) that explain how to send mail through some server like GMail or whatever. That is, they require a username/password to log in to some server, and then they forward the email through the server to the destination.
What I am looking for and cannot find is an explanation of how to send email that is not routed through a server though. How do you send email without a mail server? I am looking for a [Linux] library that can let my program be the mail server itself, both to send mail and receive it. If this is not possible with curl or vmime then I will be glad to switch to another library. I really do not want to have to roll my own SMTP server, but I've spent a day on google to no avail, and read the VMIME book but I can't find anything helpful and it's a little abstruse to my mind.
Edit:
So basically I'm looking for a SMTP server library (that can also send emails to other servers) for C or C++. Does such a thing exist? I see them for .NET and Java and Python but no C or C++ yet. Still googling...
Sadly, I don't know of any that are still active. VMIME has some support but the API for SMTP/SMTPS is kinda awkward looking. I have looked at libcurl for the sending portion too. It looks a bit easier to manage than VMIME's SMTP/SMTPS API. I am currently using VMIME to generate the messages and am sending using the MSMTP utility. The combination of VMIME and MSMTP works great but would prefer to keep it all in one utility program...
I'm developing a cross-platform C++11 application and I need to send a validation email to a user-entered address to make sure his email account exists and is valid.
I know there are temporary mail services like mailinator, but honestly I feel like a validation email is a good approach in my case since it gives people malicious intention more work to do to circumvent the system and also goes well with the rest of the application (example: having the email address allow me to automatically send status updates to users).
I have searched on the internet but I haven't been able to find a portable, cross-platform way to achieve this, at least without introducing big dependencies.
How can this issue be solved?
This email better not send from the client side. Write a server side http api and accept request from the client side application, then send the email on server.
Given that we don't even have networking(!) in the C++11 standard (not to mention the POP3, SMTP or the IMAP protocols on the top of it), I am afraid you cannot do it without "introducing big dependencies."
If you are willing to use third party libraries
VMime
libcurl
SmtpClient for Qt
implementint the protocols yourself on the top of boost::asio
are viable options depending on your needs and licensing requirements.
I have a big problem in Axis2 client implementation.
I've generated the source code of my client (Java) through the Intellij Idea IDE from a wsdl file.
I use the client to connect in https with a webserver using a smartcard, in which is stored the certificate for the authentication.
Using the first smartcard, everything works fine: I receive data from the webservice in the right way. Using the second smartcard, I receive data related to first smartcard owner.
Analyzing the logs of my application, I've noticed that, at the end of the first communication, a session has been saved. So, in the second connection, the authentication is not needed and data is related to first smartcard owner.
Googling around, I've found that, to avoid to maintain sessions in Axis2 clients, it is needed to set the following:
currentStub._getServiceClient().getOptions().setManageSession(false);
But it does not work properly.
Anyone has suggestions?
I know, this question is quite old.
You could just create a new Stub. This should not have any reference to the old connections/sessions.
I don't have too much experience programming in C++, but I need to build a basic application for sending state emails from a computer using windows or linux, and I've found that POCO C++ suppoorts both platforms, but I have a proxy http provider behind to filter unauthorized connections, so, how could I do it?.
You can't send SMTP e-mail through a HTTP proxy.
But you can make a HTTP connection to a website you control. And you can write a web-to-email script and put that on your website. E.g. your script can take a status message as a POST parameter and then send it out as e-mail.
Spammers often try to hack web-to-email scripts to send spam, so please make sure your script has a hard-coded destination e-mail address. That way the spammer can only send mail to you, not everyone else on the Internet. Whatever you do, don't pass the destination e-mail address as a parameter.
regarding web to email scripts - make sure you strip newlines from anything that ends up in email headers! (to prevent spammers from injecting headers)