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

Side by Side Diff: sdk/lib/io/secure_socket.dart

Issue 21716004: dart:io | Add SecureSocket.importPrivateCertificates, that reads a PKCS#12 file. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Add more API functions, tests Created 7 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 part of dart.io; 5 part of dart.io;
6 6
7 /** 7 /**
8 * A high-level class for communicating securely over a TCP socket, using 8 * A high-level class for communicating securely over a TCP socket, using
9 * TLS and SSL. The [SecureSocket] exposes both a [Stream] and an 9 * TLS and SSL. The [SecureSocket] exposes both a [Stream] and an
10 * [IOSink] interface, making it ideal for using together with 10 * [IOSink] interface, making it ideal for using together with
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 * useBuiltinRoots: false); 198 * useBuiltinRoots: false);
199 * 199 *
200 * The database should be an NSS certificate database directory 200 * The database should be an NSS certificate database directory
201 * containing a cert9.db file, not a cert8.db file. This version of 201 * containing a cert9.db file, not a cert8.db file. This version of
202 * the database can be created using the NSS certutil tool with "sql:" in 202 * the database can be created using the NSS certutil tool with "sql:" in
203 * front of the absolute path of the database directory, or setting the 203 * front of the absolute path of the database directory, or setting the
204 * environment variable [[NSS_DEFAULT_DB_TYPE]] to "sql". 204 * environment variable [[NSS_DEFAULT_DB_TYPE]] to "sql".
205 */ 205 */
206 external static void initialize({String database, 206 external static void initialize({String database,
207 String password, 207 String password,
208 bool useBuiltinRoots: true}); 208 bool useBuiltinRoots: true,
209 bool readOnly: true});
209 210
210 211
211 /** 212 /**
212 * Trust strings for use in [addCertificate]. 213 * Trust strings for use in [addCertificate].
213 */ 214 */
214 static const String TRUST_ISSUE_SERVER_CERTIFICATES = 'C,,'; 215 static const String TRUST_ISSUE_SERVER_CERTIFICATES = 'C,,';
215 static const String TRUST_ISSUE_CLIENT_CERTIFICATES = 'T,,'; 216 static const String TRUST_ISSUE_CLIENT_CERTIFICATES = 'T,,';
216 static const String TRUST_ISSUE_CLIENT_SERVER_CERTIFICATES = 'TC,,'; 217 static const String TRUST_ISSUE_CLIENT_SERVER_CERTIFICATES = 'TC,,';
217 static const String TRUST_CERTIFICATE = 'P,,'; 218 static const String TRUST_CERTIFICATE = 'P,,';
218 219
(...skipping 14 matching lines...) Expand all
233 * accepted. 234 * accepted.
234 * 235 *
235 * See the documentation of NSS certutil at 236 * See the documentation of NSS certutil at
236 * http://developer.mozilla.org/en-US/docs/NSS_reference/NSS_tools_:_certutil 237 * http://developer.mozilla.org/en-US/docs/NSS_reference/NSS_tools_:_certutil
237 * or 238 * or
238 * http://blogs.oracle.com/meena/entry/notes_about_trust_flags 239 * http://blogs.oracle.com/meena/entry/notes_about_trust_flags
239 * for more information about trust attributes. 240 * for more information about trust attributes.
240 */ 241 */
241 external static X509Certificate addCertificate(List<int> certificate, 242 external static X509Certificate addCertificate(List<int> certificate,
242 String trust); 243 String trust);
244
245
246 /**
247 * Adds a X509 certificates (for SSL and TLS secure networking) with
248 * their private keys to the in-memory certificate database.
249 *
250 * [certificates] must be a list of bytes encoding a PKCS#12 encoded
251 * list of certificates and private keys. These are commonly called
252 * .pk files.
253 *
254 * All certificates are imported with no default trust, and the appropriate
255 * uses of each certificate must be added with SecureSocket.changeTrust.
256 *
257 * See the documentation of NSS certutil at
258 * http://developer.mozilla.org/en-US/docs/NSS_reference/NSS_tools_:_certutil
259 * or
260 * http://blogs.oracle.com/meena/entry/notes_about_trust_flags
261 * for more information about trust attributes.
262 */
263 external static importPrivateCertificates(List<int> certificates,
264 String password);
265
266
267 external static X509Certificate changeTrust(String nicknameOrDN,
268 String trust);
269
270 external static removeCertificate(String nicknameOrDN);
243 } 271 }
244 272
245 273
246 /** 274 /**
247 * RawSecureSocket provides a secure (SSL or TLS) network connection. 275 * RawSecureSocket provides a secure (SSL or TLS) network connection.
248 * Client connections to a server are provided by calling 276 * Client connections to a server are provided by calling
249 * RawSecureSocket.connect. A secure server, created with 277 * RawSecureSocket.connect. A secure server, created with
250 * RawSecureServerSocket, also returns RawSecureSocket objects representing 278 * RawSecureServerSocket, also returns RawSecureSocket objects representing
251 * the server end of a secure connection. 279 * the server end of a secure connection.
252 * The certificate provided by the server is checked 280 * The certificate provided by the server is checked
(...skipping 1051 matching lines...) Expand 10 before | Expand all | Expand 10 after
1304 /** 1332 /**
1305 * An exception that happens in the handshake phase of establishing 1333 * An exception that happens in the handshake phase of establishing
1306 * a secure network connection, when looking up or verifying a 1334 * a secure network connection, when looking up or verifying a
1307 * certificate. 1335 * certificate.
1308 */ 1336 */
1309 class CertificateException extends TlsException { 1337 class CertificateException extends TlsException {
1310 const CertificateException([String message = "", 1338 const CertificateException([String message = "",
1311 OSError osError = null]) 1339 OSError osError = null])
1312 : super._("CertificateException", message, osError); 1340 : super._("CertificateException", message, osError);
1313 } 1341 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698