libcamgm
LocalManagement.hpp
Go to the documentation of this file.
1 /*---------------------------------------------------------------------\
2 | |
3 | _ _ _ _ __ _ |
4 | | | | | | \_/ | / \ | | |
5 | | | | | | |_| | / /\ \ | | |
6 | | |__ | | | | | | / ____ \ | |__ |
7 | |____||_| |_| |_|/ / \ \|____| |
8 | |
9 | ca-mgm library |
10 | |
11 | (C) SUSE Linux Products GmbH |
12 \----------------------------------------------------------------------/
13 
14  File: LocalManagement.hpp
15 
16  Author: <Michael Calmer> <mc@suse.de>
17  Maintainer: <Michael Calmer> <mc@suse.de>
18 
19  Purpose:
20 
21 /-*/
22 #ifndef CA_MGM_LOCAL_MANAGEMENT_HPP
23 #define CA_MGM_LOCAL_MANAGEMENT_HPP
24 
25 #include <ca-mgm/config.h>
26 #include <ca-mgm/CommonData.hpp>
28 #include <ca-mgm/RequestData.hpp>
29 #include <ca-mgm/CRLData.hpp>
30 #include <ca-mgm/ByteBuffer.hpp>
31 
32 namespace CA_MGM_NAMESPACE {
33 
41 
42  public:
43 
54  static void
55  importAsLocalCertificate(const std::string &pkcs12File,
56  const std::string &password,
57  const std::string &destinationCAsDir,
58  const std::string &destinationCertFile,
59  const std::string &destinationKeyFile);
60 
71  static void
72  importAsLocalCertificate(const ca_mgm::ByteBuffer &pkcs12Data,
73  const std::string &password,
74  const std::string &destinationCAsDir,
75  const std::string &destinationCertFile,
76  const std::string &destinationKeyFile);
77 
88  static void
89  importCommonServerCertificate(const std::string &pkcs12File,
90  const std::string &password);
91 
102  static void
103  importCommonServerCertificate(const ca_mgm::ByteBuffer &pkcs12Data,
104  const std::string &password);
105 
114  static CertificateData
115  getCertificate(const std::string &file,
116  FormatType type);
117 
126  static CertificateData
127  getCertificate(const ca_mgm::ByteBuffer &data,
128  FormatType type);
129 
138  static RequestData
139  getRequest(const std::string &file,
140  FormatType type);
141 
150  static RequestData
151  getRequest(const ca_mgm::ByteBuffer &data,
152  FormatType type);
153 
154 
163  static CRLData
164  getCRL(const std::string &file,
165  FormatType type);
166 
167 
176  static CRLData
177  getCRL(const ca_mgm::ByteBuffer &data,
178  FormatType type);
179 
188  static ca_mgm::ByteBuffer
189  readFile(const std::string& file);
190 
201  static void
202  writeFile(const ca_mgm::ByteBuffer& data,
203  const std::string &file,
204  bool overwrite = true,
205  mode_t mode = 0644);
206 
215  static ca_mgm::ByteBuffer
216  x509Convert(const ca_mgm::ByteBuffer &certificate,
217  FormatType inform,
218  FormatType outform );
219 
235  static ca_mgm::ByteBuffer
236  rsaConvert(const ca_mgm::ByteBuffer &key,
237  FormatType inform,
238  FormatType outform,
239  const std::string &inPassword,
240  const std::string &outPassword,
241  const std::string &algorithm = "des3" );
242 
251  static ca_mgm::ByteBuffer
252  crlConvert(const ca_mgm::ByteBuffer &crl,
253  FormatType inform,
254  FormatType outform );
255 
264  static ca_mgm::ByteBuffer
265  reqConvert(const ca_mgm::ByteBuffer &req,
266  FormatType inform,
267  FormatType outform );
268 
269 
284  static ca_mgm::ByteBuffer
285  createPKCS12(const ca_mgm::ByteBuffer &certificate,
286  const ca_mgm::ByteBuffer &key,
287  const std::string &inPassword,
288  const std::string &outPassword,
289  const ca_mgm::ByteBuffer &caCert,
290  const std::string &caPath,
291  bool withChain = false);
292 
304  static ca_mgm::ByteBuffer
305  pkcs12ToPEM(const ca_mgm::ByteBuffer &pkcs12,
306  const std::string &inPassword,
307  const std::string &outPassword,
308  const std::string &algorithm = "des3");
309  };
310 }
311 #endif //CA_MGM_LOCAL_MANAGEMENT_HPP
Read-only data representation of a request.
Definition: RequestData.hpp:42
Read-only data representation of a CRL.
Definition: CRLData.hpp:79
FormatType
Definition: CommonData.hpp:49
Read-only data representation of a certificate.
Definition: CertificateData.hpp:41
LiMaL byte buffer class.
Functions for local certificate management.
Definition: LocalManagement.hpp:40
Buffer for storing binary data.
Definition: ByteBuffer.hpp:55