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

Side by Side Diff: content/child/webcrypto/nss/rsa_oaep_nss.cc

Issue 512023002: Refactor the interface for generating keys. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Run git-cl format 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
« no previous file with comments | « content/child/webcrypto/nss/rsa_key_nss.cc ('k') | content/child/webcrypto/nss/sym_key_nss.h » ('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 #include <cryptohi.h> 5 #include <cryptohi.h>
6 #include <keyhi.h> 6 #include <keyhi.h>
7 #include <pk11pub.h> 7 #include <pk11pub.h>
8 #include <secerr.h> 8 #include <secerr.h>
9 #include <sechash.h> 9 #include <sechash.h>
10 10
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 161
162 class RsaOaepImplementation : public RsaHashedAlgorithm { 162 class RsaOaepImplementation : public RsaHashedAlgorithm {
163 public: 163 public:
164 RsaOaepImplementation() 164 RsaOaepImplementation()
165 : RsaHashedAlgorithm( 165 : RsaHashedAlgorithm(
166 CKF_ENCRYPT | CKF_DECRYPT | CKF_WRAP | CKF_UNWRAP, 166 CKF_ENCRYPT | CKF_DECRYPT | CKF_WRAP | CKF_UNWRAP,
167 blink::WebCryptoKeyUsageEncrypt | blink::WebCryptoKeyUsageWrapKey, 167 blink::WebCryptoKeyUsageEncrypt | blink::WebCryptoKeyUsageWrapKey,
168 blink::WebCryptoKeyUsageDecrypt | 168 blink::WebCryptoKeyUsageDecrypt |
169 blink::WebCryptoKeyUsageUnwrapKey) {} 169 blink::WebCryptoKeyUsageUnwrapKey) {}
170 170
171 virtual Status VerifyKeyUsagesBeforeGenerateKeyPair( 171 virtual Status GenerateKey(const blink::WebCryptoAlgorithm& algorithm,
172 blink::WebCryptoKeyUsageMask combined_usage_mask, 172 bool extractable,
173 blink::WebCryptoKeyUsageMask* public_usage_mask, 173 blink::WebCryptoKeyUsageMask usage_mask,
174 blink::WebCryptoKeyUsageMask* private_usage_mask) const override { 174 GenerateKeyResult* result) const override {
175 Status status = NssSupportsRsaOaep(); 175 Status status = NssSupportsRsaOaep();
176 if (status.IsError()) 176 if (status.IsError())
177 return status; 177 return status;
178 return RsaHashedAlgorithm::VerifyKeyUsagesBeforeGenerateKeyPair( 178 return RsaHashedAlgorithm::GenerateKey(
179 combined_usage_mask, public_usage_mask, private_usage_mask); 179 algorithm, extractable, usage_mask, result);
180 } 180 }
181 181
182 virtual Status VerifyKeyUsagesBeforeImportKey( 182 virtual Status VerifyKeyUsagesBeforeImportKey(
183 blink::WebCryptoKeyFormat format, 183 blink::WebCryptoKeyFormat format,
184 blink::WebCryptoKeyUsageMask usage_mask) const override { 184 blink::WebCryptoKeyUsageMask usage_mask) const override {
185 Status status = NssSupportsRsaOaep(); 185 Status status = NssSupportsRsaOaep();
186 if (status.IsError()) 186 if (status.IsError())
187 return status; 187 return status;
188 return RsaHashedAlgorithm::VerifyKeyUsagesBeforeImportKey(format, 188 return RsaHashedAlgorithm::VerifyKeyUsagesBeforeImportKey(format,
189 usage_mask); 189 usage_mask);
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 238
239 } // namespace 239 } // namespace
240 240
241 AlgorithmImplementation* CreatePlatformRsaOaepImplementation() { 241 AlgorithmImplementation* CreatePlatformRsaOaepImplementation() {
242 return new RsaOaepImplementation; 242 return new RsaOaepImplementation;
243 } 243 }
244 244
245 } // namespace webcrypto 245 } // namespace webcrypto
246 246
247 } // namespace content 247 } // namespace content
OLDNEW
« no previous file with comments | « content/child/webcrypto/nss/rsa_key_nss.cc ('k') | content/child/webcrypto/nss/sym_key_nss.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698