libdigidocpp
Digest.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 "../Exception.h"
23 
24 #include <memory>
25 
26 #define URI_SHA1 "http://www.w3.org/2000/09/xmldsig#sha1"
27 #define URI_SHA224 "http://www.w3.org/2001/04/xmldsig-more#sha224"
28 #define URI_SHA256 "http://www.w3.org/2001/04/xmlenc#sha256"
29 #define URI_SHA384 "http://www.w3.org/2001/04/xmldsig-more#sha384"
30 #define URI_SHA512 "http://www.w3.org/2001/04/xmlenc#sha512"
31 
32 #define URI_RSA_SHA1 "http://www.w3.org/2000/09/xmldsig#rsa-sha1"
33 #define URI_RSA_SHA224 "http://www.w3.org/2001/04/xmldsig-more#rsa-sha224"
34 #define URI_RSA_SHA256 "http://www.w3.org/2001/04/xmldsig-more#rsa-sha256"
35 #define URI_RSA_SHA384 "http://www.w3.org/2001/04/xmldsig-more#rsa-sha384"
36 #define URI_RSA_SHA512 "http://www.w3.org/2001/04/xmldsig-more#rsa-sha512"
37 
38 namespace digidoc
39 {
43  class DigestPrivate;
45  {
46  public:
47  Digest() throw(IOException);
48  Digest(int method) throw(IOException);
49  Digest(const std::string &methodUri) throw(IOException);
50  virtual ~Digest();
51  void reset();
52  void update(const std::vector<unsigned char> &data) throw(IOException);
53  virtual void update(const unsigned char *data, unsigned long length) throw(IOException);
54  virtual std::vector<unsigned char> getDigest() throw(IOException);
55  unsigned int getSize() const;
56  int getMethod() const;
57  std::string getName() const;
58  std::string getUri() const;
59 
60  static int toMethod(const std::string &methodUri) throw(IOException);
61  static bool isSupported(const std::string &methodUri);
62 
63  private:
65  };
66 
67 }