File indexing completed on 2024-11-24 04:44:39
0001 /* 0002 * SPDX-FileCopyrightText: 2021 Volker Krause <vkrause@kde.org> 0003 * SPDX-License-Identifier: LGPL-2.0-or-later 0004 */ 0005 0006 #ifndef JWSVERIFIER_H 0007 #define JWSVERIFIER_H 0008 0009 #include "openssl/opensslpp_p.h" 0010 0011 #include <QJsonObject> 0012 0013 /** Verification of JSON Web Signatures (JWS). 0014 * @see RFC 7515 0015 * @see RFC 7797 (unencoded payload extension) 0016 * 0017 * @note This is far from a complete implementation of the full spec, this barely 0018 * covers enough for the needs of DIVOC JWS verification. 0019 */ 0020 class JwsVerifier 0021 { 0022 public: 0023 explicit JwsVerifier(const QJsonObject &doc); 0024 ~JwsVerifier(); 0025 0026 bool verify() const; 0027 0028 private: 0029 openssl::evp_pkey_ptr loadPublicKey() const; 0030 QByteArray canonicalRdf(const QJsonObject &doc) const; 0031 0032 QJsonObject m_obj; 0033 }; 0034 0035 #endif // JWSVERIFIER_H