aboutsummaryrefslogtreecommitdiffstats
path: root/misc/cms/cms_enc.h
diff options
context:
space:
mode:
authorlloyd <[email protected]>2006-06-03 06:10:36 +0000
committerlloyd <[email protected]>2006-06-03 06:10:36 +0000
commit25aaeee23fd952525eadabea43b1c4e8a2cf1b02 (patch)
treef39ce2525b73734e289b4b591093c6b2436b7007 /misc/cms/cms_enc.h
parent6f75c2fe6e536c0192f3acb00c84edbc762127da (diff)
Add the (very old) CMS | S/MIME support code to misc/cms
Diffstat (limited to 'misc/cms/cms_enc.h')
-rw-r--r--misc/cms/cms_enc.h70
1 files changed, 70 insertions, 0 deletions
diff --git a/misc/cms/cms_enc.h b/misc/cms/cms_enc.h
new file mode 100644
index 000000000..ac0634985
--- /dev/null
+++ b/misc/cms/cms_enc.h
@@ -0,0 +1,70 @@
+/*************************************************
+* CMS Encoding Header File *
+* (C) 1999-2003 The Botan Project *
+*************************************************/
+
+#ifndef BOTAN_CMS_ENCODER_H__
+#define BOTAN_CMS_ENCODER_H__
+
+#include <botan/x509cert.h>
+#include <botan/x509stor.h>
+#include <botan/pkcs8.h>
+
+namespace Botan {
+
+/*************************************************
+* CMS Encoding Operation *
+*************************************************/
+class CMS_Encoder
+ {
+ public:
+ void encrypt(const X509_Certificate&, const std::string = "");
+ void encrypt(const std::string&, const std::string& = "");
+ void encrypt(const SymmetricKey&, const std::string& = "");
+
+ void authenticate(const X509_Certificate&, const std::string& = "");
+ void authenticate(const std::string&, const std::string& = "");
+ void authenticate(const SymmetricKey&, const std::string& = "");
+
+ void sign(X509_Store&, const PKCS8_PrivateKey&);
+ void digest(const std::string& = "");
+
+ void compress(const std::string&);
+ static bool can_compress_with(const std::string&);
+
+ SecureVector<byte> get_contents();
+ std::string PEM_contents();
+
+ void set_data(const std::string&);
+ void set_data(const byte[], u32bit);
+
+ CMS_Encoder(const std::string& str) { set_data(str); }
+ CMS_Encoder(const byte buf[], u32bit length) { set_data(buf, length); }
+ private:
+ void add_layer(const std::string&, DER_Encoder&);
+
+ void encrypt_ktri(const X509_Certificate&, PK_Encrypting_Key*,
+ const std::string&);
+ void encrypt_kari(const X509_Certificate&, X509_PublicKey*,
+ const std::string&);
+
+ SecureVector<byte> do_encrypt(const SymmetricKey&, const std::string&);
+
+ static SecureVector<byte> make_econtent(const SecureVector<byte>&,
+ const std::string&);
+
+ static SymmetricKey setup_key(const std::string&);
+ static SecureVector<byte> wrap_key(const std::string&,
+ const SymmetricKey&,
+ const SymmetricKey&);
+ static SecureVector<byte> encode_params(const std::string&,
+ const SymmetricKey&,
+ const InitializationVector&);
+
+ SecureVector<byte> data;
+ std::string type;
+ };
+
+}
+
+#endif