ExtensionInstallDialogView: fix scrolling behavior on Views (Win,Linux)
[chromium-blink-merge.git] / components / webcrypto / openssl / rsa_pss_openssl.cc
blob68c288f63665e43ab7928a511bcf39d7ade538cd
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
3 // found in the LICENSE file.
5 #include "components/webcrypto/openssl/rsa_hashed_algorithm_openssl.h"
6 #include "components/webcrypto/openssl/rsa_sign_openssl.h"
7 #include "components/webcrypto/status.h"
8 #include "third_party/WebKit/public/platform/WebCryptoAlgorithmParams.h"
10 namespace webcrypto {
12 namespace {
14 class RsaPssImplementation : public RsaHashedAlgorithm {
15 public:
16 RsaPssImplementation()
17 : RsaHashedAlgorithm(blink::WebCryptoKeyUsageVerify,
18 blink::WebCryptoKeyUsageSign) {}
20 const char* GetJwkAlgorithm(
21 const blink::WebCryptoAlgorithmId hash) const override {
22 switch (hash) {
23 case blink::WebCryptoAlgorithmIdSha1:
24 return "PS1";
25 case blink::WebCryptoAlgorithmIdSha256:
26 return "PS256";
27 case blink::WebCryptoAlgorithmIdSha384:
28 return "PS384";
29 case blink::WebCryptoAlgorithmIdSha512:
30 return "PS512";
31 default:
32 return NULL;
36 Status Sign(const blink::WebCryptoAlgorithm& algorithm,
37 const blink::WebCryptoKey& key,
38 const CryptoData& data,
39 std::vector<uint8_t>* buffer) const override {
40 return RsaSign(key, algorithm.rsaPssParams()->saltLengthBytes(), data,
41 buffer);
44 Status Verify(const blink::WebCryptoAlgorithm& algorithm,
45 const blink::WebCryptoKey& key,
46 const CryptoData& signature,
47 const CryptoData& data,
48 bool* signature_match) const override {
49 return RsaVerify(key, algorithm.rsaPssParams()->saltLengthBytes(),
50 signature, data, signature_match);
54 } // namespace
56 AlgorithmImplementation* CreatePlatformRsaPssImplementation() {
57 return new RsaPssImplementation;
60 } // namespace webcrypto