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

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: Copy the msvs_disabled_warnings to the new target. 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
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 CONTENT_CHILD_WEBCRYPTO_JWK_H_
6 #define CONTENT_CHILD_WEBCRYPTO_JWK_H_ 6 #define CONTENT_CHILD_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 { 15 namespace components {
17 16
18 namespace webcrypto { 17 namespace webcrypto {
19 18
20 class CryptoData; 19 class CryptoData;
21 class Status; 20 class Status;
22 21
23 // Helper class for parsing a JWK from JSON. 22 // Helper class for parsing a JWK from JSON.
24 // 23 //
25 // This primarily exists to ensure strict enforcement of the JWK schema, as the 24 // 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, 25 // type and presence of particular members is security relevant. For example,
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 bool expected_extractable, 225 bool expected_extractable,
227 blink::WebCryptoKeyUsageMask expected_usages, 226 blink::WebCryptoKeyUsageMask expected_usages,
228 JwkRsaInfo* result); 227 JwkRsaInfo* result);
229 228
230 const char* GetJwkHmacAlgorithmName(blink::WebCryptoAlgorithmId hash); 229 const char* GetJwkHmacAlgorithmName(blink::WebCryptoAlgorithmId hash);
231 230
232 // This decodes JWK's flavor of base64 encoding, as described by: 231 // 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 232 // https://tools.ietf.org/html/draft-ietf-jose-json-web-signature-36#section-2
234 // 233 //
235 // In essence it is RFC 4648 'base64url' encoding where padding is omitted. 234 // In essence it is RFC 4648 'base64url' encoding where padding is omitted.
236 CONTENT_EXPORT bool Base64DecodeUrlSafe(const std::string& input, 235 bool Base64DecodeUrlSafe(const std::string& input, std::string* output);
237 std::string* output);
238 236
239 // Encodes |input| using JWK's flavor of base64 encoding. See the description 237 // Encodes |input| using JWK's flavor of base64 encoding. See the description
240 // above for details. 238 // above for details.
241 CONTENT_EXPORT std::string Base64EncodeUrlSafe(const base::StringPiece& input); 239 std::string Base64EncodeUrlSafe(const base::StringPiece& input);
242 CONTENT_EXPORT std::string Base64EncodeUrlSafe( 240 std::string Base64EncodeUrlSafe(const std::vector<uint8_t>& input);
243 const std::vector<uint8_t>& input);
244 241
245 // Converts a JWK "key_ops" array to the corresponding WebCrypto usages. Used by 242 // Converts a JWK "key_ops" array to the corresponding WebCrypto usages. Used by
246 // testing. 243 // testing.
247 CONTENT_EXPORT Status 244 Status GetWebCryptoUsagesFromJwkKeyOpsForTest(
248 GetWebCryptoUsagesFromJwkKeyOpsForTest(const base::ListValue* key_ops, 245 const base::ListValue* key_ops,
249 blink::WebCryptoKeyUsageMask* usages); 246 blink::WebCryptoKeyUsageMask* usages);
250 247
251 } // namespace webcrypto 248 } // namespace webcrypto
252 249
253 } // namespace content 250 } // namespace components
254 251
255 #endif // CONTENT_CHILD_WEBCRYPTO_JWK_H_ 252 #endif // CONTENT_CHILD_WEBCRYPTO_JWK_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698