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 <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "base/values.h" | |
11 #include "third_party/WebKit/public/platform/WebArrayBuffer.h" | 12 #include "third_party/WebKit/public/platform/WebArrayBuffer.h" |
12 #include "third_party/WebKit/public/platform/WebCrypto.h" | 13 #include "third_party/WebKit/public/platform/WebCrypto.h" |
13 #include "third_party/WebKit/public/platform/WebCryptoAlgorithmParams.h" | 14 #include "third_party/WebKit/public/platform/WebCryptoAlgorithmParams.h" |
14 | 15 |
15 namespace content { | 16 namespace content { |
16 | 17 |
17 namespace webcrypto { | 18 namespace webcrypto { |
18 | 19 |
19 class CryptoData; | 20 class CryptoData; |
20 class Status; | 21 class Status; |
21 | 22 |
22 Status ImportKeyJwk(const CryptoData& key_data, | 23 void WriteSecretKeyJwk(const CryptoData& raw_key_data, |
Ryan Sleevi
2014/07/17 22:42:55
Documentation for all these.
eroman
2014/07/17 23:33:24
Done.
| |
23 const blink::WebCryptoAlgorithm& algorithm, | 24 const std::string& algorithm, |
24 bool extractable, | 25 bool extractable, |
25 blink::WebCryptoKeyUsageMask usage_mask, | 26 blink::WebCryptoKeyUsageMask usage_mask, |
26 blink::WebCryptoKey* key); | 27 std::vector<uint8>* jwk_key_data); |
27 | 28 |
28 Status ExportKeyJwk(const blink::WebCryptoKey& key, std::vector<uint8>* buffer); | 29 Status ReadSecretKeyJwk(const CryptoData& key_data, |
30 const std::string& expected_algorithm, | |
31 bool expected_extractable, | |
32 blink::WebCryptoKeyUsageMask expected_usage_mask, | |
33 std::vector<uint8>* raw_key_data); | |
34 | |
35 std::string MakeJwkAesAlgorithmName(const std::string& suffix, | |
36 unsigned int keylen_bytes); | |
37 | |
38 Status ReadAesSecretKeyJwk(const CryptoData& key_data, | |
39 const std::string& algorithm_name_suffix, | |
40 bool expected_extractable, | |
41 blink::WebCryptoKeyUsageMask expected_usage_mask, | |
42 std::vector<uint8>* raw_key_data); | |
43 | |
44 void WriteRsaPublicKeyJwk(const CryptoData& n, | |
45 const CryptoData& e, | |
46 const std::string& algorithm, | |
47 bool extractable, | |
48 blink::WebCryptoKeyUsageMask usage_mask, | |
49 std::vector<uint8>* jwk_key_data); | |
50 | |
51 void WriteRsaPrivateKeyJwk(const CryptoData& n, | |
52 const CryptoData& e, | |
53 const CryptoData& d, | |
54 const CryptoData& p, | |
55 const CryptoData& q, | |
56 const CryptoData& dp, | |
57 const CryptoData& dq, | |
58 const CryptoData& qi, | |
59 const std::string& algorithm, | |
60 bool extractable, | |
61 blink::WebCryptoKeyUsageMask usage_mask, | |
62 std::vector<uint8>* jwk_key_data); | |
63 | |
64 struct JwkRsaInfo { | |
Ryan Sleevi
2014/07/17 22:42:55
Document, including noting, for example, that we d
eroman
2014/07/17 23:33:23
Done.
| |
65 JwkRsaInfo(); | |
66 ~JwkRsaInfo(); | |
67 | |
68 bool is_private_key; | |
69 std::string n; | |
70 std::string e; | |
71 std::string d; | |
72 std::string p; | |
73 std::string q; | |
74 std::string dp; | |
75 std::string dq; | |
76 std::string qi; | |
77 }; | |
78 | |
79 Status ReadRsaKeyJwk(const CryptoData& key_data, | |
80 const std::string& expected_algorithm, | |
81 bool expected_extractable, | |
82 blink::WebCryptoKeyUsageMask expected_usage_mask, | |
83 JwkRsaInfo* result); | |
84 | |
85 const char* GetJwkHmacAlgorithmName(blink::WebCryptoAlgorithmId hash); | |
29 | 86 |
30 } // namespace webcrypto | 87 } // namespace webcrypto |
31 | 88 |
32 } // namespace content | 89 } // namespace content |
33 | 90 |
34 #endif // CONTENT_CHILD_WEBCRYPTO_JWK_H_ | 91 #endif // CONTENT_CHILD_WEBCRYPTO_JWK_H_ |
OLD | NEW |