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