| 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_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 <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 CONTENT_EXPORT uint8* Uint8VectorStart(std::vector<uint8>* data); | 27 CONTENT_EXPORT uint8* Uint8VectorStart(std::vector<uint8>* data); |
| 28 | 28 |
| 29 // This function decodes unpadded 'base64url' encoded data, as described in | 29 // This function decodes unpadded 'base64url' encoded data, as described in |
| 30 // RFC4648 (http://www.ietf.org/rfc/rfc4648.txt) Section 5. | 30 // RFC4648 (http://www.ietf.org/rfc/rfc4648.txt) Section 5. |
| 31 // In Web Crypto, this type of encoding is only used inside JWK. | 31 // In Web Crypto, this type of encoding is only used inside JWK. |
| 32 CONTENT_EXPORT bool Base64DecodeUrlSafe(const std::string& input, | 32 CONTENT_EXPORT bool Base64DecodeUrlSafe(const std::string& input, |
| 33 std::string* output); | 33 std::string* output); |
| 34 | 34 |
| 35 // Returns an unpadded 'base64url' encoding of the input data, the opposite of | 35 // Returns an unpadded 'base64url' encoding of the input data, the opposite of |
| 36 // Base64DecodeUrlSafe() above. | 36 // Base64DecodeUrlSafe() above. |
| 37 std::string Base64EncodeUrlSafe(const base::StringPiece& input); | 37 CONTENT_EXPORT std::string Base64EncodeUrlSafe(const base::StringPiece& input); |
| 38 std::string Base64EncodeUrlSafe(const std::vector<uint8>& input); | 38 CONTENT_EXPORT std::string Base64EncodeUrlSafe(const std::vector<uint8>& input); |
| 39 | 39 |
| 40 // Composes a Web Crypto usage mask from an array of JWK key_ops values. | 40 // Composes a Web Crypto usage mask from an array of JWK key_ops values. |
| 41 CONTENT_EXPORT Status GetWebCryptoUsagesFromJwkKeyOps( | 41 CONTENT_EXPORT Status GetWebCryptoUsagesFromJwkKeyOps( |
| 42 const base::ListValue* jwk_key_ops_value, | 42 const base::ListValue* jwk_key_ops_value, |
| 43 blink::WebCryptoKeyUsageMask* jwk_key_ops_mask); | 43 blink::WebCryptoKeyUsageMask* jwk_key_ops_mask); |
| 44 | 44 |
| 45 // Composes a JWK key_ops array from a Web Crypto usage mask. | 45 // Composes a JWK key_ops array from a Web Crypto usage mask. |
| 46 base::ListValue* CreateJwkKeyOpsFromWebCryptoUsages( | 46 base::ListValue* CreateJwkKeyOpsFromWebCryptoUsages( |
| 47 blink::WebCryptoKeyUsageMask usage_mask); | 47 blink::WebCryptoKeyUsageMask usage_mask); |
| 48 | 48 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 69 | 69 |
| 70 bool CreateSecretKeyAlgorithm(const blink::WebCryptoAlgorithm& algorithm, | 70 bool CreateSecretKeyAlgorithm(const blink::WebCryptoAlgorithm& algorithm, |
| 71 unsigned int keylen_bytes, | 71 unsigned int keylen_bytes, |
| 72 blink::WebCryptoKeyAlgorithm* key_algorithm); | 72 blink::WebCryptoKeyAlgorithm* key_algorithm); |
| 73 | 73 |
| 74 } // namespace webcrypto | 74 } // namespace webcrypto |
| 75 | 75 |
| 76 } // namespace content | 76 } // namespace content |
| 77 | 77 |
| 78 #endif // CONTENT_CHILD_WEBCRYPTO_WEBCRYPTO_UTIL_H_ | 78 #endif // CONTENT_CHILD_WEBCRYPTO_WEBCRYPTO_UTIL_H_ |
| OLD | NEW |