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

Unified Diff: sdk/lib/io/secure_socket.dart

Issue 18097007: Add SecureSocket.addCertificate. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Improve formatting Created 7 years, 5 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
Index: sdk/lib/io/secure_socket.dart
diff --git a/sdk/lib/io/secure_socket.dart b/sdk/lib/io/secure_socket.dart
index 18670502cf2c448ff7392687bc1ce014cba92d44..44f2cff20c3012551545984870464964a79c3741 100644
--- a/sdk/lib/io/secure_socket.dart
+++ b/sdk/lib/io/secure_socket.dart
@@ -205,6 +205,26 @@ abstract class SecureSocket implements Socket {
external static void initialize({String database,
String password,
bool useBuiltinRoots: true});
+
+
+ /**
+ * Adds a X509 certificate (for SSL and TLS secure networking) to the
+ * in-memory certificate database. Returns an X509Certificate object
+ * with information about the added certificate.
+ *
+ * [certificate] must be a list of bytes encoding a certificate in
+ * PEM format: a base64 encoded DER certificate, enclosed between
+ * "-----BEGIN CERTIFICATE-----" and "-----END CERTIFICATE-----".
+ *
+ * [trust] is a string specifying the allowed uses of this certificate.
+ * For example, 'TC,,' specifies that the certificate is for a certificate
Søren Gjesse 2013/07/29 14:12:19 Could we add some string constants (with dartdoc)
Bill Hesse 2013/07/30 10:00:10 Done.
+ * authority that is trusted to issue server and client certificates, so
+ * that a server or client certificate signed by this authority will be
+ * accepted.
+ * See the documentation of NSS certutil for more about trust attributes.
Søren Gjesse 2013/07/29 14:12:19 Can we add a URL here?
Bill Hesse 2013/07/30 10:00:10 Done.
+ */
+ external static X509Certificate addCertificate(List<int> certificate,
+ String trust);
}
@@ -412,7 +432,8 @@ class _RawSecureSocket extends Stream<RawSocketEvent>
static final int NUM_BUFFERS = 4;
// Is a buffer identifier for an encrypted buffer?
- static bool _isBufferEncrypted(int identifier) => identifier >= READ_ENCRYPTED;
+ static bool _isBufferEncrypted(int identifier) =>
+ identifier >= READ_ENCRYPTED;
RawSocket _socket;
final Completer<_RawSecureSocket> _handshakeComplete =

Powered by Google App Engine
This is Rietveld 408576698