1#ifndef SOURCEMETA_CORE_CRYPTO_VERIFY_H_
2#define SOURCEMETA_CORE_CRYPTO_VERIFY_H_
4#ifndef SOURCEMETA_CORE_CRYPTO_EXPORT
5#include <sourcemeta/core/crypto_export.h>
13namespace sourcemeta::core {
65 enum class Type : std::uint8_t {
82 [[nodiscard]]
auto type() const noexcept ->
Type;
90 [[nodiscard]] auto
internal() const noexcept -> const Internal * {
91 return this->internal_;
102 const std::string_view modulus,
const std::string_view exponent)
103 -> std::optional<PublicKey>;
109 const EllipticCurve curve,
const std::string_view coordinate_x,
110 const std::string_view coordinate_y) -> std::optional<PublicKey>;
116 const EdwardsCurve curve,
const std::string_view public_key)
117 -> std::optional<PublicKey>;
165 -> std::optional<RSAPublicComponents>;
182 -> std::optional<ECPublicComponents>;
200 const PublicKey &key) -> std::optional<EdwardsPublicComponents>;
219 const std::string_view message,
const std::string_view signature) -> bool;
239 const std::string_view message,
const std::string_view signature) -> bool;
261 const std::string_view message,
const std::string_view signature) -> bool;
279auto SOURCEMETA_CORE_CRYPTO_EXPORT
281 const std::string_view signature) -> bool;
EdwardsCurve curve
The curve the point belongs to.
Definition crypto_verify.h:146
std::string exponent
The RSA public exponent.
Definition crypto_verify.h:126
auto type() const noexcept -> Type
The kind of key this is.
std::string y
The y coordinate.
Definition crypto_verify.h:138
Type
The kind of key, which fixes the signature schemes it can verify.
Definition crypto_verify.h:65
std::string x
The x coordinate.
Definition crypto_verify.h:136
std::string modulus
The RSA modulus.
Definition crypto_verify.h:124
auto internal() const noexcept -> const Internal *
Definition crypto_verify.h:90
std::string point
The encoded public point.
Definition crypto_verify.h:148
EllipticCurve curve
The curve the coordinates belong to.
Definition crypto_verify.h:134
PublicKey(PublicKey &&other) noexcept
Move constructor.
auto SOURCEMETA_CORE_CRYPTO_EXPORT edwards_public_components(const PublicKey &key) -> std::optional< EdwardsPublicComponents >
auto SOURCEMETA_CORE_CRYPTO_EXPORT rsa_public_components(const PublicKey &key) -> std::optional< RSAPublicComponents >
auto SOURCEMETA_CORE_CRYPTO_EXPORT rsassa_pss_verify(const PublicKey &key, const SignatureHashFunction hash, const std::string_view message, const std::string_view signature) -> bool
auto SOURCEMETA_CORE_CRYPTO_EXPORT rsassa_pkcs1_v15_verify(const PublicKey &key, const SignatureHashFunction hash, const std::string_view message, const std::string_view signature) -> bool
auto SOURCEMETA_CORE_CRYPTO_EXPORT ec_public_components(const PublicKey &key) -> std::optional< ECPublicComponents >
auto SOURCEMETA_CORE_CRYPTO_EXPORT make_ec_public_key(const EllipticCurve curve, const std::string_view coordinate_x, const std::string_view coordinate_y) -> std::optional< PublicKey >
EllipticCurve
Definition crypto_verify.h:28
auto SOURCEMETA_CORE_CRYPTO_EXPORT make_eddsa_public_key(const EdwardsCurve curve, const std::string_view public_key) -> std::optional< PublicKey >
SignatureHashFunction
Definition crypto_verify.h:17
EdwardsCurve
Definition crypto_verify.h:39
auto SOURCEMETA_CORE_CRYPTO_EXPORT ecdsa_verify(const PublicKey &key, const SignatureHashFunction hash, const std::string_view message, const std::string_view signature) -> bool
auto SOURCEMETA_CORE_CRYPTO_EXPORT make_rsa_public_key(const std::string_view modulus, const std::string_view exponent) -> std::optional< PublicKey >
auto SOURCEMETA_CORE_CRYPTO_EXPORT eddsa_verify(const PublicKey &key, const std::string_view message, const std::string_view signature) -> bool
@ SHA256
The SHA-256 hash function, selecting RSA-OAEP-256.
Definition crypto_rsa_oaep.h:25
@ P384
The NIST P-384 elliptic curve.
Definition crypto_verify.h:32
@ P256
The NIST P-256 elliptic curve.
Definition crypto_verify.h:30
@ P521
The NIST P-521 elliptic curve.
Definition crypto_verify.h:34
@ SHA512
The SHA-512 hash function.
Definition crypto_verify.h:23
@ SHA384
The SHA-384 hash function.
Definition crypto_verify.h:21
@ Ed25519
The Ed25519 Edwards curve.
Definition crypto_verify.h:41
@ Ed448
The Ed448 Edwards curve.
Definition crypto_verify.h:43