summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibCrypto/Curves/EllipticCurve.h
blob: ceb756c410d56c139d6718366e2c2461861bb58d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
/*
 * Copyright (c) 2022, Michiel Visser <opensource@webmichiel.nl>
 *
 * SPDX-License-Identifier: BSD-2-Clause
 */

#pragma once

#include <AK/ByteBuffer.h>

namespace Crypto::Curves {

class EllipticCurve {
public:
    virtual size_t key_size() = 0;
    virtual ErrorOr<ByteBuffer> generate_private_key() = 0;
    virtual ErrorOr<ByteBuffer> generate_public_key(ReadonlyBytes a) = 0;
    virtual ErrorOr<ByteBuffer> compute_coordinate(ReadonlyBytes scalar_bytes, ReadonlyBytes point_bytes) = 0;
    virtual ErrorOr<ByteBuffer> derive_premaster_key(ReadonlyBytes shared_point) = 0;

    virtual ~EllipticCurve() = default;
};

}