1 | //======================================================================== |
---|---|
2 | // |
3 | // SignatureInfo.cc |
4 | // |
5 | // This file is licensed under the GPLv2 or later |
6 | // |
7 | // Copyright 2015 André Guerreiro <aguerreiro1985@gmail.com> |
8 | // Copyright 2015 André Esser <bepandre@hotmail.com> |
9 | // Copyright 2017 Hans-Ulrich Jüttner <huj@froreich-bioscientia.de> |
10 | // Copyright 2017-2020 Albert Astals Cid <aacid@kde.org> |
11 | // Copyright 2018 Chinmoy Ranjan Pradhan <chinmoyrp65@protonmail.com> |
12 | // Copyright 2018 Oliver Sander <oliver.sander@tu-dresden.de> |
13 | // Copyright 2021 Georgiy Sgibnev <georgiy@sgibnev.com>. Work sponsored by lab50.net. |
14 | // Copyright 2021 André Guerreiro <aguerreiro1985@gmail.com> |
15 | // Copyright 2021 Marek Kasik <mkasik@redhat.com> |
16 | // Copyright 2023, 2024 g10 Code GmbH, Author: Sune Stolborg Vuorela <sune@vuorela.dk> |
17 | // |
18 | //======================================================================== |
19 | |
20 | #include <config.h> |
21 | |
22 | #include "SignatureInfo.h" |
23 | #include "CertificateInfo.h" |
24 | #include "goo/gmem.h" |
25 | #include <cstdlib> |
26 | #include <cstring> |
27 | |
28 | /* Constructor & Destructor */ |
29 | |
30 | SignatureInfo::~SignatureInfo() = default; |
31 | |
32 | /* GETTERS */ |
33 | |
34 | SignatureValidationStatus SignatureInfo::getSignatureValStatus() const |
35 | { |
36 | return sig_status; |
37 | } |
38 | |
39 | std::string SignatureInfo::getSignerName() const |
40 | { |
41 | return signer_name; |
42 | } |
43 | |
44 | std::string SignatureInfo::getSubjectDN() const |
45 | { |
46 | return subject_dn; |
47 | } |
48 | |
49 | const GooString &SignatureInfo::getLocation() const |
50 | { |
51 | return location; |
52 | } |
53 | |
54 | const GooString &SignatureInfo::getReason() const |
55 | { |
56 | return reason; |
57 | } |
58 | |
59 | HashAlgorithm SignatureInfo::getHashAlgorithm() const |
60 | { |
61 | return hash_type; |
62 | } |
63 | |
64 | time_t SignatureInfo::getSigningTime() const |
65 | { |
66 | return signing_time; |
67 | } |
68 | |
69 | const X509CertificateInfo *SignatureInfo::getCertificateInfo() const |
70 | { |
71 | return cert_info.get(); |
72 | } |
73 | |
74 | /* SETTERS */ |
75 | |
76 | void SignatureInfo::setSignatureValStatus(enum SignatureValidationStatus sig_val_status) |
77 | { |
78 | sig_status = sig_val_status; |
79 | } |
80 | |
81 | void SignatureInfo::setSignerName(const std::string &signerName) |
82 | { |
83 | signer_name = signerName; |
84 | } |
85 | |
86 | void SignatureInfo::setSubjectDN(const std::string &subjectDN) |
87 | { |
88 | subject_dn = subjectDN; |
89 | } |
90 | |
91 | void SignatureInfo::setLocation(const GooString *loc) |
92 | { |
93 | location = GooString(loc); |
94 | } |
95 | |
96 | void SignatureInfo::setReason(const GooString *signingReason) |
97 | { |
98 | reason = GooString(signingReason); |
99 | } |
100 | |
101 | void SignatureInfo::setHashAlgorithm(HashAlgorithm type) |
102 | { |
103 | hash_type = type; |
104 | } |
105 | |
106 | void SignatureInfo::setSigningTime(time_t signingTime) |
107 | { |
108 | signing_time = signingTime; |
109 | } |
110 | |
111 | void SignatureInfo::setCertificateInfo(std::unique_ptr<X509CertificateInfo> certInfo) |
112 | { |
113 | cert_info = std::move(certInfo); |
114 | } |
115 |