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

Side by Side Diff: components/webcrypto/algorithms/rsa.h

Issue 2163053002: [webcrypto] Check for empty key usages *after* key creation rather than before, to match the spec's… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 4 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
« no previous file with comments | « components/webcrypto/algorithms/pbkdf2.cc ('k') | components/webcrypto/algorithms/rsa.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 COMPONENTS_WEBCRYPTO_ALGORITHMS_RSA_H_ 5 #ifndef COMPONENTS_WEBCRYPTO_ALGORITHMS_RSA_H_
6 #define COMPONENTS_WEBCRYPTO_ALGORITHMS_RSA_H_ 6 #define COMPONENTS_WEBCRYPTO_ALGORITHMS_RSA_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include "components/webcrypto/algorithm_implementation.h" 10 #include "components/webcrypto/algorithm_implementation.h"
(...skipping 22 matching lines...) Expand all
33 33
34 // For instance "RSA-OAEP-256". 34 // For instance "RSA-OAEP-256".
35 virtual const char* GetJwkAlgorithm( 35 virtual const char* GetJwkAlgorithm(
36 const blink::WebCryptoAlgorithmId hash) const = 0; 36 const blink::WebCryptoAlgorithmId hash) const = 0;
37 37
38 Status GenerateKey(const blink::WebCryptoAlgorithm& algorithm, 38 Status GenerateKey(const blink::WebCryptoAlgorithm& algorithm,
39 bool extractable, 39 bool extractable,
40 blink::WebCryptoKeyUsageMask usages, 40 blink::WebCryptoKeyUsageMask usages,
41 GenerateKeyResult* result) const override; 41 GenerateKeyResult* result) const override;
42 42
43 Status VerifyKeyUsagesBeforeImportKey( 43 Status ImportKey(blink::WebCryptoKeyFormat format,
44 blink::WebCryptoKeyFormat format, 44 const CryptoData& key_data,
45 blink::WebCryptoKeyUsageMask usages) const override; 45 const blink::WebCryptoAlgorithm& algorithm,
46 bool extractable,
47 blink::WebCryptoKeyUsageMask usages,
48 blink::WebCryptoKey* key) const override;
46 49
47 Status ImportKeyPkcs8(const CryptoData& key_data, 50 Status ExportKey(blink::WebCryptoKeyFormat format,
48 const blink::WebCryptoAlgorithm& algorithm, 51 const blink::WebCryptoKey& key,
49 bool extractable, 52 std::vector<uint8_t>* buffer) const override;
50 blink::WebCryptoKeyUsageMask usages,
51 blink::WebCryptoKey* key) const override;
52
53 Status ImportKeySpki(const CryptoData& key_data,
54 const blink::WebCryptoAlgorithm& algorithm,
55 bool extractable,
56 blink::WebCryptoKeyUsageMask usages,
57 blink::WebCryptoKey* key) const override;
58
59 Status ImportKeyJwk(const CryptoData& key_data,
60 const blink::WebCryptoAlgorithm& algorithm,
61 bool extractable,
62 blink::WebCryptoKeyUsageMask usages,
63 blink::WebCryptoKey* key) const override;
64
65 Status ExportKeyPkcs8(const blink::WebCryptoKey& key,
66 std::vector<uint8_t>* buffer) const override;
67
68 Status ExportKeySpki(const blink::WebCryptoKey& key,
69 std::vector<uint8_t>* buffer) const override;
70
71 Status ExportKeyJwk(const blink::WebCryptoKey& key,
72 std::vector<uint8_t>* buffer) const override;
73 53
74 Status DeserializeKeyForClone(const blink::WebCryptoKeyAlgorithm& algorithm, 54 Status DeserializeKeyForClone(const blink::WebCryptoKeyAlgorithm& algorithm,
75 blink::WebCryptoKeyType type, 55 blink::WebCryptoKeyType type,
76 bool extractable, 56 bool extractable,
77 blink::WebCryptoKeyUsageMask usages, 57 blink::WebCryptoKeyUsageMask usages,
78 const CryptoData& key_data, 58 const CryptoData& key_data,
79 blink::WebCryptoKey* key) const override; 59 blink::WebCryptoKey* key) const override;
80 60
81 private: 61 private:
62 Status ImportKeyPkcs8(const CryptoData& key_data,
63 const blink::WebCryptoAlgorithm& algorithm,
64 bool extractable,
65 blink::WebCryptoKeyUsageMask usages,
66 blink::WebCryptoKey* key) const;
67
68 Status ImportKeySpki(const CryptoData& key_data,
69 const blink::WebCryptoAlgorithm& algorithm,
70 bool extractable,
71 blink::WebCryptoKeyUsageMask usages,
72 blink::WebCryptoKey* key) const;
73
74 Status ImportKeyJwk(const CryptoData& key_data,
75 const blink::WebCryptoAlgorithm& algorithm,
76 bool extractable,
77 blink::WebCryptoKeyUsageMask usages,
78 blink::WebCryptoKey* key) const;
79
80 Status ExportKeyPkcs8(const blink::WebCryptoKey& key,
81 std::vector<uint8_t>* buffer) const;
82
83 Status ExportKeySpki(const blink::WebCryptoKey& key,
84 std::vector<uint8_t>* buffer) const;
85
86 Status ExportKeyJwk(const blink::WebCryptoKey& key,
87 std::vector<uint8_t>* buffer) const;
88
82 const blink::WebCryptoKeyUsageMask all_public_key_usages_; 89 const blink::WebCryptoKeyUsageMask all_public_key_usages_;
83 const blink::WebCryptoKeyUsageMask all_private_key_usages_; 90 const blink::WebCryptoKeyUsageMask all_private_key_usages_;
84 }; 91 };
85 92
86 } // namespace webcrypto 93 } // namespace webcrypto
87 94
88 #endif // COMPONENTS_WEBCRYPTO_ALGORITHMS_RSA_H_ 95 #endif // COMPONENTS_WEBCRYPTO_ALGORITHMS_RSA_H_
OLDNEW
« no previous file with comments | « components/webcrypto/algorithms/pbkdf2.cc ('k') | components/webcrypto/algorithms/rsa.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698