Re-subimission of https://codereview.chromium.org/1041213003/
[chromium-blink-merge.git] / content / child / webcrypto / openssl / rsa_sign_openssl.h
blobc750ee2e57c004eb9e6fec71255d01657f0ab35a
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 #ifndef CONTENT_CHILD_WEBCRYPTO_OPENSSL_RSA_SIGN_OPENSSL_H_
6 #define CONTENT_CHILD_WEBCRYPTO_OPENSSL_RSA_SIGN_OPENSSL_H_
8 #include <stdint.h>
10 #include <vector>
12 namespace blink {
13 class WebCryptoKey;
16 namespace content {
18 namespace webcrypto {
20 class CryptoData;
21 class Status;
23 // Helper functions for doing RSA-SSA signing and verification
24 // (both PKCS1-v1_5 and PSS flavor).
26 // The salt length parameter is only relevant when the key is for RSA-PSS. In
27 // other cases it should be set to zero.
29 Status RsaSign(const blink::WebCryptoKey& key,
30 unsigned int pss_salt_length_bytes,
31 const CryptoData& data,
32 std::vector<uint8_t>* buffer);
34 Status RsaVerify(const blink::WebCryptoKey& key,
35 unsigned int pss_salt_length_bytes,
36 const CryptoData& signature,
37 const CryptoData& data,
38 bool* signature_match);
40 } // namespace webcrypto
42 } // namespace content
44 #endif // CONTENT_CHILD_WEBCRYPTO_OPENSSL_RSA_SIGN_OPENSSL_H_