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

Side by Side Diff: components/webcrypto/jwk.h

Issue 1077273002: html_viewer: Move webcrypto to a place where html_viewer can use it. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase to ToT Created 5 years, 8 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
« no previous file with comments | « components/webcrypto/generate_key_result.cc ('k') | components/webcrypto/jwk.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #ifndef CONTENT_CHILD_WEBCRYPTO_JWK_H_ 5 #ifndef COMPONENTS_WEBCRYPTO_JWK_H_
6 #define CONTENT_CHILD_WEBCRYPTO_JWK_H_ 6 #define COMPONENTS_WEBCRYPTO_JWK_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/strings/string_piece.h" 11 #include "base/strings/string_piece.h"
12 #include "base/values.h" 12 #include "base/values.h"
13 #include "content/common/content_export.h"
14 #include "third_party/WebKit/public/platform/WebCrypto.h" 13 #include "third_party/WebKit/public/platform/WebCrypto.h"
15 14
16 namespace content {
17
18 namespace webcrypto { 15 namespace webcrypto {
19 16
20 class CryptoData; 17 class CryptoData;
21 class Status; 18 class Status;
22 19
23 // Helper class for parsing a JWK from JSON. 20 // Helper class for parsing a JWK from JSON.
24 // 21 //
25 // This primarily exists to ensure strict enforcement of the JWK schema, as the 22 // This primarily exists to ensure strict enforcement of the JWK schema, as the
26 // type and presence of particular members is security relevant. For example, 23 // type and presence of particular members is security relevant. For example,
27 // GetString() will ensure a given JSON member is present and is a string type, 24 // GetString() will ensure a given JSON member is present and is a string type,
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 bool expected_extractable, 223 bool expected_extractable,
227 blink::WebCryptoKeyUsageMask expected_usages, 224 blink::WebCryptoKeyUsageMask expected_usages,
228 JwkRsaInfo* result); 225 JwkRsaInfo* result);
229 226
230 const char* GetJwkHmacAlgorithmName(blink::WebCryptoAlgorithmId hash); 227 const char* GetJwkHmacAlgorithmName(blink::WebCryptoAlgorithmId hash);
231 228
232 // This decodes JWK's flavor of base64 encoding, as described by: 229 // This decodes JWK's flavor of base64 encoding, as described by:
233 // https://tools.ietf.org/html/draft-ietf-jose-json-web-signature-36#section-2 230 // https://tools.ietf.org/html/draft-ietf-jose-json-web-signature-36#section-2
234 // 231 //
235 // In essence it is RFC 4648 'base64url' encoding where padding is omitted. 232 // In essence it is RFC 4648 'base64url' encoding where padding is omitted.
236 CONTENT_EXPORT bool Base64DecodeUrlSafe(const std::string& input, 233 bool Base64DecodeUrlSafe(const std::string& input, std::string* output);
237 std::string* output);
238 234
239 // Encodes |input| using JWK's flavor of base64 encoding. See the description 235 // Encodes |input| using JWK's flavor of base64 encoding. See the description
240 // above for details. 236 // above for details.
241 CONTENT_EXPORT std::string Base64EncodeUrlSafe(const base::StringPiece& input); 237 std::string Base64EncodeUrlSafe(const base::StringPiece& input);
242 CONTENT_EXPORT std::string Base64EncodeUrlSafe( 238 std::string Base64EncodeUrlSafe(const std::vector<uint8_t>& input);
243 const std::vector<uint8_t>& input);
244 239
245 // Converts a JWK "key_ops" array to the corresponding WebCrypto usages. Used by 240 // Converts a JWK "key_ops" array to the corresponding WebCrypto usages. Used by
246 // testing. 241 // testing.
247 CONTENT_EXPORT Status 242 Status GetWebCryptoUsagesFromJwkKeyOpsForTest(
248 GetWebCryptoUsagesFromJwkKeyOpsForTest(const base::ListValue* key_ops, 243 const base::ListValue* key_ops,
249 blink::WebCryptoKeyUsageMask* usages); 244 blink::WebCryptoKeyUsageMask* usages);
250 245
251 } // namespace webcrypto 246 } // namespace webcrypto
252 247
253 } // namespace content 248 #endif // COMPONENTS_WEBCRYPTO_JWK_H_
254
255 #endif // CONTENT_CHILD_WEBCRYPTO_JWK_H_
OLDNEW
« no previous file with comments | « components/webcrypto/generate_key_result.cc ('k') | components/webcrypto/jwk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698