You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by Bryan Pham <br...@cloudtenna.com> on 2013/08/04 10:57:23 UTC
TSSLSocket context setup issue
Hi,
I am working with TSSLSocket in C++. I've read through the readme but
currently hitting a very strange problem.
I'm getting certificate signature failure for all sites.. My cert is
coming from http://curl.haxx.se/ca/cacert.pem.
Code:
boost::shared_ptr<TSSLSocketFactory> sslSocketFactory(new
TSSLSocketFactory());
sslSocketFactory->loadTrustedCertificates("cacert.pem");
boost::shared_ptr<TSSLSocket>socket =
sslSocketFactory->createSocket(serviceUrl, servicePort);
transport = boost::shared_ptr<THttpTransport>(new THttpClient(socket,
serviceUrl, servicePath));
SSL Session dump :
SSL-Session:
Protocol : TLSv1
Cipher : ECDHE-RSA-AES256-SHA
Session-ID:
82BBFD78FE1B39CABD8987D21B5A8A5AC42B41C55C11524A944BBB88F6240E37
Session-ID-ctx:
Master-Key:
F0D3A89E688C2F896E30857443772319321E290EC05896B22D581CFB20CB6DCE
3F9FA398D53FCCCF3ABD03360E2C2F21
Key-Arg : None
PSK identity: None
PSK identity hint: None
SRP username: None
TLS session ticket lifetime hint: 300 (seconds)
TLS session ticket:
0000 - d4 b3 e5 ff 49 26 58 1b-72 36 e8 51 a8 f4 18 3e
....I&X.r6.Q...>
0010 - 77 58 64 17 b2 a7 7c 74-99 27 09 35 ab 30 b1 29
wXd...|t.'.5.0.)
0020 - 2f ee 88 ac a1 bc e4 91-09 4c 63 46 3d 7b 80 42
/........LcF={.B
0030 - 1b b4 58 7c a6 ac 45 66-f1 7d 0f ed 93 be c3 50
..X|..Ef.}.....P
0040 - b8 16 94 09 f4 10 b6 ba-e4 a3 c8 94 06 4c ba 6f
.............L.o
0050 - ee 0d ec 5c 8d ae b9 f1-b8 92 3f 20 d9 46 61 83 ...\......?
.Fa.
0060 - 14 d7 8c a3 b6 95 71 c4-39 78 da 8a 09 50 34 4c
......q.9x...P4L
0070 - f3 4c 03 0f 46 95 11 04-fb 08 96 08 e9 10 fb 8b
.L..F...........
0080 - 56 fa 57 27 01 92 a0 7a-46 17 5a 3a 58 69 3a f5
V.W'...zF.Z:Xi:.
0090 - 54 a6 79 2f d8 b3 ca e6-cf 8c d0 f6 4e 5c a7 79
T.y/........N\.y
Start Time: 1375575633
Timeout : 7200 (sec)
Verify return code: 7 (certificate signature failure)
I've made the following patch and it seemed to fixed my problem. Problably
need to remove setup at Factory also since this is a per thread settings.
@@ -70,10 +70,18 @@ SSLContext::~SSLContext() {
if (ctx_ != NULL) {
SSL_CTX_free(ctx_);
ctx_ = NULL;
+
+ //cleanup
+ ERR_free_strings();
+ EVP_cleanup();
}
}
SSL* SSLContext::createSSL() {
+ //init
+ SSL_library_init();
+ SSL_load_error_strings();
+
SSL* ssl = SSL_new(ctx_);
if (ssl == NULL) {
string errors;
--
Best,
Bryan Pham
Co-Founder and CTO, CloudTenna Inc.