summaryrefslogtreecommitdiff
path: root/poppler/SignatureInfo.cc
blob: 14e9c8802f49beba4860193d8a2cdfb65af35b00 (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
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
//========================================================================
//
// SignatureInfo.cc
//
// This file is licensed under the GPLv2 or later
//
// Copyright 2015 André Guerreiro <aguerreiro1985@gmail.com>
// Copyright 2015 André Esser <bepandre@hotmail.com>
// Copyright 2017 Hans-Ulrich Jüttner <huj@froreich-bioscientia.de>
// Copyright 2017-2020 Albert Astals Cid <aacid@kde.org>
// Copyright 2018 Chinmoy Ranjan Pradhan <chinmoyrp65@protonmail.com>
// Copyright 2018 Oliver Sander <oliver.sander@tu-dresden.de>
// Copyright 2021 Georgiy Sgibnev <georgiy@sgibnev.com>. Work sponsored by lab50.net.
// Copyright 2021 André Guerreiro <aguerreiro1985@gmail.com>
// Copyright 2021 Marek Kasik <mkasik@redhat.com>
// Copyright 2023, 2024 g10 Code GmbH, Author: Sune Stolborg Vuorela <sune@vuorela.dk>
//
//========================================================================

#include <config.h>

#include "SignatureInfo.h"
#include "CertificateInfo.h"
#include "goo/gmem.h"
#include <cstdlib>
#include <cstring>

/* Constructor & Destructor */

SignatureInfo::~SignatureInfo() = default;
SignatureInfo::SignatureInfo() = default;

/* GETTERS */

SignatureValidationStatus SignatureInfo::getSignatureValStatus() const
{
    return sig_status;
}

std::string SignatureInfo::getSignerName() const
{
    return signer_name;
}

std::string SignatureInfo::getSubjectDN() const
{
    return subject_dn;
}

const GooString &SignatureInfo::getLocation() const
{
    return location;
}

const GooString &SignatureInfo::getReason() const
{
    return reason;
}

HashAlgorithm SignatureInfo::getHashAlgorithm() const
{
    return hash_type;
}

time_t SignatureInfo::getSigningTime() const
{
    return signing_time;
}

const X509CertificateInfo *SignatureInfo::getCertificateInfo() const
{
    return cert_info.get();
}

/* SETTERS */

void SignatureInfo::setSignatureValStatus(enum SignatureValidationStatus sig_val_status)
{
    sig_status = sig_val_status;
}

void SignatureInfo::setSignerName(const std::string &signerName)
{
    signer_name = signerName;
}

void SignatureInfo::setSubjectDN(const std::string &subjectDN)
{
    subject_dn = subjectDN;
}

void SignatureInfo::setLocation(const GooString *loc)
{
    location = GooString(loc);
}

void SignatureInfo::setReason(const GooString *signingReason)
{
    reason = GooString(signingReason);
}

void SignatureInfo::setHashAlgorithm(HashAlgorithm type)
{
    hash_type = type;
}

void SignatureInfo::setSigningTime(time_t signingTime)
{
    signing_time = signingTime;
}

void SignatureInfo::setCertificateInfo(std::unique_ptr<X509CertificateInfo> certInfo)
{
    cert_info = std::move(certInfo);
}