00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef LIMAL_CA_MGM_LOCAL_MANAGEMENT_HPP
00023 #define LIMAL_CA_MGM_LOCAL_MANAGEMENT_HPP
00024
00025 #include <limal/ca-mgm/config.h>
00026 #include <limal/ca-mgm/CommonData.hpp>
00027 #include <limal/ca-mgm/CertificateData.hpp>
00028 #include <limal/ca-mgm/RequestData.hpp>
00029 #include <limal/ca-mgm/CRLData.hpp>
00030 #include <limal/ByteBuffer.hpp>
00031
00032 namespace LIMAL_NAMESPACE {
00033
00034 namespace CA_MGM_NAMESPACE {
00035
00042 class LocalManagement {
00043
00044 public:
00045
00056 static void
00057 importAsLocalCertificate(const String &pkcs12File,
00058 const String &password,
00059 const String &destinationCAsDir,
00060 const String &destinationCertFile,
00061 const String &destinationKeyFile);
00062
00073 static void
00074 importAsLocalCertificate(const limal::ByteBuffer &pkcs12Data,
00075 const String &password,
00076 const String &destinationCAsDir,
00077 const String &destinationCertFile,
00078 const String &destinationKeyFile);
00079
00090 static void
00091 importCommonServerCertificate(const String &pkcs12File,
00092 const String &password);
00093
00104 static void
00105 importCommonServerCertificate(const limal::ByteBuffer &pkcs12Data,
00106 const String &password);
00107
00116 static CertificateData
00117 getCertificate(const String &file,
00118 FormatType type);
00119
00128 static CertificateData
00129 getCertificate(const limal::ByteBuffer &data,
00130 FormatType type);
00131
00140 static RequestData
00141 getRequest(const String &file,
00142 FormatType type);
00143
00152 static RequestData
00153 getRequest(const limal::ByteBuffer &data,
00154 FormatType type);
00155
00156
00165 static CRLData
00166 getCRL(const String &file,
00167 FormatType type);
00168
00169
00178 static CRLData
00179 getCRL(const limal::ByteBuffer &data,
00180 FormatType type);
00181
00190 static limal::ByteBuffer
00191 readFile(const String& file);
00192
00203 static void
00204 writeFile(const limal::ByteBuffer& data,
00205 const String &file,
00206 bool overwrite = true,
00207 mode_t mode = 0644);
00208
00217 static limal::ByteBuffer
00218 x509Convert(const limal::ByteBuffer &certificate,
00219 FormatType inform,
00220 FormatType outform );
00221
00237 static limal::ByteBuffer
00238 rsaConvert(const limal::ByteBuffer &key,
00239 FormatType inform,
00240 FormatType outform,
00241 const String &inPassword,
00242 const String &outPassword,
00243 const String &algorithm = "des3" );
00244
00253 static limal::ByteBuffer
00254 crlConvert(const limal::ByteBuffer &crl,
00255 FormatType inform,
00256 FormatType outform );
00257
00266 static limal::ByteBuffer
00267 reqConvert(const limal::ByteBuffer &req,
00268 FormatType inform,
00269 FormatType outform );
00270
00271
00286 static limal::ByteBuffer
00287 createPKCS12(const limal::ByteBuffer &certificate,
00288 const limal::ByteBuffer &key,
00289 const String &inPassword,
00290 const String &outPassword,
00291 const limal::ByteBuffer &caCert,
00292 const String &caPath,
00293 bool withChain = false);
00294
00306 static limal::ByteBuffer
00307 pkcs12ToPEM(const limal::ByteBuffer &pkcs12,
00308 const String &inPassword,
00309 const String &outPassword,
00310 const String &algorithm = "des3");
00311 };
00312 }
00313 }
00314 #endif //LIMAL_CA_MGM_LOCAL_MANAGEMENT_HPP