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

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

Issue 15298004: Use dart:crypto's Base64 methods in dart:io. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 7 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
« no previous file with comments | « sdk/lib/io/iolib_sources.gypi ('k') | tests/standalone/crypto/base64_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/io/websocket_impl.dart
diff --git a/sdk/lib/io/websocket_impl.dart b/sdk/lib/io/websocket_impl.dart
index 74df425029129c6c987d97933c89de56713abb27..3842b605569cb0d769fe29550f4c7aa4a4234ba0 100644
--- a/sdk/lib/io/websocket_impl.dart
+++ b/sdk/lib/io/websocket_impl.dart
@@ -408,7 +408,7 @@ class _WebSocketTransformerImpl implements WebSocketTransformer {
String key = request.headers.value("Sec-WebSocket-Key");
SHA1 sha1 = new SHA1();
sha1.add("$key$_webSocketGUID".codeUnits);
- String accept = _Base64._encode(sha1.close());
+ String accept = CryptoUtils.bytesToBase64(sha1.close());
response.headers.add("Sec-WebSocket-Accept", accept);
response.headers.contentLength = 0;
return response.detachSocket()
@@ -659,7 +659,7 @@ class _WebSocketImpl extends Stream implements WebSocket {
for (int i = 0; i < 16; i++) {
nonceData[i] = random.nextInt(256);
}
- String nonce = _Base64._encode(nonceData);
+ String nonce = CryptoUtils.bytesToBase64(nonceData);
uri = new Uri.fromComponents(scheme: uri.scheme == "wss" ? "https" : "http",
userInfo: uri.userInfo,
@@ -700,7 +700,7 @@ class _WebSocketImpl extends Stream implements WebSocket {
SHA1 sha1 = new SHA1();
sha1.add("$nonce$_webSocketGUID".codeUnits);
List<int> expectedAccept = sha1.close();
- List<int> receivedAccept = _Base64._decode(accept);
+ List<int> receivedAccept = CryptoUtils.base64StringToBytes(accept);
if (expectedAccept.length != receivedAccept.length) {
error("Reasponse header 'Sec-WebSocket-Accept' is the wrong length");
}
« no previous file with comments | « sdk/lib/io/iolib_sources.gypi ('k') | tests/standalone/crypto/base64_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698