mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-01-07 19:57:45 +03:00
5e1499d104
This commit un-deprecates DeprecatedString, and repurposes it as a byte string. As the null state has already been removed, there are no other particularly hairy blockers in repurposing this type as a byte string (what it _really_ is). This commit is auto-generated: $ xs=$(ack -l \bDeprecatedString\b\|deprecated_string AK Userland \ Meta Ports Ladybird Tests Kernel) $ perl -pie 's/\bDeprecatedString\b/ByteString/g; s/deprecated_string/byte_string/g' $xs $ clang-format --style=file -i \ $(git diff --name-only | grep \.cpp\|\.h) $ gn format $(git ls-files '*.gn' '*.gni')
52 lines
1.0 KiB
C++
52 lines
1.0 KiB
C++
/*
|
|
* Copyright (c) 2020, Ali Mohammad Pur <mpfard@serenityos.org>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <AK/ByteBuffer.h>
|
|
|
|
#ifndef KERNEL
|
|
# include <AK/ByteString.h>
|
|
#endif
|
|
|
|
namespace Crypto::PK {
|
|
|
|
// FIXME: Fixing name up for grabs
|
|
template<typename PrivKeyT, typename PubKeyT>
|
|
class PKSystem {
|
|
public:
|
|
using PublicKeyType = PubKeyT;
|
|
using PrivateKeyType = PrivKeyT;
|
|
|
|
PKSystem(PublicKeyType& pubkey, PrivateKeyType& privkey)
|
|
: m_public_key(pubkey)
|
|
, m_private_key(privkey)
|
|
{
|
|
}
|
|
|
|
PKSystem() = default;
|
|
|
|
virtual void encrypt(ReadonlyBytes in, Bytes& out) = 0;
|
|
virtual void decrypt(ReadonlyBytes in, Bytes& out) = 0;
|
|
|
|
virtual void sign(ReadonlyBytes in, Bytes& out) = 0;
|
|
virtual void verify(ReadonlyBytes in, Bytes& out) = 0;
|
|
|
|
#ifndef KERNEL
|
|
virtual ByteString class_name() const = 0;
|
|
#endif
|
|
|
|
virtual size_t output_size() const = 0;
|
|
|
|
protected:
|
|
virtual ~PKSystem() = default;
|
|
|
|
PublicKeyType m_public_key;
|
|
PrivateKeyType m_private_key;
|
|
};
|
|
|
|
}
|