Would still love to see the renew certs.sh file that is supposedly in the WolfSSL distribution, but it's not in mine.
I would another site that gave some instructions on how to create a .pem file. I tried this as follows:
$ openssl req -newkey rsa:2048 -nodes -keyout key.pem -x509 -days 365 -out certificate.pem
The result of this were 2 files: certificate.pem and key.pem.
I loaded both of these files in to WolfSSL as follows:
/* Load CA certificates into CYASSL_CTX */
if (CyaSSL_CTX_load_verify_locations(ctx,"./certificate.pem",0) !=
SSL_SUCCESS) {
fprintf(stderr, "Error loading cert2/certificate.pem, "
"please check the file.\n");
return -1;
}
/* Load server key into CYASSL_CTX */
if (CyaSSL_CTX_use_PrivateKey_file(ctx,"./key.pem",
SSL_FILETYPE_PEM) != SSL_SUCCESS) {
fprintf(stderr, "Error loading cert2/key.pem, "
"please check the file.\n");
return -1;
}
But I am getting an error back when I call CyaSSL_read() to read data over the network. So I go thought the following sequence to try and determine what happened:
int err = wolfSSL_get_error(ssl, nbytes);
char errorString[80];
wolfSSL_ERR_error_string(err, errorString);
// send back an internal error message, but we need to
// get more detailed into from WolfSSL into a log file.
cout << "WolfSSL Error: " << err << " Error string: "
<< errorString << endl;
The output form the above error code is this:
WolfSSL Error: -308 Error string: error state on socket
I believe, obviously, there are differences in how I created my certificate as opposed to how the ca-cert.pem file that came with WolfSSL was created. Looking at the cert, I see the following differences, when I analyze they with the following command:
$ openssl x509 -text -noout -in certificate.pem > certificate.txt
Do thi to both cert files, the one that comes with WolfSSL and the one I generated yields the following differences i the cert files ... yes, I've cut out a lot of the stuff that would obviously be different:
macbook: /Users/balson/sw/bru/server/cert2 > diff certificate.txt ../certs/ca-cert.txt
...
< keyid:0B:AE:B9:67:62:8E:0D:FE:4F:51:3E:DA:B2:B8:E9:7B:82:BA:B2:70
---
> keyid:27:8E:67:11:74:C3:26:1D:3F:ED:33:63:B3:A4:D8:1D:30:E5:E8:D5
> DirName:/C=US/ST=Montana/L=Bozeman/O=Sawtooth/OU=Consulting/CN=www.wolfssl.com/emailAddress=info@wolfssl.com
> serial:9A:41:47:CD:A1:14:62:8C
Ignoring the 'keyed' line, the only difference that stand out to me are the 2 lines from the cert that came with WolfSSL that start "DirName" and the line after that one that starts with "serial".
The cert that I generated has neither of these lines. I don't know if this would cause the problem with my test server application getting the error as I described above.
Any help appreciated.
Thanks, Jim