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 #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/values.h" | 12 #include "base/values.h" |
| 13 #include "content/common/content_export.h" |
12 #include "third_party/WebKit/public/platform/WebArrayBuffer.h" | 14 #include "third_party/WebKit/public/platform/WebArrayBuffer.h" |
13 #include "third_party/WebKit/public/platform/WebCrypto.h" | 15 #include "third_party/WebKit/public/platform/WebCrypto.h" |
14 #include "third_party/WebKit/public/platform/WebCryptoAlgorithmParams.h" | 16 #include "third_party/WebKit/public/platform/WebCryptoAlgorithmParams.h" |
15 | 17 |
16 namespace content { | 18 namespace content { |
17 | 19 |
18 namespace webcrypto { | 20 namespace webcrypto { |
19 | 21 |
20 class CryptoData; | 22 class CryptoData; |
21 class Status; | 23 class Status; |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 // present. | 115 // present. |
114 // * expected_usage_mask must be a subset of the JWK's "key_ops" if present. | 116 // * expected_usage_mask must be a subset of the JWK's "key_ops" if present. |
115 Status ReadRsaKeyJwk(const CryptoData& key_data, | 117 Status ReadRsaKeyJwk(const CryptoData& key_data, |
116 const std::string& expected_algorithm, | 118 const std::string& expected_algorithm, |
117 bool expected_extractable, | 119 bool expected_extractable, |
118 blink::WebCryptoKeyUsageMask expected_usage_mask, | 120 blink::WebCryptoKeyUsageMask expected_usage_mask, |
119 JwkRsaInfo* result); | 121 JwkRsaInfo* result); |
120 | 122 |
121 const char* GetJwkHmacAlgorithmName(blink::WebCryptoAlgorithmId hash); | 123 const char* GetJwkHmacAlgorithmName(blink::WebCryptoAlgorithmId hash); |
122 | 124 |
| 125 // This function decodes unpadded 'base64url' encoded data, as described in |
| 126 // RFC4648 (http://www.ietf.org/rfc/rfc4648.txt) Section 5. |
| 127 CONTENT_EXPORT bool Base64DecodeUrlSafe(const std::string& input, |
| 128 std::string* output); |
| 129 |
| 130 // Returns an unpadded 'base64url' encoding of the input data, the opposite of |
| 131 // Base64DecodeUrlSafe() above. |
| 132 CONTENT_EXPORT std::string Base64EncodeUrlSafe(const base::StringPiece& input); |
| 133 CONTENT_EXPORT std::string Base64EncodeUrlSafe( |
| 134 const std::vector<uint8_t>& input); |
| 135 |
123 } // namespace webcrypto | 136 } // namespace webcrypto |
124 | 137 |
125 } // namespace content | 138 } // namespace content |
126 | 139 |
127 #endif // CONTENT_CHILD_WEBCRYPTO_JWK_H_ | 140 #endif // CONTENT_CHILD_WEBCRYPTO_JWK_H_ |
OLD | NEW |