OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 patch class SecureSocket { | 5 patch class SecureSocket { |
6 /* patch */ factory SecureSocket._(RawSecureSocket rawSocket) => | 6 /* patch */ factory SecureSocket._(RawSecureSocket rawSocket) => |
7 new _SecureSocket(rawSocket); | 7 new _SecureSocket(rawSocket); |
8 | 8 |
9 /* patch */ static void initialize({String database, | 9 /* patch */ static void initialize({String database, |
10 String password, | 10 String password, |
(...skipping 13 matching lines...) Expand all Loading... |
24 class _SecureSocket extends _Socket implements SecureSocket { | 24 class _SecureSocket extends _Socket implements SecureSocket { |
25 _SecureSocket(RawSecureSocket raw) : super(raw); | 25 _SecureSocket(RawSecureSocket raw) : super(raw); |
26 | 26 |
27 void set onBadCertificate(bool callback(X509Certificate certificate)) { | 27 void set onBadCertificate(bool callback(X509Certificate certificate)) { |
28 if (_raw == null) { | 28 if (_raw == null) { |
29 throw new StateError("onBadCertificate called on destroyed SecureSocket"); | 29 throw new StateError("onBadCertificate called on destroyed SecureSocket"); |
30 } | 30 } |
31 _raw.onBadCertificate = callback; | 31 _raw.onBadCertificate = callback; |
32 } | 32 } |
33 | 33 |
| 34 void renegotiate({bool useSessionCache: true, |
| 35 bool requestClientCertificate: false, |
| 36 bool requireClientCertificate: false}) { |
| 37 _raw.renegotiate(useSessionCache: useSessionCache, |
| 38 requestClientCertificate: requestClientCertificate, |
| 39 requireClientCertificate: requireClientCertificate); |
| 40 } |
| 41 |
34 X509Certificate get peerCertificate { | 42 X509Certificate get peerCertificate { |
35 if (_raw == null) { | 43 if (_raw == null) { |
36 throw new StateError("peerCertificate called on destroyed SecureSocket"); | 44 throw new StateError("peerCertificate called on destroyed SecureSocket"); |
37 } | 45 } |
38 return _raw.peerCertificate; | 46 return _raw.peerCertificate; |
39 } | 47 } |
40 } | 48 } |
41 | 49 |
42 | 50 |
43 /** | 51 /** |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 | 85 |
78 void destroy() { | 86 void destroy() { |
79 buffers = null; | 87 buffers = null; |
80 _destroy(); | 88 _destroy(); |
81 } | 89 } |
82 | 90 |
83 void _destroy() native "SecureSocket_Destroy"; | 91 void _destroy() native "SecureSocket_Destroy"; |
84 | 92 |
85 void handshake() native "SecureSocket_Handshake"; | 93 void handshake() native "SecureSocket_Handshake"; |
86 | 94 |
| 95 void renegotiate(bool useSessionCache, |
| 96 bool requestClientCertificate, |
| 97 bool requireClientCertificate) |
| 98 native "SecureSocket_Renegotiate"; |
87 void init() native "SecureSocket_Init"; | 99 void init() native "SecureSocket_Init"; |
88 | 100 |
89 X509Certificate get peerCertificate native "SecureSocket_PeerCertificate"; | 101 X509Certificate get peerCertificate native "SecureSocket_PeerCertificate"; |
90 | 102 |
91 void registerBadCertificateCallback(Function callback) | 103 void registerBadCertificateCallback(Function callback) |
92 native "SecureSocket_RegisterBadCertificateCallback"; | 104 native "SecureSocket_RegisterBadCertificateCallback"; |
93 | 105 |
94 void registerHandshakeCompleteCallback(Function handshakeCompleteHandler) | 106 void registerHandshakeCompleteCallback(Function handshakeCompleteHandler) |
95 native "SecureSocket_RegisterHandshakeCompleteCallback"; | 107 native "SecureSocket_RegisterHandshakeCompleteCallback"; |
96 | 108 |
97 // This is a security issue, as it exposes a raw pointer to Dart code. | 109 // This is a security issue, as it exposes a raw pointer to Dart code. |
98 int _pointer() native "SecureSocket_FilterPointer"; | 110 int _pointer() native "SecureSocket_FilterPointer"; |
99 | 111 |
100 List<_ExternalBuffer> buffers; | 112 List<_ExternalBuffer> buffers; |
101 } | 113 } |
OLD | NEW |