| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/child/webcrypto/status.h" | 5 #include "content/child/webcrypto/status.h" |
| 6 | 6 |
| 7 namespace content { | 7 namespace content { |
| 8 | 8 |
| 9 namespace webcrypto { | 9 namespace webcrypto { |
| 10 | 10 |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 "The JWK property \"" + property + "\" could not be base64 decoded"); | 51 "The JWK property \"" + property + "\" could not be base64 decoded"); |
| 52 } | 52 } |
| 53 | 53 |
| 54 Status Status::ErrorJwkExtInconsistent() { | 54 Status Status::ErrorJwkExtInconsistent() { |
| 55 return Status( | 55 return Status( |
| 56 blink::WebCryptoErrorTypeData, | 56 blink::WebCryptoErrorTypeData, |
| 57 "The \"ext\" property of the JWK dictionary is inconsistent what that " | 57 "The \"ext\" property of the JWK dictionary is inconsistent what that " |
| 58 "specified by the Web Crypto call"); | 58 "specified by the Web Crypto call"); |
| 59 } | 59 } |
| 60 | 60 |
| 61 Status Status::ErrorJwkUnrecognizedAlgorithm() { | |
| 62 return Status(blink::WebCryptoErrorTypeData, | |
| 63 "The JWK \"alg\" property was not recognized"); | |
| 64 } | |
| 65 | |
| 66 Status Status::ErrorJwkAlgorithmInconsistent() { | 61 Status Status::ErrorJwkAlgorithmInconsistent() { |
| 67 return Status(blink::WebCryptoErrorTypeData, | 62 return Status(blink::WebCryptoErrorTypeData, |
| 68 "The JWK \"alg\" property was inconsistent with that specified " | 63 "The JWK \"alg\" property was inconsistent with that specified " |
| 69 "by the Web Crypto call"); | 64 "by the Web Crypto call"); |
| 70 } | 65 } |
| 71 | 66 |
| 72 Status Status::ErrorJwkUnrecognizedUse() { | 67 Status Status::ErrorJwkUnrecognizedUse() { |
| 73 return Status(blink::WebCryptoErrorTypeData, | 68 return Status(blink::WebCryptoErrorTypeData, |
| 74 "The JWK \"use\" property could not be parsed"); | 69 "The JWK \"use\" property could not be parsed"); |
| 75 } | 70 } |
| (...skipping 16 matching lines...) Expand all Loading... |
| 92 "specified by the Web Crypto call. The JWK usage must be a " | 87 "specified by the Web Crypto call. The JWK usage must be a " |
| 93 "superset of those requested"); | 88 "superset of those requested"); |
| 94 } | 89 } |
| 95 | 90 |
| 96 Status Status::ErrorJwkUseAndKeyopsInconsistent() { | 91 Status Status::ErrorJwkUseAndKeyopsInconsistent() { |
| 97 return Status(blink::WebCryptoErrorTypeData, | 92 return Status(blink::WebCryptoErrorTypeData, |
| 98 "The JWK \"use\" and \"key_ops\" properties were both found " | 93 "The JWK \"use\" and \"key_ops\" properties were both found " |
| 99 "but are inconsistent with each other."); | 94 "but are inconsistent with each other."); |
| 100 } | 95 } |
| 101 | 96 |
| 102 Status Status::ErrorJwkUnrecognizedKty() { | 97 Status Status::ErrorJwkUnexpectedKty(const std::string& expected) { |
| 103 return Status(blink::WebCryptoErrorTypeData, | 98 return Status(blink::WebCryptoErrorTypeData, |
| 104 "The JWK \"kty\" property was unrecognized"); | 99 "The JWK \"kty\" property was not \"" + expected + "\""); |
| 105 } | 100 } |
| 106 | 101 |
| 107 Status Status::ErrorJwkIncorrectKeyLength() { | 102 Status Status::ErrorJwkIncorrectKeyLength() { |
| 108 return Status(blink::WebCryptoErrorTypeData, | 103 return Status(blink::WebCryptoErrorTypeData, |
| 109 "The JWK \"k\" property did not include the right length " | 104 "The JWK \"k\" property did not include the right length " |
| 110 "of key data for the given algorithm."); | 105 "of key data for the given algorithm."); |
| 111 } | 106 } |
| 112 | 107 |
| 113 Status Status::ErrorJwkIncompleteOptionalRsaPrivateKey() { | 108 Status Status::ErrorJwkIncompleteOptionalRsaPrivateKey() { |
| 114 return Status(blink::WebCryptoErrorTypeData, | 109 return Status(blink::WebCryptoErrorTypeData, |
| 115 "The optional JWK properties p, q, dp, dq, qi must either all " | 110 "The optional JWK properties p, q, dp, dq, qi must either all " |
| 116 "be provided, or none provided"); | 111 "be provided, or none provided"); |
| 117 } | 112 } |
| 118 | 113 |
| 119 Status Status::ErrorImportEmptyKeyData() { | 114 Status Status::ErrorImportEmptyKeyData() { |
| 120 return Status(blink::WebCryptoErrorTypeData, "No key data was provided"); | 115 return Status(blink::WebCryptoErrorTypeData, "No key data was provided"); |
| 121 } | 116 } |
| 122 | 117 |
| 118 Status Status::ErrorUnsupportedImportKeyFormat() { |
| 119 return Status(blink::WebCryptoErrorTypeNotSupported, |
| 120 "Unsupported import key format for algorithm"); |
| 121 } |
| 122 |
| 123 Status Status::ErrorUnsupportedExportKeyFormat() { |
| 124 return Status(blink::WebCryptoErrorTypeNotSupported, |
| 125 "Unsupported export key format for algorithm"); |
| 126 } |
| 127 |
| 123 Status Status::ErrorImportAesKeyLength() { | 128 Status Status::ErrorImportAesKeyLength() { |
| 124 return Status(blink::WebCryptoErrorTypeData, | 129 return Status(blink::WebCryptoErrorTypeData, |
| 125 "AES key data must be 128, 192 or 256 bits"); | 130 "AES key data must be 128, 192 or 256 bits"); |
| 126 } | 131 } |
| 127 | 132 |
| 128 Status Status::ErrorAes192BitUnsupported() { | 133 Status Status::ErrorAes192BitUnsupported() { |
| 129 return Status(blink::WebCryptoErrorTypeNotSupported, | 134 return Status(blink::WebCryptoErrorTypeNotSupported, |
| 130 "192-bit AES keys are not supported"); | 135 "192-bit AES keys are not supported"); |
| 131 } | 136 } |
| 132 | 137 |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 error_type_(error_type), | 222 error_type_(error_type), |
| 218 error_details_(error_details_utf8) { | 223 error_details_(error_details_utf8) { |
| 219 } | 224 } |
| 220 | 225 |
| 221 Status::Status(Type type) : type_(type) { | 226 Status::Status(Type type) : type_(type) { |
| 222 } | 227 } |
| 223 | 228 |
| 224 } // namespace webcrypto | 229 } // namespace webcrypto |
| 225 | 230 |
| 226 } // namespace content | 231 } // namespace content |
| OLD | NEW |