Hi, everyone:
 
I set up my own CA and sign client certificates. I can use the program of perl provided by F.J Hirsch in his paper" Introducing SSL and Certificates using SSLeay" to download  certificate to netscape browser. But I can not use my C program to do the work.
 
This is the perl program:
 
open(CERT, "("/usr/local/ssl/certs/cert.result") or fail("Could not open $result_file<P>$!");
#  send the client certificate to the browser
print "Content-Type: application/x-x509-user-cert\n";                
my $result = join '', <CERT>;
close CERT;
my $len = length($result);
print "Content-Length: $len\n\n";
print $result;
 
 
And this is my C program:
 
ifstream in("/usr/local/ssl/certs/cert.result");
cout<<"Content-Type: application/x-x509-user-cert\n" << endl;
while(in){
    in.getline(str,255);
    result +=str;
    result +='\n';
} 
in.close();
len = strlen(result.c_str());
cout<<"Content-Length:" << len << "\n\n" <<endl;
// send the client certificate to the browser
cout<<result.c_str() <<endl;
 
 
What's wrong with my program?
Thank you in advance.
 
Karl Zhang

Reply via email to