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 #ifndef CONTENT_CHILD_WEBCRYPTO_OPENSSL_RSA_SIGN_OPENSSL_H_ | 5 #ifndef CONTENT_CHILD_WEBCRYPTO_OPENSSL_RSA_SIGN_OPENSSL_H_ |
6 #define CONTENT_CHILD_WEBCRYPTO_OPENSSL_RSA_SIGN_OPENSSL_H_ | 6 #define CONTENT_CHILD_WEBCRYPTO_OPENSSL_RSA_SIGN_OPENSSL_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 namespace blink { | 12 namespace blink { |
13 class WebCryptoKey; | 13 class WebCryptoKey; |
14 } | 14 } |
15 | 15 |
16 namespace content { | 16 namespace content { |
17 | 17 |
18 namespace webcrypto { | 18 namespace webcrypto { |
19 | 19 |
20 class CryptoData; | 20 class CryptoData; |
21 class Status; | 21 class Status; |
22 | 22 |
23 // Helper functions for doing RSA-SSA signing and verification. | 23 // Helper functions for doing RSA-SSA signing and verification |
| 24 // (both PKCS1-v1_5 and PSS flavor). |
| 25 // |
| 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. |
24 | 28 |
25 Status RsaSign(const blink::WebCryptoKey& key, | 29 Status RsaSign(const blink::WebCryptoKey& key, |
| 30 unsigned int pss_salt_length_bytes, |
26 const CryptoData& data, | 31 const CryptoData& data, |
27 std::vector<uint8_t>* buffer); | 32 std::vector<uint8_t>* buffer); |
28 | 33 |
29 Status RsaVerify(const blink::WebCryptoKey& key, | 34 Status RsaVerify(const blink::WebCryptoKey& key, |
| 35 unsigned int pss_salt_length_bytes, |
30 const CryptoData& signature, | 36 const CryptoData& signature, |
31 const CryptoData& data, | 37 const CryptoData& data, |
32 bool* signature_match); | 38 bool* signature_match); |
33 | 39 |
34 } // namespace webcrypto | 40 } // namespace webcrypto |
35 | 41 |
36 } // namespace content | 42 } // namespace content |
37 | 43 |
38 #endif // CONTENT_CHILD_WEBCRYPTO_OPENSSL_RSA_SIGN_OPENSSL_H_ | 44 #endif // CONTENT_CHILD_WEBCRYPTO_OPENSSL_RSA_SIGN_OPENSSL_H_ |
OLD | NEW |