15,608,989 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View Python questions
View Javascript questions
View C++ questions
View Java questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
Comments by raniam (Top 20 by date)
raniam
16-Dec-16 19:51pm
View
Hi,
I've already add the following lines at the end of the AES_Decrypt function, and still didn't work
int g = strlen(Decrypted_Message2);
char * DEC_msg2 = new char[g+1];
strcpy(DEC_msg2,Decrypted_Message2);
return DEC_msg2;
raniam
15-Dec-16 20:32pm
View
I've tried running both debuggers at the same time on C++ Builder XE3, but it didn't work.
You were right, the problem was on the client-side, in which the encryption occurs.
I fixed the problem by generating the session key and the IV within the same Client-socket function, instead of having their own functions. next, I performed the encryption process.
raniam
14-Dec-16 23:21pm
View
is it possible to run the debugger on two different projects at the same time?, as the client and the server needs to operate together.
raniam
1-Apr-16 10:28am
View
Thank you so much.
it worked.
you've been very helpful.
Best regards.
raniam
16-Feb-15 15:38pm
View
yes the certificate is on my Mac's Desktop.
So, do you mean I have to install the certificate on my iPhone?
raniam
22-Apr-14 11:41am
View
Hello again,
What do you mean by "writing the bytes from the image file"?
Regards.
raniam
22-Apr-14 11:37am
View
Hello,
I've tried it your way, but got lots of syntax errors.
but when I write it this way:
if (snorkel_printf (outstream, "<html><body>
<img src=<c:\users\rania\documents\images\qr4.jpg alt="QRcode" width="178" height="178">"
"
</body></html>\r\n")== SNORKEL_ERROR)
return HTTP_ERROR;
return HTTP_SUCCESS;
}
no errors, and I get the Image box, but with a black X inside of it, and QRcode written inside of it, but no image, I wonder why?
Regards
raniam
9-Apr-14 3:26am
View
hello,
the following code snippet works fine, all I have to do, is to run the c++ program, and open the browser and write http://localhost:80
#pragma hdrstop
#pragma argsused
#include <snorkel.h>
#include <tchar.h>
#include <stdio.h>
#include <stdlib.h>
call_status_t index_htm(snorkel_obj_t http, /*read environment from this object */
snorkel_obj_t outstream) /* write data to the output stream */
{
if (snorkel_printf (outstream,"<html><body>
Dynamic Content"
"
</body></html>\r\n") == SNORKEL_ERROR)
//if (snorkel_printf (outstream,"<html><body><img src="QR4.jpg" alt="QR code" width=178 height=178</html>\r\n")== SNORKEL_ERROR)
return HTTP_ERROR;
return HTTP_SUCCESS;
}
void syntax (char *pszProg)
{
fprintf (stderr, "syntax error:\n");
fprintf (stderr, "%s [-p <port>]\n", pszProg);
exit (1);
}
void main (int argc, char *argv[])
{
int i = 1;
int port = 80;
snorkel_obj_t http = 0;
char szExit[10];
for (; i < argc; i++)
{
if (argv[i][0] == '-' || argv[i][0] == '/')
{
char carg = argv[i][1];
switch (carg)
{
case 'p': /* port number */
port = atoi (argv[i + 1]);
i++;
break;
default:
syntax (argv[0]);
break;
}
}
}
/*
*
* initialize API
*
*/
if (snorkel_init () != SNORKEL_SUCCESS)
{
perror ("could not initialize snorkel\n");
exit (1);
}
/*
*
* create a server object
*
*/
http = snorkel_obj_create (snorkel_obj_server, 2, /* number of handler threads to create */
NULL /* directory containing index.html */);
if (!http)
{
perror ("could not create http server\n");
exit (1);
}
/*
*
* create a listener
*
*/
if (snorkel_obj_set (http, /* server object */
snorkel_attrib_listener, /* attribute */
port, /* port number */
0 /* SSL support */ )
!= SNORKEL_SUCCESS)
{
fprintf (stderr, "could not create listener\n");
snorkel_obj_destroy (http);
exit (1);
}
/*
*
* overload the URL index.html
*
*/
if (snorkel_obj_set (http, /* server object */
snorkel_attrib_uri, /* attribute type */
GET, /* method */
"/index.html", /* url */
contenttype_text, index_htm) != SNORKEL_SUCCESS)
{
perror ("could not overload index.html");
snorkel_obj_destroy (http);
exit (1);
}
if (snorkel_obj_set(http, snorkel_attrib_ipvers, IPVERS_IPV4, SOCK_SET) != SNORKEL_SUCCESS)
{
fprintf (stderr, "error could not set ip version\n");
exit (1);
}
/*
*
* start the server
*
*/
fprintf (stderr, "\n\n[HTTP] starting embedded server\n");
if (snorkel_obj_start (http) != SNORKEL_SUCCESS)
{
perror ("could not start server\n");
snorkel_obj_destroy (http);
exit (1);
}
/*
*
* do something while server runs
* as a separate thread
*
*/
fprintf (stderr, "\n[HTTP] started.\n\n"
"--hit enter to terminate--\n");
fgets (szExit, sizeof (szExit), stdin);
fprintf (stderr, "[HTTP] bye\n");
/*
*
* graceful clean up
*
*/
snorkel_obj_destroy (http);
exit (0);
}
So, I just want to change the HTML code which displays : Dynamic Content in the browser, to displaying my image.jpg
Regards.
Rania
raniam
23-Mar-14 15:04pm
View
hiyes, i just did, but still the same problem exists "unable to open file"
const char * EncQR = Extract_ClientPublicKey_Encrypt_QRcode(str, ClientCert_String);
ofstream myfile1;
myfile1.open("ram.txt");
if (myfile1.is_open())
{
myfile1 <<EncQR<<"\n";
myfile1.close();
}
else
cout<<"Unable to open file";
raniam
17-Mar-14 8:13am
View
thank you for replying, and sorry for not getting it right :(
But when adding the (*.c) files from the LibQREncode folder into my project, and compiling the project (Make and Build), i get a lot of syntax and declaration errors, with regard to the .c files i've added.
My questions are:
1- Do i COPY these files to the project folder only, or should i ADD them into the project, because i think they must not be changed.
2- what are the library and DLL files i should link to my project
Thank you so much, and i really appreciate your help
raniam
17-Mar-14 7:07am
View
Thank you, i've copied all the C files into my project directory and included all the (.h) files into my (.cpp), and the previous errors were gone. But another error came up, which is:
1- [ilink32 Error] Error: Unresolved external '_main' referenced from C:\PROGRAM FILES (X86)\EMBARCADERO\RAD STUDIO\10.0\LIB\WIN32\RELEASE\C0X32.OBJ
2- [ilink32 Error] Error: Unable to perform link
Even though, i'm working on a console application, but i dont know why i get this error
Need you help pleeeeeeeeeeeeeese
Best Regards.
raniam
17-Mar-14 6:08am
View
I've added all the *.h files in my *.cpp, but the problem is that the package does not contain any *.lib nor *.dll files.
So what can i do?
Regards.
raniam
17-Mar-14 6:07am
View
thank you for replying, but this is my first time to use a code from another vendor.
how can i build the library? since the package does not contain any *.Lib or *.Dll files!
And i'm using C++ Builder XE3 (not VC++)
Regards.
raniam
4-Oct-13 12:28pm
View
NS2 is a Network Simulator. it's a discrete event simulator targeted at networking research. Ns-2 provides substantial support for simulation of TCP, routing, and multicast protocols over wired and wireless (local and satellite) networks.
raniam
25-May-13 4:57am
View
yes thank you, I've made a copy of the digitalSignature and it worked
raniam
23-May-13 8:47am
View
This is the function that generates the Digital Signature:
const char * CLIENT::Generate_RSA_DigitalSignature(const char * MNumber, CkCert * DigSig_Dig_Certificate1)
{
CkPrivateKey *pkey = 0;
pkey = DigSig_Dig_Certificate1->ExportPrivateKey();
if (pkey == 0 ) {
printf("%s\n",DigSig_Dig_Certificate1->lastErrorText()); }
const char * pkeyXml;
// Get the private key in XML format:
pkeyXml = pkey->getXml();
//delete pkey;
//cout<<"\n"<<pkeyXml;
CkRsa rsa;
// Any string argument automatically begins the 30-day trial.
bool success = rsa.UnlockComponent("***********************");
if (success != true) {
printf("RSA component unlock failed\n"); }
// Import the private key into the RSA component:
success = rsa.ImportPrivateKey(pkeyXml);
if (success != true) {
printf("%s\n",rsa.lastErrorText()); }
cout<<"\nPrivate Key: "<<pkeyXml<<"\n";
// This example will sign a string, and receive the signature
// in a hex-encoded string. Therefore, set the encoding mode
// to "hex":
rsa.put_EncodingMode("hex");
// If some other non-Chilkat application or web service is going to be verifying
// the signature, it is important to match the byte-ordering.
// The LittleEndian property may be set to true
// for little-endian byte ordering,
// or false for big-endian byte ordering.
// Microsoft apps typically use little-endian, while
// OpenSSL and other services (such as Amazon CloudFront)
// use big-endian.
rsa.put_LittleEndian(false);
// Sign the string using the sha-1 hash algorithm.
// Other valid choices are "md2" and "md5".
const char * hexSig;
hexSig = rsa.signStringENC(MNumber,"sha-1");
//printf("%s\n",hexSig);
//printf("Success!\n");
return hexSig;
}
and this is the main function that calls the Generate_RSA_DigitalSignature function:
int _tmain(int argc, _TCHAR* argv[])
{
cout<<"CLIENT SIDE\n";
cout<<"===========\n\n";
CkCert * c = browser.Pass_Certificate();
//printf("%s\n",c->subjectDN());
CkString cert = browser.Convert_Cert_into_String(c);
cout<<cert;
HANDLE hConsole3;
hConsole3 = GetStdHandle (STD_OUTPUT_HANDLE);
SetConsoleTextAttribute(hConsole3, 10);
char mn[4096];
printf("ENTER YOUR MOBILE NUMBER:");
HANDLE hConsole4;
hConsole4 = GetStdHandle (STD_OUTPUT_HANDLE);
SetConsoleTextAttribute(hConsole4, 14);
gets(mn);
const char * Digital_Signature = browser.Generate_RSA_DigitalSignature(mn, c);
cout<<"\nDigital Signature: \n"<<Digital_Signature;
//CONNECTION 1 (client.h)
//************************
//SSL conncection between the "PC as a client" and the "MERCHANT as a server"
int a = browser.SSL_client_side(mn,true,Digital_Signature,cert);
cout<<"\n\n";
getch();
}
Best Regards
raniam
6-Mar-13 6:08am
View
Thank you, i've tried it on C++ Builder XE3, and it worked.
But i dont know why it was not working on C++ Builder6
Regards.
raniam
5-Mar-13 8:27am
View
HI,,
I've tried your advice and disabled the firewall, but it didnt work either,
Did you add the two files in a single project!!!!, can you please tell me exactly how you did it, because i'm a beginner in socket programming???
How can i use the localhost IP address?
best regards.
Rania
raniam
18-Feb-13 2:46am
View
Hi,,,
I've tried it, but still DECRYPTION is not working :(
raniam
18-Feb-13 2:45am
View
Deleted
Hi,,
I've tried it, but still Decryption not working :(
Show More