libdigidocpp
SignatureTM.h
Go to the documentation of this file.
1 /*
2  * libdigidocpp
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17  *
18  */
19 
20 #pragma once
21 
22 #include "SignatureBES.h"
23 
24 
25 namespace digidoc
26 {
27 
29 {
30 public:
31  SignatureTM(unsigned int id, const BDoc &_bdoc);
32  SignatureTM(const std::string& path, const BDoc &_bdoc) throw(SignatureException);
33  virtual ~SignatureTM();
34  virtual std::string getMediaType() const;
35  std::vector<unsigned char> getNonce() const;
36  X509Cert getOCSPCertificate() const;
37  std::string getProducedAt() const;
38  std::string getResponderID() const;
39  void getRevocationOCSPRef(std::vector<unsigned char>& data, std::string& digestMethodUri) const throw(SignatureException);
40  virtual void validateOffline() const throw(SignatureException);
41 
42  static const std::string MEDIA_TYPE;
43 protected:
44  virtual void sign(Signer* signer) throw(SignatureException, SignException);
45  void notarize() throw(SignatureException, SignException);
46  void addCertificateValue(const std::string& certId, const X509Cert& x509);
47 private:
48  void createTMProperties();
49  void setOCSPCertificate(const X509Cert& x509);
50  void setCACertificate(const X509Cert& x509);
51  void setOCSPResponseValue(const std::vector<unsigned char>& data);
52 
53  void setCompleteRevocationRefs(const std::string& responderName, const std::string& digestMethodUri,
54  const std::vector<unsigned char>& ocspResponseHash, const struct tm& producedAt );
55 
56  std::vector<unsigned char> getOCSPResponseValue() const;
57  xades::UnsignedPropertiesType::UnsignedSignaturePropertiesOptional& unsignedSignatureProperties() const throw(SignatureException);
58 };
59 
60 }