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

Side by Side Diff: tests/standalone/io/security_context_argument_test.dart

Issue 1384533002: Add check for password length in SecurityContext. Check return values from BoringSSL functions, thr… (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Address comments. Created 5 years, 2 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
« no previous file with comments | « runtime/bin/secure_socket.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // BSD-style license that can be found in the LICENSE file.
4
5 import "package:expect/expect.dart";
6 import "dart:io";
7
8 String localFile(path) => Platform.script.resolve(path).toFilePath();
9
10 bool printException(e) { print(e); return true; }
11 bool argumentError(e) => e is ArgumentError;
12 bool tlsException(e) => e is TlsException;
13
14 void testUsePrivateKeyArguments() {
15 var c = new SecurityContext();
16 c.useCertificateChain(localFile('certificates/server_chain.pem'));
17 Expect.throws(() => c.usePrivateKey(
18 localFile('certificates/server_key.pem'), password: "dart" * 1000),
19 argumentError);
20 Expect.throws(() => c.usePrivateKey(
21 localFile('certificates/server_key.pem')),
22 tlsException);
23 Expect.throws(() => c.usePrivateKey(
24 localFile('certificates/server_key.pem'), password: "iHackSites"),
25 tlsException);
26 Expect.throws(() => c.usePrivateKey(
27 localFile('certificates/server_key_oops.pem'), password: "dartdart"),
28 tlsException);
29 Expect.throws(() => c.usePrivateKey(1), argumentError);
30 Expect.throws(() => c.usePrivateKey(null), argumentError);
31 Expect.throws(() => c.usePrivateKey(
32 localFile('certificates/server_key_oops.pem'), password: 3),
33 argumentError);
34 c.usePrivateKey(
35 localFile('certificates/server_key.pem'), password: "dartdart");
36 }
37
38 void main() {
39 testUsePrivateKeyArguments();
40 }
OLDNEW
« no previous file with comments | « runtime/bin/secure_socket.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698