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

Side by Side Diff: content/child/webcrypto/webcrypto_util.h

Issue 504413004: Move base64-urlsafe helpers to jwk.{cc,h} (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase and add missing headers Created 6 years, 3 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 | « content/child/webcrypto/test/test_helpers.cc ('k') | content/child/webcrypto/webcrypto_util.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_WEBCRYPTO_UTIL_H_ 5 #ifndef CONTENT_CHILD_WEBCRYPTO_WEBCRYPTO_UTIL_H_
6 #define CONTENT_CHILD_WEBCRYPTO_WEBCRYPTO_UTIL_H_ 6 #define CONTENT_CHILD_WEBCRYPTO_WEBCRYPTO_UTIL_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 #include <string> 9 #include <string>
10 #include <vector>
11 10
12 #include "base/strings/string_piece.h"
13 #include "base/values.h" 11 #include "base/values.h"
14 #include "content/common/content_export.h" 12 #include "content/common/content_export.h"
15 #include "third_party/WebKit/public/platform/WebCryptoAlgorithm.h" 13 #include "third_party/WebKit/public/platform/WebCryptoAlgorithm.h"
16 #include "third_party/WebKit/public/platform/WebCryptoKey.h" 14 #include "third_party/WebKit/public/platform/WebCryptoKey.h"
17 15
18 namespace content { 16 namespace content {
19 17
20 namespace webcrypto { 18 namespace webcrypto {
21 19
22 class Status; 20 class Status;
23 21
24 // This function decodes unpadded 'base64url' encoded data, as described in
25 // RFC4648 (http://www.ietf.org/rfc/rfc4648.txt) Section 5.
26 // In Web Crypto, this type of encoding is only used inside JWK.
27 CONTENT_EXPORT bool Base64DecodeUrlSafe(const std::string& input,
28 std::string* output);
29
30 // Returns an unpadded 'base64url' encoding of the input data, the opposite of
31 // Base64DecodeUrlSafe() above.
32 CONTENT_EXPORT std::string Base64EncodeUrlSafe(const base::StringPiece& input);
33 CONTENT_EXPORT std::string Base64EncodeUrlSafe(
34 const std::vector<uint8_t>& input);
35
36 // Composes a Web Crypto usage mask from an array of JWK key_ops values. 22 // Composes a Web Crypto usage mask from an array of JWK key_ops values.
37 CONTENT_EXPORT Status GetWebCryptoUsagesFromJwkKeyOps( 23 CONTENT_EXPORT Status GetWebCryptoUsagesFromJwkKeyOps(
38 const base::ListValue* jwk_key_ops_value, 24 const base::ListValue* jwk_key_ops_value,
39 blink::WebCryptoKeyUsageMask* jwk_key_ops_mask); 25 blink::WebCryptoKeyUsageMask* jwk_key_ops_mask);
40 26
41 // Composes a JWK key_ops array from a Web Crypto usage mask. 27 // Composes a JWK key_ops array from a Web Crypto usage mask.
42 base::ListValue* CreateJwkKeyOpsFromWebCryptoUsages( 28 base::ListValue* CreateJwkKeyOpsFromWebCryptoUsages(
43 blink::WebCryptoKeyUsageMask usage_mask); 29 blink::WebCryptoKeyUsageMask usage_mask);
44 30
45 // Creates a WebCryptoAlgorithm without any parameters. 31 // Creates a WebCryptoAlgorithm without any parameters.
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 Status GetRsaKeyGenParameters( 77 Status GetRsaKeyGenParameters(
92 const blink::WebCryptoRsaHashedKeyGenParams* params, 78 const blink::WebCryptoRsaHashedKeyGenParams* params,
93 unsigned int* public_exponent, 79 unsigned int* public_exponent,
94 unsigned int* modulus_length_bits); 80 unsigned int* modulus_length_bits);
95 81
96 } // namespace webcrypto 82 } // namespace webcrypto
97 83
98 } // namespace content 84 } // namespace content
99 85
100 #endif // CONTENT_CHILD_WEBCRYPTO_WEBCRYPTO_UTIL_H_ 86 #endif // CONTENT_CHILD_WEBCRYPTO_WEBCRYPTO_UTIL_H_
OLDNEW
« no previous file with comments | « content/child/webcrypto/test/test_helpers.cc ('k') | content/child/webcrypto/webcrypto_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698