| 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 blink::WebCryptoKey* public_key, |
| 175 blink::WebCryptoKey* private_key) const OVERRIDE { |
| 175 Status status = NssSupportsRsaOaep(); | 176 Status status = NssSupportsRsaOaep(); |
| 176 if (status.IsError()) | 177 if (status.IsError()) |
| 177 return status; | 178 return status; |
| 178 return RsaHashedAlgorithm::VerifyKeyUsagesBeforeGenerateKeyPair( | 179 return RsaHashedAlgorithm::GenerateKey( |
| 179 combined_usage_mask, public_usage_mask, private_usage_mask); | 180 algorithm, extractable, usage_mask, public_key, private_key); |
| 180 } | 181 } |
| 181 | 182 |
| 182 virtual Status VerifyKeyUsagesBeforeImportKey( | 183 virtual Status VerifyKeyUsagesBeforeImportKey( |
| 183 blink::WebCryptoKeyFormat format, | 184 blink::WebCryptoKeyFormat format, |
| 184 blink::WebCryptoKeyUsageMask usage_mask) const OVERRIDE { | 185 blink::WebCryptoKeyUsageMask usage_mask) const OVERRIDE { |
| 185 Status status = NssSupportsRsaOaep(); | 186 Status status = NssSupportsRsaOaep(); |
| 186 if (status.IsError()) | 187 if (status.IsError()) |
| 187 return status; | 188 return status; |
| 188 return RsaHashedAlgorithm::VerifyKeyUsagesBeforeImportKey(format, | 189 return RsaHashedAlgorithm::VerifyKeyUsagesBeforeImportKey(format, |
| 189 usage_mask); | 190 usage_mask); |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 238 | 239 |
| 239 } // namespace | 240 } // namespace |
| 240 | 241 |
| 241 AlgorithmImplementation* CreatePlatformRsaOaepImplementation() { | 242 AlgorithmImplementation* CreatePlatformRsaOaepImplementation() { |
| 242 return new RsaOaepImplementation; | 243 return new RsaOaepImplementation; |
| 243 } | 244 } |
| 244 | 245 |
| 245 } // namespace webcrypto | 246 } // namespace webcrypto |
| 246 | 247 |
| 247 } // namespace content | 248 } // namespace content |
| OLD | NEW |