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

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

Issue 1665433002: Adds SecurityContext.setTrustedCertificatesBytes (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 10 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
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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 * The object containing the certificates to trust when making 8 * The object containing the certificates to trust when making
9 * a secure client connection, and the certificate chain and 9 * a secure client connection, and the certificate chain and
10 * private key to serve from a secure server. 10 * private key to serve from a secure server.
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 * [keyBytes] is the contents of a PEM file containing an encrypted 55 * [keyBytes] is the contents of a PEM file containing an encrypted
56 * private key, encrypted with [password]. An unencrypted file can be 56 * private key, encrypted with [password]. An unencrypted file can be
57 * used, but this is not usual. 57 * used, but this is not usual.
58 */ 58 */
59 void usePrivateKeyBytes(List<int> keyBytes, {String password}); 59 void usePrivateKeyBytes(List<int> keyBytes, {String password});
60 60
61 /** 61 /**
62 * Sets the set of trusted X509 certificates used by [SecureSocket] 62 * Sets the set of trusted X509 certificates used by [SecureSocket]
63 * client connections, when connecting to a secure server. 63 * client connections, when connecting to a secure server.
64 * 64 *
65 * There are two ways to set a set of trusted certificates, with a single 65 * [file] is the path to a PEM file containing X509 certificates, usually
66 * PEM file, or with a directory containing individual PEM files for
67 * certificates.
68 *
69 * [file] is an optional PEM file containing X509 certificates, usually
70 * root certificates from certificate authorities. 66 * root certificates from certificate authorities.
71 * 67 *
72 * [directory] is an optional directory containing PEM files. The directory 68 * The function returns a [Future] that completes when the certificates have
73 * must also have filesystem links added, which link extra filenames based 69 * been added.
74 * on the hash of a certificate's distinguished name (DN) to the file
75 * containing that certificate. OpenSSL contains a tool called c_rehash
76 * to create these links in a directory.
77 */ 70 */
78 void setTrustedCertificates({String file, String directory}); 71 Future setTrustedCertificates(String file);
72
73 /**
74 * Sets the set of trusted X509 certificates used by [SecureSocket]
75 * client connections, when connecting to a secure server.
76 *
77 * [file] is the contents of a PEM file containing X509 certificates, usually
78 * root certificates from certificate authorities.
79 */
80 void setTrustedCertificatesBytes(List<int> certBytes);
79 81
80 /** 82 /**
81 * Sets the chain of X509 certificates served by [SecureServer] 83 * Sets the chain of X509 certificates served by [SecureServer]
82 * when making secure connections, including the server certificate. 84 * when making secure connections, including the server certificate.
83 * 85 *
84 * [file] is a PEM file containing X509 certificates, starting with 86 * [file] is a PEM file containing X509 certificates, starting with
85 * the root authority and intermediate authorities forming the signed 87 * the root authority and intermediate authorities forming the signed
86 * chain to the server certificate, and ending with the server certificate. 88 * chain to the server certificate, and ending with the server certificate.
87 * The private key for the server certificate is set by [usePrivateKey]. 89 * The private key for the server certificate is set by [usePrivateKey].
88 * 90 *
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 } 218 }
217 219
218 if (bytes.length >= (1 << 13)) { 220 if (bytes.length >= (1 << 13)) {
219 throw new ArgumentError( 221 throw new ArgumentError(
220 'The maximum message length supported is 2^13-1.'); 222 'The maximum message length supported is 2^13-1.');
221 } 223 }
222 224
223 return new Uint8List.fromList(bytes); 225 return new Uint8List.fromList(bytes);
224 } 226 }
225 } 227 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698