Poco::OSP::BundleSign

class SignatureFile

File Information

Library: OSP/BundleSign
Package: BundleSign
Header: Poco/OSP/BundleSign/SignatureFile.h

Description

This class is used to compute hash digests for the files in a bundle.

The signatures file has the following format:

Signature-Version: <version>
Created-By: <creator>

Name: <path1>
<digestType>: <digest1>

Name: <path2>
<digestType>: <digest2>

...

Name: <pathN>
<digestType>: <digestN>

Optionally, the signature file can also contain an X509 certificate in PEM format at the end:

X509-Certificate: <common-name>
-----BEGIN CERTIFICATE-----
MIIEFjCCAv6gAwIBAgIBAjALBgkqhkiG9w0BAQUwgdMxEzARBgNVBAMMCmFwcGlu
Zi5jb20xNjA0BgNVBAoMLUFwcGxpZWQgSW5mb3JtYXRpY3MgU29mdHdhcmUgRW5n
...
-----END CERTIFICATE-----

Member Summary

Member Functions: creator, digestType, read, readEntry, version, write

Types Aliases

Signatures

using Signatures = std::map < std::string, std::string >;

Constructors

SignatureFile

SignatureFile();

Creates a SignatureFile object for reading an existing signature file from a stream.

SignatureFile

SignatureFile(
    const std::string & version,
    const std::string & creator,
    const std::string & digestType
);

Creates a SignatureFile object for writing a new signature file to a stream.

The given creator string can be empty -- in this case, no Created-By entry will be written to the file.

Destructor

~SignatureFile

~SignatureFile();

Destroys the SignatureFile.

Member Functions

creator inline

const std::string & creator() const;

Returns the signature file creator.

digestType inline

const std::string & digestType() const;

Returns the signature file digest type.

read

void read(
    Signatures & signatures,
    std::istream & istr
);

Reads signatures from the given stream.

version inline

const std::string & version() const;

Returns the signature file version.

write

void write(
    const Signatures & signatures,
    std::ostream & ostr
) const;

Writes a signature file to the given stream.

readEntry protected static

static void readEntry(
    std::istream & istr,
    std::string & name,
    std::string & value
);