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

Unified Diff: runtime/bin/secure_socket_patch.dart

Issue 1319703002: Breaking Change: merge BoringSSL branch into master (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 4 months 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/secure_socket.cc ('k') | runtime/bin/secure_socket_unsupported.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/secure_socket_patch.dart
diff --git a/runtime/bin/secure_socket_patch.dart b/runtime/bin/secure_socket_patch.dart
index 4e22a1440f6e048753b5c3512150cc06c07acfb8..c8b072599bf2ac94f545ed952b9ccbe032ba0e8f 100644
--- a/runtime/bin/secure_socket_patch.dart
+++ b/runtime/bin/secure_socket_patch.dart
@@ -5,11 +5,6 @@
patch class SecureSocket {
/* patch */ factory SecureSocket._(RawSecureSocket rawSocket) =>
new _SecureSocket(rawSocket);
-
- /* patch */ static void initialize({String database,
- String password,
- bool useBuiltinRoots: true})
- native "SecureSocket_InitializeLibrary";
}
@@ -17,6 +12,9 @@ patch class _SecureFilter {
/* patch */ factory _SecureFilter() => new _SecureFilterImpl();
}
+patch class X509Certificate {
+ /* patch */ factory X509Certificate._() => new _X509CertificateImpl();
+}
class _SecureSocket extends _Socket implements SecureSocket {
_SecureSocket(RawSecureSocket raw) : super(raw);
@@ -79,10 +77,8 @@ class _SecureFilterImpl
}
void connect(String hostName,
- Uint8List sockaddrStorage,
- int port,
+ SecurityContext context,
bool is_server,
- String certificateName,
bool requestClientCertificate,
bool requireClientCertificate,
bool sendClientCertificate,
@@ -119,3 +115,68 @@ class _SecureFilterImpl
List<_ExternalBuffer> buffers;
}
+
+patch class SecurityContext {
+ /* patch */ factory SecurityContext() {
+ return new _SecurityContext();
+ }
+
+ /* patch */ static SecurityContext get defaultContext {
+ return _SecurityContext.defaultContext;
+ }
+}
+
+class _SecurityContext
+ extends NativeFieldWrapperClass1
+ implements SecurityContext {
+ _SecurityContext() {
+ _createNativeContext();
+ }
+
+ void _createNativeContext() native "SecurityContext_Allocate";
+
+ static final SecurityContext defaultContext =
+ new _SecurityContext().._trustBuiltinRoots();
+
+ void usePrivateKey(String keyFile, {String password})
+ native "SecurityContext_UsePrivateKey";
+ void setTrustedCertificates({String file, String directory})
+ native "SecurityContext_SetTrustedCertificates";
+ void useCertificateChain(String file)
+ native "SecurityContext_UseCertificateChain";
+ void setClientAuthorities(String file)
+ native "SecurityContext_SetClientAuthorities";
+ void setAlpnProtocols(List<String> protocols, bool isServer) {
+ Uint8List encodedProtocols =
+ SecurityContext._protocolsToLengthEncoding(protocols);
+ _setAlpnProtocols(encodedProtocols, isServer);
+ }
+ void _setAlpnProtocols(Uint8List protocols, bool isServer)
+ native "SecurityContext_SetAlpnProtocols";
+ void _trustBuiltinRoots()
+ native "SecurityContext_TrustBuiltinRoots";
+}
+
+/**
+ * _X509CertificateImpl wraps an X509 certificate object held by the BoringSSL
+ * library. It exposes the fields of the certificate object.
+ */
+class _X509CertificateImpl extends NativeFieldWrapperClass1
+ implements X509Certificate {
+ // The native field must be set manually on a new object, in native code.
+ // This is done by WrappedX509 in secure_socket.cc.
+ _X509CertificateImpl();
+
+ String get subject native "X509_Subject";
+ String get issuer native "X509_Issuer";
+ DateTime get startValidity {
+ return new DateTime.fromMillisecondsSinceEpoch(_startValidity(),
+ isUtc: true);
+ }
+ DateTime get endValidity {
+ return new DateTime.fromMillisecondsSinceEpoch(_endValidity(),
+ isUtc: true);
+ }
+ int _startValidity() native "X509_StartValidity";
+ int _endValidity() native "X509_EndValidity";
+}
« no previous file with comments | « runtime/bin/secure_socket.cc ('k') | runtime/bin/secure_socket_unsupported.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698