summaryrefslogtreecommitdiffstats
path: root/ppapi/thunk/ppb_tcp_socket_private_thunk.cc
diff options
context:
space:
mode:
authorraymes@chromium.org <raymes@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-04-12 03:38:22 +0000
committerraymes@chromium.org <raymes@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-04-12 03:38:22 +0000
commit92a794994111f442e9c7ba1792a5418a77c2ca74 (patch)
tree6ccf61412e2d7c33adab5611354db381c8367fc1 /ppapi/thunk/ppb_tcp_socket_private_thunk.cc
parent8d813a832c341a54a8a8aff5702bd392e990cda7 (diff)
downloadchromium_src-92a794994111f442e9c7ba1792a5418a77c2ca74.zip
chromium_src-92a794994111f442e9c7ba1792a5418a77c2ca74.tar.gz
chromium_src-92a794994111f442e9c7ba1792a5418a77c2ca74.tar.bz2
This adds the following to functions to the ppapi TCPSocket interface:
1) GetServer certificate, which returns the server X509Certificate if an SSL connection has been established. 2) AddChainBuilding certificate. This is currently unimplemented in Chrome but the interface and plumbing has been added so it can easily be hooked up. This should add a trusted/untrusted chain building certificate to be used by the client for a particular connection when performing the SSL handshake. BUG=114626 TEST=out/Release/browser_tests --gtest_filter=*PPAPITest.*TCP*Trusted* Review URL: http://codereview.chromium.org/9699100 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@131918 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/thunk/ppb_tcp_socket_private_thunk.cc')
-rw-r--r--ppapi/thunk/ppb_tcp_socket_private_thunk.cc39
1 files changed, 37 insertions, 2 deletions
diff --git a/ppapi/thunk/ppb_tcp_socket_private_thunk.cc b/ppapi/thunk/ppb_tcp_socket_private_thunk.cc
index 3997d08..bd9703e 100644
--- a/ppapi/thunk/ppb_tcp_socket_private_thunk.cc
+++ b/ppapi/thunk/ppb_tcp_socket_private_thunk.cc
@@ -75,6 +75,22 @@ int32_t SSLHandshake(PP_Resource tcp_socket,
callback));
}
+PP_Resource GetServerCertificate(PP_Resource tcp_socket) {
+ EnterTCP enter(tcp_socket, true);
+ if (enter.failed())
+ return 0;
+ return enter.object()->GetServerCertificate();
+}
+
+PP_Bool AddChainBuildingCertificate(PP_Resource tcp_socket,
+ PP_Resource certificate,
+ PP_Bool trusted) {
+ EnterTCP enter(tcp_socket, true);
+ if (enter.failed())
+ return PP_FALSE;
+ return enter.object()->AddChainBuildingCertificate(certificate, trusted);
+}
+
int32_t Read(PP_Resource tcp_socket,
char* buffer,
int32_t bytes_to_read,
@@ -102,7 +118,20 @@ void Disconnect(PP_Resource tcp_socket) {
enter.object()->Disconnect();
}
-const PPB_TCPSocket_Private g_ppb_tcp_socket_thunk = {
+const PPB_TCPSocket_Private_0_3 g_ppb_tcp_socket_thunk_0_3 = {
+ &Create,
+ &IsTCPSocket,
+ &Connect,
+ &ConnectWithNetAddress,
+ &GetLocalAddress,
+ &GetRemoteAddress,
+ &SSLHandshake,
+ &Read,
+ &Write,
+ &Disconnect
+};
+
+const PPB_TCPSocket_Private g_ppb_tcp_socket_thunk_0_4 = {
&Create,
&IsTCPSocket,
&Connect,
@@ -110,6 +139,8 @@ const PPB_TCPSocket_Private g_ppb_tcp_socket_thunk = {
&GetLocalAddress,
&GetRemoteAddress,
&SSLHandshake,
+ &GetServerCertificate,
+ &AddChainBuildingCertificate,
&Read,
&Write,
&Disconnect
@@ -118,7 +149,11 @@ const PPB_TCPSocket_Private g_ppb_tcp_socket_thunk = {
} // namespace
const PPB_TCPSocket_Private_0_3* GetPPB_TCPSocket_Private_0_3_Thunk() {
- return &g_ppb_tcp_socket_thunk;
+ return &g_ppb_tcp_socket_thunk_0_3;
+}
+
+const PPB_TCPSocket_Private_0_4* GetPPB_TCPSocket_Private_0_4_Thunk() {
+ return &g_ppb_tcp_socket_thunk_0_4;
}
} // namespace thunk