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 "content/child/webcrypto/openssl/rsa_hashed_algorithm_openssl.h"
6 #include "content/child/webcrypto/openssl/rsa_sign_openssl.h"
7 #include "content/child/webcrypto/status.h"
15 class RsaSsaImplementation
: public RsaHashedAlgorithm
{
17 RsaSsaImplementation()
18 : RsaHashedAlgorithm(blink::WebCryptoKeyUsageVerify
,
19 blink::WebCryptoKeyUsageSign
) {}
21 const char* GetJwkAlgorithm(
22 const blink::WebCryptoAlgorithmId hash
) const override
{
24 case blink::WebCryptoAlgorithmIdSha1
:
26 case blink::WebCryptoAlgorithmIdSha256
:
28 case blink::WebCryptoAlgorithmIdSha384
:
30 case blink::WebCryptoAlgorithmIdSha512
:
37 Status
Sign(const blink::WebCryptoAlgorithm
& algorithm
,
38 const blink::WebCryptoKey
& key
,
39 const CryptoData
& data
,
40 std::vector
<uint8_t>* buffer
) const override
{
41 return RsaSign(key
, 0, data
, 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
, 0, signature
, data
, signature_match
);
55 AlgorithmImplementation
* CreatePlatformRsaSsaImplementation() {
56 return new RsaSsaImplementation
;
59 } // namespace webcrypto
61 } // namespace content