⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ckmime.h

📁 DES加密解密算法,西望大家共享.参考学习
💻 H
字号:
// CkMime.h: interface for the CkMime class.
//
//////////////////////////////////////////////////////////////////////

#ifndef _CKMIME_H
#define _CKMIME_H

#pragma once

class CkMime;
class CkEmail;
#include "CkString.h"
class CkCSP;
class CkCert;
class CkByteData;
#include "CkPrivateKey.h"
#include "CkObject.h"

// CLASS: CkMime
class CkMime  : public CkObject
{
    private:
	void *m_impl;
	bool m_utf8;	// If true, all input "const char *" parameters are utf-8, otherwise they are ANSI strings.

	// Don't allow assignment or copying these objects.
	CkMime(const CkMime &) { } 
	CkMime &operator=(const CkMime &) { return *this; }
	CkMime(void *impl);

    public:
	void *getImpl(void) const { return m_impl; } 
	void inject(void *impl);

	CkMime();
	virtual ~CkMime();

	// BEGIN PUBLIC INTERFACE
	bool get_Utf8(void) const;
	void put_Utf8(bool b);


	void get_Version(CkString &str);

	// Error log retrieval and saving (these methods are common to all Chilkat VC++ classes.)
	bool SaveLastError(const char *filename);
        void LastErrorXml(CkString &str);
        void LastErrorHtml(CkString &str);
        void LastErrorText(CkString &str);

	bool SetBodyFromPlainText(const char *str);
	bool SetHeaderField(const char *name, const char *value);
	bool GetHeaderField(const char *name, CkString &value);

	bool GetHeaderFieldName(int index, CkString &fieldName);
	bool GetHeaderFieldValue(int index, CkString &fieldValue);

	void SetVerifyCert(const CkCert *cert);
	void SetVerifyCert(const CkCert &cert) { SetVerifyCert(&cert); }

	bool LoadMimeFile(const char *fileName);
	bool LoadMimeBytes(CkByteData &bData);
	bool LoadMime(const char *mimeMsg);
	bool SaveMime(const char *filename);

	CkEmail *ToEmailObject(void);

	long get_NumParts(void);
	CkMime *GetPart(long index);
	void get_Protocol(CkString &str);
	void put_Protocol(const char *newVal);
	void get_Micalg(CkString &str);
	void put_Micalg(const char *newVal);
	void get_Boundary(CkString &str);
	void put_Boundary(const char *newVal);
	void get_Name(CkString &str);
	void put_Name(const char *newVal);
	void get_Filename(CkString &str);
	void put_Filename(const char *newVal);
	void get_Charset(CkString &sb);
	void put_Charset(const char *newVal);
	void get_Disposition(CkString &str);
	void put_Disposition(const char *newVal);
	void get_Encoding(CkString &str);
	void put_Encoding(const char *newVal);
	void get_ContentType(CkString &str);
	void put_ContentType(const char *newVal);

	bool UnlockComponent(const char *unlockCode);
	bool IsUnlocked(void) const;

	void ConvertToMultipartMixed(void);
	void ConvertToMultipartAlt(void);

	long get_NumHeaderFields(void);

	long get_NumSignerCerts(void);
	long get_NumEncryptCerts(void);
	bool get_UnwrapExtras(void);
	void put_UnwrapExtras(bool newVal);
	bool get_UseMmDescription(void);
	void put_UseMmDescription(bool newVal);

	bool SetCSP(const CkCSP *csp);
	bool SetCSP(const CkCSP &csp) { return SetCSP(&csp); }
	bool AppendPart(const CkMime *mime);
	bool AppendPart(const CkMime &mime) { return AppendPart(&mime); }
	bool AppendPartFromFile(const char *filename);
	bool NewMultipartMixed();
	bool NewMultipartRelated();
	bool NewMultipartAlternative();
	bool NewMessageRfc822(const CkMime &mimeObject);

	bool SaveBody(const char *filename);
	bool IsMultipart(void);
	bool IsPlainText(void);
	bool IsHtml(void);
	bool IsXml(void);
	bool IsSigned(void);
	bool IsEncrypted(void);
	bool IsMultipartMixed(void);
	bool IsMultipartAlternative(void);
	bool IsMultipartRelated(void);
	bool IsAttachment(void);
	bool IsText(void);
	bool IsApplicationData(void);
	bool IsImage(void);
	bool IsAudio(void);
	bool IsVideo(void);
	bool GetBodyBinary(CkByteData &db);
	bool GetBodyEncoded(CkString &encodedBody);
	bool GetBodyDecoded(CkString &decodedBody);
	bool SetBodyFromEncoded(const char *encoding, const char *str);
	bool SetBodyFromHtml(const char *str);
	bool SetBodyFromXml(const char *str);
	bool SetBodyFromBinary(const CkByteData &dbuf);
	bool SetBodyFromFile(const char *fileName);
	bool Encrypt(const CkCert *cert);
	bool ConvertToSigned(const CkCert *cert);
	bool AddDetachedSignature(const CkCert *cert);
	bool Encrypt(const CkCert &cert) { return Encrypt(&cert); }
	bool ConvertToSigned(const CkCert &cert) { return ConvertToSigned(&cert); }
	bool AddDetachedSignature(const CkCert &cert) { return AddDetachedSignature(&cert); }
	bool SaveXml(const char *filename);
	bool GetMime(CkString &mime);
	bool LoadXml(const char *xml);
	bool GetXml(CkString &xml);
	CkCert *GetEncryptCert(long index);
	CkCert *GetSignerCert(long index);
	bool UnwrapSecurity(void);
	bool LoadXmlFile(const char *fileName);


	bool AddDetachedSignaturePk(const CkCert &cert, const CkPrivateKey &privateKey);
	bool AddDetachedSignaturePk2(const CkCert &cert, const CkPrivateKey &privateKey, bool transferHeaderFields);
	bool ConvertToSignedPk(const CkCert &cert, const CkPrivateKey &privateKey);

	bool Decrypt(void);
	bool Decrypt2(const CkCert &cert, const CkPrivateKey &privateKey);

	// Verify and unwrap the signed MIME, possibly using the verify cert
	// set previously via SetVerifyCert
	bool Verify(void);

	void GetEntireHead(CkString &str);
	void GetEntireBody(CkString &str);

	bool RemovePart(int index);

	bool AddDetachedSignature2(const CkCert &cert, bool transferHeaderFields);
	bool AddHeaderField(const char *name, const char *value);

	// Returns true if the MIME message or any sub-parts
	// are encrypted.
	bool ContainsEncryptedParts(void);
	// Returns true if the MIME message or any sub-parts
	// are signed.
	bool ContainsSignedParts(void);

	CkString m_resultString;
	const char *entireHead(void);
	const char *entireBody(void);
	const char *xml(void);
	const char *mime(void);
	const char *bodyEncoded(void);
	const char *bodyDecoded(void);

	const char *charset(void);
	const char *disposition(void);
	const char *encoding(void);
	const char *contentType(void);
	const char *filename(void);
	const char *name(void);
	const char *boundary(void);
	const char *micalg(void);
	const char *protocol(void);

	const char *header(const char *name);
	const char *headerName(int index);
	const char *headerValue(int index);

	const char *getHeaderField(const char *name);
	const char *getHeaderFieldName(int index);
	const char *getHeaderFieldValue(int index);

	const char *getEntireHead(void);
	const char *getEntireBody(void);
	const char *getXml(void);
	const char *getMime(void);
	const char *getBodyEncoded(void);
	const char *getBodyDecoded(void);

        const char *lastErrorText(void);
        const char *lastErrorXml(void);
        const char *lastErrorHtml(void);


	// END PUBLIC INTERFACE


};


#endif


⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -