| OLD | NEW |
| 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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 } | 105 } |
| 106 | 106 |
| 107 Status Status::ErrorIncorrectSizeAesCbcIv() { | 107 Status Status::ErrorIncorrectSizeAesCbcIv() { |
| 108 return Status("The \"iv\" has an unexpected length -- must be 16 bytes"); | 108 return Status("The \"iv\" has an unexpected length -- must be 16 bytes"); |
| 109 } | 109 } |
| 110 | 110 |
| 111 Status Status::ErrorDataTooLarge() { | 111 Status Status::ErrorDataTooLarge() { |
| 112 return Status("The provided data is too large"); | 112 return Status("The provided data is too large"); |
| 113 } | 113 } |
| 114 | 114 |
| 115 Status Status::ErrorDataTooSmall() { |
| 116 return Status("The provided data is too small"); |
| 117 } |
| 118 |
| 115 Status Status::ErrorUnsupported() { | 119 Status Status::ErrorUnsupported() { |
| 116 return Status("The requested operation is unsupported"); | 120 return Status("The requested operation is unsupported"); |
| 117 } | 121 } |
| 118 | 122 |
| 119 Status Status::ErrorUnexpected() { | 123 Status Status::ErrorUnexpected() { |
| 120 return Status("Something unexpected happened..."); | 124 return Status("Something unexpected happened..."); |
| 121 } | 125 } |
| 122 | 126 |
| 123 Status Status::ErrorInvalidAesGcmTagLength() { | 127 Status Status::ErrorInvalidAesGcmTagLength() { |
| 124 return Status( | 128 return Status( |
| 125 "The tag length is invalid: Must be 32, 64, 96, 104, 112, 120, or 128 " | 129 "The tag length is invalid: Must be 32, 64, 96, 104, 112, 120, or 128 " |
| 126 "bits"); | 130 "bits"); |
| 127 } | 131 } |
| 128 | 132 |
| 133 Status Status::ErrorInvalidAesKwDataLength() { |
| 134 return Status( |
| 135 "The AES-KW input data length is invalid: not a multiple of 8 " |
| 136 "bytes"); |
| 137 } |
| 138 |
| 129 Status Status::ErrorGenerateKeyPublicExponent() { | 139 Status Status::ErrorGenerateKeyPublicExponent() { |
| 130 return Status("The \"publicExponent\" is either empty, zero, or too large"); | 140 return Status("The \"publicExponent\" is either empty, zero, or too large"); |
| 131 } | 141 } |
| 132 | 142 |
| 133 Status Status::ErrorMissingAlgorithmImportRawKey() { | 143 Status Status::ErrorMissingAlgorithmImportRawKey() { |
| 134 return Status( | 144 return Status( |
| 135 "The key's algorithm must be specified when importing " | 145 "The key's algorithm must be specified when importing " |
| 136 "raw-formatted key."); | 146 "raw-formatted key."); |
| 137 } | 147 } |
| 138 | 148 |
| 149 Status Status::ErrorMissingAlgorithmUnwrapRawKey() { |
| 150 return Status( |
| 151 "The key's algorithm must be specified when unwrapping a " |
| 152 "raw-formatted key."); |
| 153 } |
| 154 |
| 139 Status Status::ErrorImportRsaEmptyModulus() { | 155 Status Status::ErrorImportRsaEmptyModulus() { |
| 140 return Status("The modulus is empty"); | 156 return Status("The modulus is empty"); |
| 141 } | 157 } |
| 142 | 158 |
| 143 Status Status::ErrorGenerateRsaZeroModulus() { | 159 Status Status::ErrorGenerateRsaZeroModulus() { |
| 144 return Status("The modulus bit length cannot be zero"); | 160 return Status("The modulus bit length cannot be zero"); |
| 145 } | 161 } |
| 146 | 162 |
| 147 Status Status::ErrorImportRsaEmptyExponent() { | 163 Status Status::ErrorImportRsaEmptyExponent() { |
| 148 return Status("No bytes for the exponent were provided"); | 164 return Status("No bytes for the exponent were provided"); |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 295 new blink::WebCryptoAesKeyAlgorithmParams(keylen_bytes * 8)); | 311 new blink::WebCryptoAesKeyAlgorithmParams(keylen_bytes * 8)); |
| 296 return true; | 312 return true; |
| 297 default: | 313 default: |
| 298 return false; | 314 return false; |
| 299 } | 315 } |
| 300 } | 316 } |
| 301 | 317 |
| 302 } // namespace webcrypto | 318 } // namespace webcrypto |
| 303 | 319 |
| 304 } // namespace content | 320 } // namespace content |
| OLD | NEW |