Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/GAP/pkg/polenta/doc/   (Algebra von RWTH Aachen Version 4.15.1©)  Datei vom 10.3.2025 mit Größe 10 kB image not shown  

Impressum gen_cert_header.py   Sprache: Python

 
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.

import textwrap

from pyasn1_modules import pem


def read_certificate(filename):
    with open(filename, "r"as f:
        try:
            return pem.readPemFromFile(
                f, "-----BEGIN CERTIFICATE-----""-----END CERTIFICATE-----"
            )
        except UnicodeDecodeError:
            raise Exception(
                f"Could not decode {filename} (it should be a PEM-encoded certificate)"
            )


def write_header(output, array_name, certificates):
    certificate_names = []
    for index, certificate in enumerate(certificates):
        certificate_name = f"{array_name}{index}"
        certificate_names.append(
            f"mozilla::Span({certificate_name}, sizeof({certificate_name}))"
        )
        output.write(f"const uint8_t {certificate_name}[] = {{\n")
        certificate_bytes = read_certificate(certificate)
        hexified = ", ".join(["0x%02x" % byte for byte in certificate_bytes])
        wrapped = textwrap.wrap(hexified)
        for line in wrapped:
            output.write(f" {line}\n")
        output.write("};\n")
    output.write(
        f'const mozilla::Span {array_name}[] = {{ {", ".join(certificate_names)} }};\n'
    )


def generate(output, *args):
    write_header(output, args[-1], args[0:-1])

67%


¤ Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.0.15Bemerkung:  (vorverarbeitet)  ¤

*Bot Zugriff






Wurzel

Suchen

Beweissystem der NASA

Beweissystem Isabelle

NIST Cobol Testsuite

Cephes Mathematical Library

Wiener Entwicklungsmethode

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung ist noch experimentell.