Botan 1.10.17
cms_enc.h
Go to the documentation of this file.
1/*
2* CMS Encoding
3* (C) 1999-2007 Jack Lloyd
4*
5* Distributed under the terms of the Botan license
6*/
7
8#ifndef BOTAN_CMS_ENCODER_H__
9#define BOTAN_CMS_ENCODER_H__
10
11#include <botan/x509cert.h>
12#include <botan/x509stor.h>
13#include <botan/pkcs8.h>
14#include <botan/symkey.h>
15
16namespace Botan {
17
18/**
19* CMS Encoding Operation
20*/
21class BOTAN_DLL CMS_Encoder
22 {
23 public:
24
26 const X509_Certificate&, const std::string = "");
27
29 const std::string&, const std::string& = "");
30
32 const SymmetricKey&, const std::string& = "");
33
34 void authenticate(const X509_Certificate&, const std::string& = "");
35 void authenticate(const std::string&, const std::string& = "");
36 void authenticate(const SymmetricKey&, const std::string& = "");
37
38 void sign(const X509_Certificate& cert,
39 const Private_Key& key,
41 const std::vector<X509_Certificate>& cert_chain,
42 const std::string& hash,
43 const std::string& padding);
44
45 void digest(const std::string& = "");
46
47 void compress(const std::string&);
48 static bool can_compress_with(const std::string&);
49
51 std::string PEM_contents();
52
53 void set_data(const std::string&);
54 void set_data(const byte[], size_t);
55
56 CMS_Encoder(const std::string& str) { set_data(str); }
57 CMS_Encoder(const byte buf[], size_t length) { set_data(buf, length); }
58 private:
59 void add_layer(const std::string&, DER_Encoder&);
60
61 void encrypt_ktri(RandomNumberGenerator&,
63 const std::string&);
64 void encrypt_kari(RandomNumberGenerator&,
66 const std::string&);
67
69 const SymmetricKey&, const std::string&);
70
71 static SecureVector<byte> make_econtent(const SecureVector<byte>&,
72 const std::string&);
73
74 static SymmetricKey setup_key(RandomNumberGenerator& rng,
75 const std::string&);
76
77 static SecureVector<byte> wrap_key(RandomNumberGenerator& rng,
78 const std::string&,
79 const SymmetricKey&,
80 const SymmetricKey&);
81
82 static SecureVector<byte> encode_params(const std::string&,
83 const SymmetricKey&,
85
87 std::string type;
88 };
89
90}
91
92#endif
void compress(const std::string &)
Definition cms_comp.cpp:24
void digest(const std::string &="")
Definition cms_ealg.cpp:344
void set_data(const std::string &)
Definition cms_enc.cpp:31
CMS_Encoder(const byte buf[], size_t length)
Definition cms_enc.h:57
void encrypt(RandomNumberGenerator &, const X509_Certificate &, const std::string="")
Definition cms_ealg.cpp:93
void sign(const X509_Certificate &cert, const Private_Key &key, RandomNumberGenerator &rng, const std::vector< X509_Certificate > &cert_chain, const std::string &hash, const std::string &padding)
Definition cms_ealg.cpp:284
CMS_Encoder(const std::string &str)
Definition cms_enc.h:56
static bool can_compress_with(const std::string &)
Definition cms_comp.cpp:56
SecureVector< byte > get_contents()
Definition cms_enc.cpp:39
std::string PEM_contents()
Definition cms_enc.cpp:67
void authenticate(const X509_Certificate &, const std::string &="")
Definition cms_ealg.cpp:367
OctetString SymmetricKey
Definition symkey.h:147
OctetString InitializationVector
Definition symkey.h:152