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

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: 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
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 // Returns the "hash" param for an algorithm if it exists, otherwise returns 31 // Returns the "hash" param for an algorithm if it exists, otherwise returns
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 Status GetRsaKeyGenParameters( 82 Status GetRsaKeyGenParameters(
97 const blink::WebCryptoRsaHashedKeyGenParams* params, 83 const blink::WebCryptoRsaHashedKeyGenParams* params,
98 unsigned int* public_exponent, 84 unsigned int* public_exponent,
99 unsigned int* modulus_length_bits); 85 unsigned int* modulus_length_bits);
100 86
101 } // namespace webcrypto 87 } // namespace webcrypto
102 88
103 } // namespace content 89 } // namespace content
104 90
105 #endif // CONTENT_CHILD_WEBCRYPTO_WEBCRYPTO_UTIL_H_ 91 #endif // CONTENT_CHILD_WEBCRYPTO_WEBCRYPTO_UTIL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698