summaryrefslogtreecommitdiff
path: root/src/include/dkimverify.h
diff options
context:
space:
mode:
authorJannis Hoffmann <jannis@fehcom.de>2024-07-03 15:52:39 +0200
committerJannis Hoffmann <jannis@fehcom.de>2024-07-03 15:52:39 +0200
commita6a7d6ce079cabdaf2fa502b2e2cf15e5428ac6f (patch)
treeb88cc7a8457658d67e0321718556ac807f6bccf3 /src/include/dkimverify.h
parent00be7622c428f279872f84569f098ce16150f8a8 (diff)
format files
Diffstat (limited to 'src/include/dkimverify.h')
-rw-r--r--src/include/dkimverify.h169
1 files changed, 85 insertions, 84 deletions
diff --git a/src/include/dkimverify.h b/src/include/dkimverify.h
index 64de2a1..685426b 100644
--- a/src/include/dkimverify.h
+++ b/src/include/dkimverify.h
@@ -22,131 +22,132 @@
#ifndef DKIMVERIFY_H
#define DKIMVERIFY_H
-#include "dkimbase.h"
#include <vector>
+#include "dkimbase.h"
+
/* not used anymore
#define DKIM_ADSP_UNKNOWN 1
#define DKIM_ADSP_ALL 2
#define DKIM_ADSP_DISCARDABLE 3
*/
-#define DKIM_POLICY_DOMAIN_NAME_TOO_LONG -50 // internal error
-#define DKIM_POLICY_DNS_TEMP_FAILURE -51 // internal error
-#define DKIM_POLICY_DNS_PERM_FAILURE -52 // internal error
-#define DKIM_POLICY_INVALID -53 // internal error
+#define DKIM_POLICY_DOMAIN_NAME_TOO_LONG -50 // internal error
+#define DKIM_POLICY_DNS_TEMP_FAILURE -51 // internal error
+#define DKIM_POLICY_DNS_PERM_FAILURE -52 // internal error
+#define DKIM_POLICY_INVALID -53 // internal error
/* dito
#define DKIM_SIG_VERSION_PRE_02 0
#define DKIM_SIG_VERSION_02_PLUS 1
*/
-class SelectorInfo
-{
+class SelectorInfo {
public:
- SelectorInfo(const string &sSelector,const string &sDomain);
- ~SelectorInfo();
+ SelectorInfo(const string& sSelector, const string& sDomain);
+ ~SelectorInfo();
- string Domain;
- string Selector;
- string Granularity;
- bool AllowSHA1;
- bool AllowSHA256;
- EVP_PKEY *PublicKey; /* the public key */
- bool Testing;
- bool SameDomain;
+ string Domain;
+ string Selector;
+ string Granularity;
+ bool AllowSHA1;
+ bool AllowSHA256;
+ EVP_PKEY *PublicKey; /* the public key */
+ bool Testing;
+ bool SameDomain;
- int Status;
+ int Status;
- int Parse(char* Buffer);
+ int Parse(char *Buffer);
};
-class SignatureInfo
-{
+class SignatureInfo {
public:
- SignatureInfo(bool SaveCanonicalizedData);
- ~SignatureInfo();
-
- void Hash(const char* szBuffer,unsigned nBufLength,bool IsBody=false);
-
- string Header;
- unsigned Version;
- string Domain;
- string Selector;
- string SignatureData;
- string BodyHashData;
- string IdentityLocalPart;
- string IdentityDomain;
- string CanonicalizedData;
- vector<string> SignedHeaders;
- unsigned BodyLength;
- unsigned HeaderCanonicalization;
- unsigned BodyCanonicalization;
- unsigned ExpireTime;
-
- unsigned VerifiedBodyCount;
- unsigned UnverifiedBodyCount;
-
-#if ((OPENSSL_VERSION_NUMBER < 0x10100000L) || (LIBRESSL_VERSION_NUMBER > 0 && LIBRESSL_VERSION_NUMBER < 0x20700000L))
- EVP_MD_CTX m_Hdr_ctx;
- EVP_MD_CTX m_Bdy_ctx;
+ SignatureInfo(bool SaveCanonicalizedData);
+ ~SignatureInfo();
+
+ void Hash(const char *szBuffer, unsigned nBufLength, bool IsBody = false);
+
+ string Header;
+ unsigned Version;
+ string Domain;
+ string Selector;
+ string SignatureData;
+ string BodyHashData;
+ string IdentityLocalPart;
+ string IdentityDomain;
+ string CanonicalizedData;
+ vector<string> SignedHeaders;
+ unsigned BodyLength;
+ unsigned HeaderCanonicalization;
+ unsigned BodyCanonicalization;
+ unsigned ExpireTime;
+
+ unsigned VerifiedBodyCount;
+ unsigned UnverifiedBodyCount;
+
+#if ( \
+ (OPENSSL_VERSION_NUMBER < 0x10100000L) \
+ || (LIBRESSL_VERSION_NUMBER > 0 && LIBRESSL_VERSION_NUMBER < 0x20700000L))
+ EVP_MD_CTX m_Hdr_ctx;
+ EVP_MD_CTX m_Bdy_ctx;
#else
- EVP_MD_CTX *m_Hdr_ctx;
- EVP_MD_CTX *m_Bdy_ctx;
+ EVP_MD_CTX *m_Hdr_ctx;
+ EVP_MD_CTX *m_Bdy_ctx;
#endif
#if (OPENSSL_VERSION_NUMBER > 0x10101000L)
- EVP_MD_CTX *m_Msg_ctx;
+ EVP_MD_CTX *m_Msg_ctx;
#endif
- SelectorInfo *m_pSelector;
+ SelectorInfo *m_pSelector;
- int Status;
- int m_nHash; // use one of the DKIM_HASH_xxx constants here
- unsigned EmptyLineCount;
- bool m_SaveCanonicalizedData;
+ int Status;
+ int m_nHash; // use one of the DKIM_HASH_xxx constants here
+ unsigned EmptyLineCount;
+ bool m_SaveCanonicalizedData;
};
-class CDKIMVerify : public CDKIMBase
-{
+class CDKIMVerify : public CDKIMBase {
public:
+ CDKIMVerify();
+ ~CDKIMVerify();
+ // virtual ~CDKIMVerify() = 0;
- CDKIMVerify();
- ~CDKIMVerify();
-// virtual ~CDKIMVerify() = 0;
+ int Init(DKIMVerifyOptions *pOptions);
- int Init(DKIMVerifyOptions* pOptions);
+ int GetResults(void);
+ int GetDetails(int *nSigCount, DKIMVerifyDetails **pDetails);
+ // int _DNSGetTXT(const char* szFQDN,char* Buffer,int nBufLen);
- int GetResults(void);
- int GetDetails(int* nSigCount,DKIMVerifyDetails** pDetails);
-// int _DNSGetTXT(const char* szFQDN,char* Buffer,int nBufLen);
+ virtual int ProcessHeaders(void);
+ virtual int ProcessBody(char *szBuffer, int nBufLength, bool bEOF);
- virtual int ProcessHeaders(void);
- virtual int ProcessBody(char* szBuffer,int nBufLength,bool bEOF);
-
- const char* GetPractices() { return Practices.c_str(); }
+ const char *GetPractices()
+ {
+ return Practices.c_str();
+ }
protected:
+ int ParseDKIMSignature(const string& sHeader, SignatureInfo& sig);
- int ParseDKIMSignature(const string& sHeader,SignatureInfo &sig);
-
- SelectorInfo& GetSelector(const string &sSelector,const string &sDomain);
+ SelectorInfo& GetSelector(const string& sSelector, const string& sDomain);
-// int GetADSP(const string &sDomain,int &iADSP);
+ // int GetADSP(const string &sDomain,int &iADSP);
- list<SignatureInfo> Signatures;
- list<SelectorInfo> Selectors;
+ list<SignatureInfo> Signatures;
+ list<SelectorInfo> Selectors;
- DKIMDNSCALLBACK m_pfnSelectorCallback; // selector record callback
-// DKIMDNSCALLBACK m_pfnPracticesCallback; // ADSP record callback
+ DKIMDNSCALLBACK m_pfnSelectorCallback; // selector record callback
+ // DKIMDNSCALLBACK m_pfnPracticesCallback; // ADSP record callback
- bool m_HonorBodyLengthTag;
- bool m_CheckPractices;
- bool m_SubjectIsRequired;
- bool m_SaveCanonicalizedData;
- bool m_AllowUnsignedFromHeaders;
+ bool m_HonorBodyLengthTag;
+ bool m_CheckPractices;
+ bool m_SubjectIsRequired;
+ bool m_SaveCanonicalizedData;
+ bool m_AllowUnsignedFromHeaders;
- vector<DKIMVerifyDetails> Details;
- string Practices;
+ vector<DKIMVerifyDetails> Details;
+ string Practices;
};
-#endif //DKIMVERIFY_H
+#endif //DKIMVERIFY_H