OLD | NEW |
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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 * must also have filesystem links added, which link extra filenames based | 73 * must also have filesystem links added, which link extra filenames based |
74 * on the hash of a certificate's distinguished name (DN) to the file | 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 | 75 * containing that certificate. OpenSSL contains a tool called c_rehash |
76 * to create these links in a directory. | 76 * to create these links in a directory. |
77 */ | 77 */ |
78 void setTrustedCertificates({String file, String directory}); | 78 void setTrustedCertificates({String file, String directory}); |
79 | 79 |
80 /** | 80 /** |
81 * Sets the chain of X509 certificates served by [SecureServer] | 81 * Sets the chain of X509 certificates served by [SecureServer] |
82 * when making secure connections, including the server certificate. | 82 * when making secure connections, including the server certificate. |
83 * [file] is an PEM file containing X509 certificates, starting with | 83 * |
| 84 * [file] is a PEM file containing X509 certificates, starting with |
84 * the root authority and intermediate authorities forming the signed | 85 * the root authority and intermediate authorities forming the signed |
85 * chain to the server certificate, and ending with the server certificate. | 86 * chain to the server certificate, and ending with the server certificate. |
86 * The private key for the server certificate is set by [usePrivateKey]. | 87 * The private key for the server certificate is set by [usePrivateKey]. |
| 88 * |
| 89 * The function returns a [Future] that completes when the certificate chain |
| 90 * has been set. |
87 */ | 91 */ |
88 void useCertificateChain(String file); | 92 Future useCertificateChain(String file); |
| 93 |
| 94 /** |
| 95 * Sets the chain of X509 certificates served by [SecureServer] |
| 96 * when making secure connections, including the server certificate. |
| 97 * |
| 98 * [chainBytes] is the contents of a PEM file containing X509 certificates, |
| 99 * starting with the root authority and intermediate authorities forming the |
| 100 * signed chain to the server certificate, and ending with the server |
| 101 * certificate. The private key for the server certificate is set by |
| 102 * [usePrivateKey]. |
| 103 */ |
| 104 void useCertificateChainAsBytes(List<int> chainBytes); |
89 | 105 |
90 /** | 106 /** |
91 * Sets the list of authority names that a [SecureServer] will advertise | 107 * Sets the list of authority names that a [SecureServer] will advertise |
92 * as accepted, when requesting a client certificate from a connecting | 108 * as accepted, when requesting a client certificate from a connecting |
93 * client. [file] is a PEM file containing the accepted signing authority | 109 * client. [file] is a PEM file containing the accepted signing authority |
94 * certificates - the authority names are extracted from the certificates. | 110 * certificates - the authority names are extracted from the certificates. |
95 */ | 111 */ |
96 void setClientAuthorities(String file); | 112 void setClientAuthorities(String file); |
97 | 113 |
98 /** | 114 /** |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 } | 216 } |
201 | 217 |
202 if (bytes.length >= (1 << 13)) { | 218 if (bytes.length >= (1 << 13)) { |
203 throw new ArgumentError( | 219 throw new ArgumentError( |
204 'The maximum message length supported is 2^13-1.'); | 220 'The maximum message length supported is 2^13-1.'); |
205 } | 221 } |
206 | 222 |
207 return new Uint8List.fromList(bytes); | 223 return new Uint8List.fromList(bytes); |
208 } | 224 } |
209 } | 225 } |
OLD | NEW |