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

Side by Side Diff: content/child/webcrypto/algorithm_implementation.h

Issue 670773003: Cleanup: rename usage_mask --> usages. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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
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 CONTENT_CHILD_WEBCRYPTO_ALGORITHM_IMPLEMENTATION_H_ 5 #ifndef CONTENT_CHILD_WEBCRYPTO_ALGORITHM_IMPLEMENTATION_H_
6 #define CONTENT_CHILD_WEBCRYPTO_ALGORITHM_IMPLEMENTATION_H_ 6 #define CONTENT_CHILD_WEBCRYPTO_ALGORITHM_IMPLEMENTATION_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 const CryptoData& data, 67 const CryptoData& data,
68 bool* signature_match) const; 68 bool* signature_match) const;
69 69
70 // This method corresponds to Web Crypto's crypto.subtle.digest(). 70 // This method corresponds to Web Crypto's crypto.subtle.digest().
71 virtual Status Digest(const blink::WebCryptoAlgorithm& algorithm, 71 virtual Status Digest(const blink::WebCryptoAlgorithm& algorithm,
72 const CryptoData& data, 72 const CryptoData& data,
73 std::vector<uint8_t>* buffer) const; 73 std::vector<uint8_t>* buffer) const;
74 74
75 // This method corresponds to Web Crypto's crypto.subtle.generateKey(). 75 // This method corresponds to Web Crypto's crypto.subtle.generateKey().
76 // 76 //
77 // Implementations MUST verify |usage_mask| and return an error if it is not 77 // Implementations MUST verify |usages| and return an error if it is not
78 // appropriate. 78 // appropriate.
79 virtual Status GenerateKey(const blink::WebCryptoAlgorithm& algorithm, 79 virtual Status GenerateKey(const blink::WebCryptoAlgorithm& algorithm,
80 bool extractable, 80 bool extractable,
81 blink::WebCryptoKeyUsageMask usage_mask, 81 blink::WebCryptoKeyUsageMask usages,
82 GenerateKeyResult* result) const; 82 GenerateKeyResult* result) const;
83 83
84 // ----------------------------------------------- 84 // -----------------------------------------------
85 // Key import 85 // Key import
86 // ----------------------------------------------- 86 // -----------------------------------------------
87 87
88 // VerifyKeyUsagesBeforeImportKey() must be called before either 88 // VerifyKeyUsagesBeforeImportKey() must be called before either
89 // importing a key, or unwrapping a key. 89 // importing a key, or unwrapping a key.
90 // 90 //
91 // Implementations should return an error if the requested usages are invalid 91 // Implementations should return an error if the requested usages are invalid
92 // when importing for the specified format. 92 // when importing for the specified format.
93 // 93 //
94 // For instance, importing an RSA-SSA key with 'spki' format and Sign usage 94 // For instance, importing an RSA-SSA key with 'spki' format and Sign usage
95 // is invalid. The 'spki' format implies it will be a public key, and public 95 // is invalid. The 'spki' format implies it will be a public key, and public
96 // keys do not support signing. 96 // keys do not support signing.
97 // 97 //
98 // When called with format=JWK the key type may be unknown. The 98 // When called with format=JWK the key type may be unknown. The
99 // ImportKeyJwk() must do the final usage check. 99 // ImportKeyJwk() must do the final usage check.
100 virtual Status VerifyKeyUsagesBeforeImportKey( 100 virtual Status VerifyKeyUsagesBeforeImportKey(
101 blink::WebCryptoKeyFormat format, 101 blink::WebCryptoKeyFormat format,
102 blink::WebCryptoKeyUsageMask usage_mask) const; 102 blink::WebCryptoKeyUsageMask usages) const;
103 103
104 // This method corresponds to Web Crypto's 104 // This method corresponds to Web Crypto's
105 // crypto.subtle.importKey(format='raw'). 105 // crypto.subtle.importKey(format='raw').
106 virtual Status ImportKeyRaw(const CryptoData& key_data, 106 virtual Status ImportKeyRaw(const CryptoData& key_data,
107 const blink::WebCryptoAlgorithm& algorithm, 107 const blink::WebCryptoAlgorithm& algorithm,
108 bool extractable, 108 bool extractable,
109 blink::WebCryptoKeyUsageMask usage_mask, 109 blink::WebCryptoKeyUsageMask usages,
110 blink::WebCryptoKey* key) const; 110 blink::WebCryptoKey* key) const;
111 111
112 // This method corresponds to Web Crypto's 112 // This method corresponds to Web Crypto's
113 // crypto.subtle.importKey(format='pkcs8'). 113 // crypto.subtle.importKey(format='pkcs8').
114 virtual Status ImportKeyPkcs8(const CryptoData& key_data, 114 virtual Status ImportKeyPkcs8(const CryptoData& key_data,
115 const blink::WebCryptoAlgorithm& algorithm, 115 const blink::WebCryptoAlgorithm& algorithm,
116 bool extractable, 116 bool extractable,
117 blink::WebCryptoKeyUsageMask usage_mask, 117 blink::WebCryptoKeyUsageMask usages,
118 blink::WebCryptoKey* key) const; 118 blink::WebCryptoKey* key) const;
119 119
120 // This method corresponds to Web Crypto's 120 // This method corresponds to Web Crypto's
121 // crypto.subtle.importKey(format='spki'). 121 // crypto.subtle.importKey(format='spki').
122 virtual Status ImportKeySpki(const CryptoData& key_data, 122 virtual Status ImportKeySpki(const CryptoData& key_data,
123 const blink::WebCryptoAlgorithm& algorithm, 123 const blink::WebCryptoAlgorithm& algorithm,
124 bool extractable, 124 bool extractable,
125 blink::WebCryptoKeyUsageMask usage_mask, 125 blink::WebCryptoKeyUsageMask usages,
126 blink::WebCryptoKey* key) const; 126 blink::WebCryptoKey* key) const;
127 127
128 // This method corresponds to Web Crypto's 128 // This method corresponds to Web Crypto's
129 // crypto.subtle.importKey(format='jwk'). 129 // crypto.subtle.importKey(format='jwk').
130 virtual Status ImportKeyJwk(const CryptoData& key_data, 130 virtual Status ImportKeyJwk(const CryptoData& key_data,
131 const blink::WebCryptoAlgorithm& algorithm, 131 const blink::WebCryptoAlgorithm& algorithm,
132 bool extractable, 132 bool extractable,
133 blink::WebCryptoKeyUsageMask usage_mask, 133 blink::WebCryptoKeyUsageMask usages,
134 blink::WebCryptoKey* key) const; 134 blink::WebCryptoKey* key) const;
135 135
136 // ----------------------------------------------- 136 // -----------------------------------------------
137 // Key export 137 // Key export
138 // ----------------------------------------------- 138 // -----------------------------------------------
139 139
140 virtual Status ExportKeyRaw(const blink::WebCryptoKey& key, 140 virtual Status ExportKeyRaw(const blink::WebCryptoKey& key,
141 std::vector<uint8_t>* buffer) const; 141 std::vector<uint8_t>* buffer) const;
142 142
143 virtual Status ExportKeyPkcs8(const blink::WebCryptoKey& key, 143 virtual Status ExportKeyPkcs8(const blink::WebCryptoKey& key,
144 std::vector<uint8_t>* buffer) const; 144 std::vector<uint8_t>* buffer) const;
145 145
146 virtual Status ExportKeySpki(const blink::WebCryptoKey& key, 146 virtual Status ExportKeySpki(const blink::WebCryptoKey& key,
147 std::vector<uint8_t>* buffer) const; 147 std::vector<uint8_t>* buffer) const;
148 148
149 virtual Status ExportKeyJwk(const blink::WebCryptoKey& key, 149 virtual Status ExportKeyJwk(const blink::WebCryptoKey& key,
150 std::vector<uint8_t>* buffer) const; 150 std::vector<uint8_t>* buffer) const;
151 }; 151 };
152 152
153 } // namespace webcrypto 153 } // namespace webcrypto
154 154
155 } // namespace content 155 } // namespace content
156 156
157 #endif // CONTENT_CHILD_WEBCRYPTO_ALGORITHM_IMPLEMENTATION_H_ 157 #endif // CONTENT_CHILD_WEBCRYPTO_ALGORITHM_IMPLEMENTATION_H_
OLDNEW
« no previous file with comments | « content/child/webcrypto/algorithm_dispatch.cc ('k') | content/child/webcrypto/algorithm_implementation.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698