Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1452)

Unified Diff: runtime/bin/tls_socket_patch.dart

Issue 10916081: Add secure sockets to dart:io (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments, remove HandshakeStartHandler. Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/bin/tls_socket.cc ('k') | runtime/bin/utils.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/tls_socket_patch.dart
diff --git a/runtime/bin/tls_socket_patch.dart b/runtime/bin/tls_socket_patch.dart
new file mode 100644
index 0000000000000000000000000000000000000000..73e40e815076e40ac68ead319a8e4f350048cf5b
--- /dev/null
+++ b/runtime/bin/tls_socket_patch.dart
@@ -0,0 +1,52 @@
+// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+patch class TlsSocket {
+ /* patch */ static void setCertificateDatabase(String pkcertDirectory)
+ native "TlsSocket_SetCertificateDatabase";
+}
+
+
+patch class _TlsFilter {
+ /* patch */ factory _TlsFilter() => new _TlsFilterImpl();
+}
+
+
+/**
+ * _TlsFilterImpl wraps a filter that encrypts and decrypts data travelling
+ * over a TLS encrypted socket. The filter also handles the handshaking
+ * and certificate verification.
+ *
+ * The filter exposes its input and output buffers as Dart objects that
+ * are backed by an external C array of bytes, so that both Dart code and
+ * native code can access the same data.
+ */
+class _TlsFilterImpl extends NativeFieldWrapperClass1 implements _TlsFilter {
+ _TlsFilterImpl() {
+ buffers = new List<_TlsExternalBuffer>(_TlsSocket.NUM_BUFFERS);
+ for (int i = 0; i < _TlsSocket.NUM_BUFFERS; ++i) {
+ buffers[i] = new _TlsExternalBuffer();
+ }
+ }
+
+ void connect(String hostName, int port) native "TlsSocket_Connect";
+
+ void destroy() {
+ buffers = null;
+ _destroy();
+ }
+
+ void _destroy() native "TlsSocket_Destroy";
+
+ void handshake() native "TlsSocket_Handshake";
+
+ void init() native "TlsSocket_Init";
+
+ int processBuffer(int bufferIndex) native "TlsSocket_ProcessBuffer";
+
+ void registerHandshakeCompleteCallback(Function handshakeCompleteHandler)
+ native "TlsSocket_RegisterHandshakeCompleteCallback";
+
+ List<_TlsExternalBuffer> buffers;
+}
« no previous file with comments | « runtime/bin/tls_socket.cc ('k') | runtime/bin/utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698