rsa_sign.h 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  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.
  4. #ifndef COMPONENTS_WEBCRYPTO_ALGORITHMS_RSA_SIGN_H_
  5. #define COMPONENTS_WEBCRYPTO_ALGORITHMS_RSA_SIGN_H_
  6. #include <stdint.h>
  7. #include <vector>
  8. #include "base/containers/span.h"
  9. namespace blink {
  10. class WebCryptoKey;
  11. }
  12. namespace webcrypto {
  13. class Status;
  14. // Helper functions for doing RSA-SSA signing and verification
  15. // (both PKCS1-v1_5 and PSS flavor).
  16. //
  17. // The salt length parameter is only relevant when the key is for RSA-PSS. In
  18. // other cases it should be set to zero.
  19. Status RsaSign(const blink::WebCryptoKey& key,
  20. unsigned int pss_salt_length_bytes,
  21. base::span<const uint8_t> data,
  22. std::vector<uint8_t>* buffer);
  23. Status RsaVerify(const blink::WebCryptoKey& key,
  24. unsigned int pss_salt_length_bytes,
  25. base::span<const uint8_t> signature,
  26. base::span<const uint8_t> data,
  27. bool* signature_match);
  28. } // namespace webcrypto
  29. #endif // COMPONENTS_WEBCRYPTO_ALGORITHMS_RSA_SIGN_H_