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 #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 Loading... |
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 Loading... |
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 |
OLD | NEW |