mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-09 09:34:57 +09:00

Implement the Ed448 curve for signing and verifying using OpenSSL. The methods could be all made static, but all other curves are not. I think this is material for further refactoring.
24 lines
690 B
C++
24 lines
690 B
C++
/*
|
|
* Copyright (c) 2024, Altomani Gianluca <altomanigianluca@gmail.com>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <AK/ByteBuffer.h>
|
|
|
|
namespace Crypto::Curves {
|
|
|
|
class Ed448 {
|
|
public:
|
|
constexpr size_t key_size() const { return 57; }
|
|
constexpr size_t signature_size() const { return 114; }
|
|
ErrorOr<ByteBuffer> generate_private_key();
|
|
ErrorOr<ByteBuffer> generate_public_key(ReadonlyBytes private_key);
|
|
|
|
ErrorOr<ByteBuffer> sign(ReadonlyBytes private_key, ReadonlyBytes message, ReadonlyBytes context = {});
|
|
ErrorOr<bool> verify(ReadonlyBytes public_key, ReadonlyBytes signature, ReadonlyBytes message, ReadonlyBytes context = {});
|
|
};
|
|
|
|
}
|