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

Side by Side Diff: content/renderer/webcrypto/webcrypto_util.cc

Issue 155623005: Refactor to share more code between OpenSSL and NSS implementations. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix for openssl Created 6 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/renderer/webcrypto/webcrypto_util.h" 5 #include "content/renderer/webcrypto/webcrypto_util.h"
6 6
7 #include "base/base64.h" 7 #include "base/base64.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "third_party/WebKit/public/platform/WebCryptoAlgorithm.h" 9 #include "third_party/WebKit/public/platform/WebCryptoAlgorithm.h"
10 #include "third_party/WebKit/public/platform/WebCryptoAlgorithmParams.h" 10 #include "third_party/WebKit/public/platform/WebCryptoAlgorithmParams.h"
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 } 100 }
101 101
102 Status Status::ErrorImportEmptyKeyData() { 102 Status Status::ErrorImportEmptyKeyData() {
103 return Status("No key data was provided"); 103 return Status("No key data was provided");
104 } 104 }
105 105
106 Status Status::ErrorUnexpectedKeyType() { 106 Status Status::ErrorUnexpectedKeyType() {
107 return Status("The key is not of the expected type"); 107 return Status("The key is not of the expected type");
108 } 108 }
109 109
110 Status Status::ErrorKeyAlgorithmMismatch() {
111 return Status("The key's algorithm doesn't match that of operation");
112 }
113
110 Status Status::ErrorIncorrectSizeAesCbcIv() { 114 Status Status::ErrorIncorrectSizeAesCbcIv() {
111 return Status("The \"iv\" has an unexpected length -- must be 16 bytes"); 115 return Status("The \"iv\" has an unexpected length -- must be 16 bytes");
112 } 116 }
113 117
114 Status Status::ErrorDataTooLarge() { 118 Status Status::ErrorDataTooLarge() {
115 return Status("The provided data is too large"); 119 return Status("The provided data is too large");
116 } 120 }
117 121
118 Status Status::ErrorUnsupported() { 122 Status Status::ErrorUnsupported() {
119 return Status("The requested operation is unsupported"); 123 return Status("The requested operation is unsupported");
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 return 64; 323 return 64;
320 case blink::WebCryptoAlgorithmIdSha384: 324 case blink::WebCryptoAlgorithmIdSha384:
321 case blink::WebCryptoAlgorithmIdSha512: 325 case blink::WebCryptoAlgorithmIdSha512:
322 return 128; 326 return 128;
323 default: 327 default:
324 NOTREACHED(); 328 NOTREACHED();
325 return 0; 329 return 0;
326 } 330 }
327 } 331 }
328 332
333 bool IsAlgorithmAsymmetric(const blink::WebCryptoAlgorithm& algorithm) {
334 // TODO(padolph): include all other asymmetric algorithms once they are
335 // defined, e.g. EC and DH.
336 return (algorithm.id() == blink::WebCryptoAlgorithmIdRsaEsPkcs1v1_5 ||
337 algorithm.id() == blink::WebCryptoAlgorithmIdRsaSsaPkcs1v1_5 ||
338 algorithm.id() == blink::WebCryptoAlgorithmIdRsaOaep);
339 }
340
329 } // namespace webcrypto 341 } // namespace webcrypto
330 342
331 } // namespace content 343 } // namespace content
OLDNEW
« content/renderer/webcrypto/webcrypto_util.h ('K') | « content/renderer/webcrypto/webcrypto_util.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698