limal-ca-mgm
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 LIMAL_CA_MGM_LOCAL_MANAGEMENT_HPP
23 #define LIMAL_CA_MGM_LOCAL_MANAGEMENT_HPP
24 
25 #include <limal/ca-mgm/config.h>
29 #include <limal/ca-mgm/CRLData.hpp>
30 #include <limal/ByteBuffer.hpp>
31 
32 namespace LIMAL_NAMESPACE {
33 
34 namespace CA_MGM_NAMESPACE {
35 
43 
44  public:
45 
56  static void
57  importAsLocalCertificate(const String &pkcs12File,
58  const String &password,
59  const String &destinationCAsDir,
60  const String &destinationCertFile,
61  const String &destinationKeyFile);
62 
73  static void
74  importAsLocalCertificate(const limal::ByteBuffer &pkcs12Data,
75  const String &password,
76  const String &destinationCAsDir,
77  const String &destinationCertFile,
78  const String &destinationKeyFile);
79 
90  static void
91  importCommonServerCertificate(const String &pkcs12File,
92  const String &password);
93 
104  static void
105  importCommonServerCertificate(const limal::ByteBuffer &pkcs12Data,
106  const String &password);
107 
116  static CertificateData
117  getCertificate(const String &file,
118  FormatType type);
119 
128  static CertificateData
129  getCertificate(const limal::ByteBuffer &data,
130  FormatType type);
131 
140  static RequestData
141  getRequest(const String &file,
142  FormatType type);
143 
152  static RequestData
153  getRequest(const limal::ByteBuffer &data,
154  FormatType type);
155 
156 
165  static CRLData
166  getCRL(const String &file,
167  FormatType type);
168 
169 
178  static CRLData
179  getCRL(const limal::ByteBuffer &data,
180  FormatType type);
181 
190  static limal::ByteBuffer
191  readFile(const String& file);
192 
203  static void
204  writeFile(const limal::ByteBuffer& data,
205  const String &file,
206  bool overwrite = true,
207  mode_t mode = 0644);
208 
217  static limal::ByteBuffer
218  x509Convert(const limal::ByteBuffer &certificate,
219  FormatType inform,
220  FormatType outform );
221 
237  static limal::ByteBuffer
238  rsaConvert(const limal::ByteBuffer &key,
239  FormatType inform,
240  FormatType outform,
241  const String &inPassword,
242  const String &outPassword,
243  const String &algorithm = "des3" );
244 
253  static limal::ByteBuffer
254  crlConvert(const limal::ByteBuffer &crl,
255  FormatType inform,
256  FormatType outform );
257 
266  static limal::ByteBuffer
267  reqConvert(const limal::ByteBuffer &req,
268  FormatType inform,
269  FormatType outform );
270 
271 
286  static limal::ByteBuffer
287  createPKCS12(const limal::ByteBuffer &certificate,
288  const limal::ByteBuffer &key,
289  const String &inPassword,
290  const String &outPassword,
291  const limal::ByteBuffer &caCert,
292  const String &caPath,
293  bool withChain = false);
294 
306  static limal::ByteBuffer
307  pkcs12ToPEM(const limal::ByteBuffer &pkcs12,
308  const String &inPassword,
309  const String &outPassword,
310  const String &algorithm = "des3");
311  };
312 }
313 }
314 #endif //LIMAL_CA_MGM_LOCAL_MANAGEMENT_HPP