/* * Copyright (c) 2020-2023, the SerenityOS developers. * * SPDX-License-Identifier: BSD-2-Clause */ #pragma once #include #include #include namespace Crypto::Certificate { struct AlgorithmIdentifier { AlgorithmIdentifier() { } explicit AlgorithmIdentifier(Vector const& identifier) : identifier(identifier) { } Vector identifier; Optional> ec_parameters {}; }; ErrorOr> parse_ec_parameters(ASN1::Decoder& decoder, Vector current_scope = {}); // https://datatracker.ietf.org/doc/html/rfc5280#section-4.1 class SubjectPublicKey { public: PK::RSAPublicKey rsa; PK::ECPublicKey ec; AlgorithmIdentifier algorithm; ByteBuffer raw_key; }; ErrorOr parse_subject_public_key_info(ASN1::Decoder& decoder, Vector current_scope = {}); // https://www.rfc-editor.org/rfc/rfc5208#section-5 class PrivateKey { public: PK::RSAPrivateKey rsa; PK::ECPrivateKey ec; AlgorithmIdentifier algorithm; ByteBuffer raw_key; // FIXME: attributes [0] IMPLICIT Attributes OPTIONAL }; ErrorOr parse_private_key_info(ASN1::Decoder& decoder, Vector current_scope = {}); }