| 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 28 matching lines...) Expand all Loading... |
| 39 // TODO(eroman): Move this to JWK file. | 39 // TODO(eroman): Move this to JWK file. |
| 40 // This function decodes unpadded 'base64url' encoded data, as described in | 40 // This function decodes unpadded 'base64url' encoded data, as described in |
| 41 // RFC4648 (http://www.ietf.org/rfc/rfc4648.txt) Section 5. | 41 // RFC4648 (http://www.ietf.org/rfc/rfc4648.txt) Section 5. |
| 42 // In Web Crypto, this type of encoding is only used inside JWK. | 42 // In Web Crypto, this type of encoding is only used inside JWK. |
| 43 CONTENT_EXPORT bool Base64DecodeUrlSafe(const std::string& input, | 43 CONTENT_EXPORT bool Base64DecodeUrlSafe(const std::string& input, |
| 44 std::string* output); | 44 std::string* output); |
| 45 | 45 |
| 46 // Returns an unpadded 'base64url' encoding of the input data, the opposite of | 46 // Returns an unpadded 'base64url' encoding of the input data, the opposite of |
| 47 // Base64DecodeUrlSafe() above. | 47 // Base64DecodeUrlSafe() above. |
| 48 std::string Base64EncodeUrlSafe(const base::StringPiece& input); | 48 std::string Base64EncodeUrlSafe(const base::StringPiece& input); |
| 49 std::string Base64EncodeUrlSafe(const std::vector<uint8>& input); |
| 49 | 50 |
| 50 // Composes a Web Crypto usage mask from an array of JWK key_ops values. | 51 // Composes a Web Crypto usage mask from an array of JWK key_ops values. |
| 51 CONTENT_EXPORT Status GetWebCryptoUsagesFromJwkKeyOps( | 52 CONTENT_EXPORT Status GetWebCryptoUsagesFromJwkKeyOps( |
| 52 const base::ListValue* jwk_key_ops_value, | 53 const base::ListValue* jwk_key_ops_value, |
| 53 blink::WebCryptoKeyUsageMask* jwk_key_ops_mask); | 54 blink::WebCryptoKeyUsageMask* jwk_key_ops_mask); |
| 54 | 55 |
| 55 // Composes a JWK key_ops array from a Web Crypto usage mask. | 56 // Composes a JWK key_ops array from a Web Crypto usage mask. |
| 56 base::ListValue* CreateJwkKeyOpsFromWebCryptoUsages( | 57 base::ListValue* CreateJwkKeyOpsFromWebCryptoUsages( |
| 57 blink::WebCryptoKeyUsageMask usage_mask); | 58 blink::WebCryptoKeyUsageMask usage_mask); |
| 58 | 59 |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 | 97 |
| 97 bool CreateSecretKeyAlgorithm(const blink::WebCryptoAlgorithm& algorithm, | 98 bool CreateSecretKeyAlgorithm(const blink::WebCryptoAlgorithm& algorithm, |
| 98 unsigned int keylen_bytes, | 99 unsigned int keylen_bytes, |
| 99 blink::WebCryptoKeyAlgorithm* key_algorithm); | 100 blink::WebCryptoKeyAlgorithm* key_algorithm); |
| 100 | 101 |
| 101 } // namespace webcrypto | 102 } // namespace webcrypto |
| 102 | 103 |
| 103 } // namespace content | 104 } // namespace content |
| 104 | 105 |
| 105 #endif // CONTENT_CHILD_WEBCRYPTO_WEBCRYPTO_UTIL_H_ | 106 #endif // CONTENT_CHILD_WEBCRYPTO_WEBCRYPTO_UTIL_H_ |
| OLD | NEW |