| dkim.h | | dkim.h | |
| | | | |
| skipping to change at line 53 | | skipping to change at line 53 | |
| #define DKIM_CANON_SIMPLE 1 | | #define DKIM_CANON_SIMPLE 1 | |
| #define DKIM_CANON_NOWSP 2 | | #define DKIM_CANON_NOWSP 2 | |
| #define DKIM_CANON_RELAXED 3 | | #define DKIM_CANON_RELAXED 3 | |
| | | | |
| #define DKIM_SIGN_SIMPLE MAKELONG(DKIM_CANON_SIMPLE,D
KIM_CANON_SIMPLE) | | #define DKIM_SIGN_SIMPLE MAKELONG(DKIM_CANON_SIMPLE,D
KIM_CANON_SIMPLE) | |
| #define DKIM_SIGN_SIMPLE_RELAXED MAKELONG(DKIM_CANON_RELAXED,DKIM_CAN
ON_SIMPLE) | | #define DKIM_SIGN_SIMPLE_RELAXED MAKELONG(DKIM_CANON_RELAXED,DKIM_CAN
ON_SIMPLE) | |
| #define DKIM_SIGN_RELAXED MAKELONG(DKIM_CANON_RELAXED,
DKIM_CANON_RELAXED) | | #define DKIM_SIGN_RELAXED MAKELONG(DKIM_CANON_RELAXED,
DKIM_CANON_RELAXED) | |
| #define DKIM_SIGN_RELAXED_SIMPLE MAKELONG(DKIM_CANON_SIMPLE,DKIM_CANO
N_RELAXED) | | #define DKIM_SIGN_RELAXED_SIMPLE MAKELONG(DKIM_CANON_SIMPLE,DKIM_CANO
N_RELAXED) | |
| | | | |
| // DKIM Error codes | | // DKIM Error codes | |
|
| #define DKIM_SUCCESS 0 // operation successful | | #define DKIM_SUCCESS 0 | |
| #define DKIM_OUT_OF_MEMORY 1 // memory allocation failed | | // operation successful | |
| #define DKIM_INVALID_CONTEXT 2 // DKIMContext structure invalid for | | | |
| this operation | | | |
| #define DKIM_NO_SENDER 3 // Could not find From: or S | | | |
| ender: header in message | | | |
| #define DKIM_BAD_PRIVATE_KEY 4 // Could not parse private key | | | |
| #define DKIM_BUFFER_TOO_SMALL 5 // Buffer passed in is not large eno | | | |
| ugh | | | |
| | | | |
| // DKIM Verification Error codes | | | |
| #define DKIM_FAIL -1
// verify error: message is suspicious | | #define DKIM_FAIL -1
// verify error: message is suspicious | |
| #define DKIM_BAD_SYNTAX -2
// signature error: DKIM-Signature could not parse or has bad t
ags/values | | #define DKIM_BAD_SYNTAX -2
// signature error: DKIM-Signature could not parse or has bad t
ags/values | |
| #define DKIM_SIGNATURE_BAD -3
// signature error: RSA verify failed | | #define DKIM_SIGNATURE_BAD -3
// signature error: RSA verify failed | |
| #define DKIM_SIGNATURE_BAD_BUT_TESTING -4 // signature
error: RSA verify failed but testing | | #define DKIM_SIGNATURE_BAD_BUT_TESTING -4 // signature
error: RSA verify failed but testing | |
| #define DKIM_SIGNATURE_EXPIRED -5 // s
ignature error: x= is old | | #define DKIM_SIGNATURE_EXPIRED -5 // s
ignature error: x= is old | |
| #define DKIM_SELECTOR_INVALID -6 // s
ignature error: selector doesn't parse or contains invalid values | | #define DKIM_SELECTOR_INVALID -6 // s
ignature error: selector doesn't parse or contains invalid values | |
| #define DKIM_SELECTOR_GRANULARITY_MISMATCH -7 // signature
error: selector g= doesn't match i= | | #define DKIM_SELECTOR_GRANULARITY_MISMATCH -7 // signature
error: selector g= doesn't match i= | |
| #define DKIM_SELECTOR_KEY_REVOKED -8 // s
ignature error: selector p= empty | | #define DKIM_SELECTOR_KEY_REVOKED -8 // s
ignature error: selector p= empty | |
| #define DKIM_SELECTOR_DOMAIN_NAME_TOO_LONG -9 // signature
error: selector domain name too long to request | | #define DKIM_SELECTOR_DOMAIN_NAME_TOO_LONG -9 // signature
error: selector domain name too long to request | |
| #define DKIM_SELECTOR_DNS_TEMP_FAILURE -10 // signature
error: temporary dns failure requesting selector | | #define DKIM_SELECTOR_DNS_TEMP_FAILURE -10 // signature
error: temporary dns failure requesting selector | |
| #define DKIM_SELECTOR_DNS_PERM_FAILURE -11 // signature
error: permanent dns failure requesting selector | | #define DKIM_SELECTOR_DNS_PERM_FAILURE -11 // signature
error: permanent dns failure requesting selector | |
| #define DKIM_SELECTOR_PUBLIC_KEY_INVALID -12 // signature
error: selector p= value invalid or wrong format | | #define DKIM_SELECTOR_PUBLIC_KEY_INVALID -12 // signature
error: selector p= value invalid or wrong format | |
| #define DKIM_NO_SIGNATURES -13
// process error, no sigs | | #define DKIM_NO_SIGNATURES -13
// process error, no sigs | |
| #define DKIM_NO_VALID_SIGNATURES -14 // p
rocess error, no valid sigs | | #define DKIM_NO_VALID_SIGNATURES -14 // p
rocess error, no valid sigs | |
| #define DKIM_BODY_HASH_MISMATCH -15
// sigature verify error: message body does not hash to bh value | | #define DKIM_BODY_HASH_MISMATCH -15
// sigature verify error: message body does not hash to bh value | |
| #define DKIM_SELECTOR_ALGORITHM_MISMATCH -16 // signature
error: selector h= doesn't match signature a= | | #define DKIM_SELECTOR_ALGORITHM_MISMATCH -16 // signature
error: selector h= doesn't match signature a= | |
| #define DKIM_STAT_INCOMPAT -17
// signature error: incompatible v= | | #define DKIM_STAT_INCOMPAT -17
// signature error: incompatible v= | |
|
| #define DKIM_MAX_ERROR -18 | | #define DKIM_UNSIGNED_FROM -18 | |
| // set this to 1 greater than the highest error code (but negative) | | // signature error: not all message's From headers in signature | |
| | | #define DKIM_OUT_OF_MEMORY -20 | |
| | | // memory allocation failed | |
| | | #define DKIM_INVALID_CONTEXT -21 // D | |
| | | KIMContext structure invalid for this operation | |
| | | #define DKIM_NO_SENDER -22 | |
| | | // signing error: Could not find From: or Sender: header in message | |
| | | #define DKIM_BAD_PRIVATE_KEY -23 // s | |
| | | igning error: Could not parse private key | |
| | | #define DKIM_BUFFER_TOO_SMALL -24 // s | |
| | | igning error: Buffer passed in is not large enough | |
| | | #define DKIM_MAX_ERROR -25 | |
| | | // set this to 1 greater than the highest error code (but negative) | |
| | | | |
| // DKIM_SUCCESS
// verify result: all signatures verified | | // DKIM_SUCCESS
// verify result: all signatures verified | |
|
// signature result: signature verified | |
// signature result: signature verified | |
| #define DKIM_FINISHED_BODY 1 // p
rocess result: no more message body is needed | | #define DKIM_FINISHED_BODY 1 // p
rocess result: no more message body is needed | |
| #define DKIM_PARTIAL_SUCCESS 2 // verify re
sult: at least one but not all signatures verified | | #define DKIM_PARTIAL_SUCCESS 2 // verify re
sult: at least one but not all signatures verified | |
| #define DKIM_NEUTRAL 3 // v
erify result: no signatures verified but message is not suspicous | | #define DKIM_NEUTRAL 3 // v
erify result: no signatures verified but message is not suspicous | |
| #define DKIM_SUCCESS_BUT_EXTRA 4 // signature
result: signature verified but it did not include all of the body | | #define DKIM_SUCCESS_BUT_EXTRA 4 // signature
result: signature verified but it did not include all of the body | |
| | | | |
| // This function is called once for each header in the message | | // This function is called once for each header in the message | |
| // return 1 to include this header in the signature and 0 to exclude. | | // return 1 to include this header in the signature and 0 to exclude. | |
| | | | |
| skipping to change at line 126 | | skipping to change at line 125 | |
| char szRequiredHeaders[256]; // colon-separated l
ist of headers that must be signed | | char szRequiredHeaders[256]; // colon-separated l
ist of headers that must be signed | |
| int nHash;
// use one of the DKIM_HASH_xx constants here | | int nHash;
// use one of the DKIM_HASH_xx constants here | |
|
// even if not present in the message | |
// even if not present in the message | |
| int nIncludeCopiedHeaders; // 0 = don't
include z= tag, 1 = include z= tag | | int nIncludeCopiedHeaders; // 0 = don't
include z= tag, 1 = include z= tag | |
| int nIncludeBodyHash; // use one o
f the DKIM_BODYHASH_xx constants here | | int nIncludeBodyHash; // use one o
f the DKIM_BODYHASH_xx constants here | |
| } DKIMSignOptions; | | } DKIMSignOptions; | |
| | | | |
| typedef struct DKIMVerifyOptions_t | | typedef struct DKIMVerifyOptions_t | |
| { | | { | |
| DKIMDNSCALLBACK pfnSelectorCallback; // selector record callback | | DKIMDNSCALLBACK pfnSelectorCallback; // selector record callback | |
|
| DKIMDNSCALLBACK pfnPracticesCallback; // SSP record callback | | DKIMDNSCALLBACK pfnPracticesCallback; // ADSP record callback | |
| int nHonorBodyLengthTag; // 0 = ignor
e l= tag, 1 = use l= tag to limit the amount of body verified | | int nHonorBodyLengthTag; // 0 = ignor
e l= tag, 1 = use l= tag to limit the amount of body verified | |
|
| int nCheckPractices; // 0 = use d
efault (unknown) practices, 1 = request and use sender's signing practices | | int nCheckPractices; // 0 = use d
efault (unknown) practices, 1 = request and use author domain signing pract
ices | |
| int nSubjectRequired; // 0 = subje
ct is required to be signed, 1 = not required | | int nSubjectRequired; // 0 = subje
ct is required to be signed, 1 = not required | |
|
| int nSaveCanonicalizedData; // 0 = canonicalized data is | | int nSaveCanonicalizedData; // 0 = canon | |
| not saved, 1 = canonicalized data is saved | | icalized data is not saved, 1 = canonicalized data is saved | |
| | | int nAllowUnsignedFromHeaders; // 0 = From headers | |
| | | not included in the signature are not allowed, 1 = allowed | |
| } DKIMVerifyOptions; | | } DKIMVerifyOptions; | |
| | | | |
| typedef struct DKIMVerifyDetails_t | | typedef struct DKIMVerifyDetails_t | |
| { | | { | |
| char *szSignature; | | char *szSignature; | |
|
| char *DNS; | | char *szSignatureDomain; | |
| | | char *szIdentityDomain; | |
| char *szCanonicalizedData; | | char *szCanonicalizedData; | |
| int nResult; | | int nResult; | |
| } DKIMVerifyDetails; | | } DKIMVerifyDetails; | |
| | | | |
| #ifdef _WIN32 | | #ifdef _WIN32 | |
| #include <poppack.h> | | #include <poppack.h> | |
| #endif | | #endif | |
| | | | |
| int DKIM_CALL DKIMSignInit( DKIMContext* pSignContext, DKIMSignOptions* pOp
tions ); | | int DKIM_CALL DKIMSignInit( DKIMContext* pSignContext, DKIMSignOptions* pOp
tions ); | |
| int DKIM_CALL DKIMSignProcess( DKIMContext* pSignContext, char* szBuffer, i
nt nBufLength ); | | int DKIM_CALL DKIMSignProcess( DKIMContext* pSignContext, char* szBuffer, i
nt nBufLength ); | |
| | | | |
End of changes. 6 change blocks. |
| 18 lines changed or deleted | | 24 lines changed or added | |
|
| dkimverify.h | | dkimverify.h | |
| | | | |
| skipping to change at line 27 | | skipping to change at line 27 | |
| * limitations under the License. | | * limitations under the License. | |
| * | | * | |
| ***************************************************************************
**/ | | ***************************************************************************
**/ | |
| | | | |
| #ifndef DKIMVERIFY_H | | #ifndef DKIMVERIFY_H | |
| #define DKIMVERIFY_H | | #define DKIMVERIFY_H | |
| | | | |
| #include "dkimbase.h" | | #include "dkimbase.h" | |
| #include <vector> | | #include <vector> | |
| | | | |
|
| #define DKIM_SSP_UNKNOWN 1 | | #define DKIM_ADSP_UNKNOWN 1 | |
| #define DKIM_SSP_ALL 2 | | #define DKIM_ADSP_ALL 2 | |
| #define DKIM_SSP_STRICT 3 | | #define DKIM_ADSP_DISCARDABLE 3 | |
| | | | |
| #define DKIM_POLICY_DOMAIN_NAME_TOO_LONG -50 // 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_TEMP_FAILURE -51 // internal
error | |
| #define DKIM_POLICY_DNS_PERM_FAILURE -52 // internal
error | | #define DKIM_POLICY_DNS_PERM_FAILURE -52 // internal
error | |
| #define DKIM_POLICY_INVALID -53
// internal error | | #define DKIM_POLICY_INVALID -53
// internal error | |
| | | | |
| #define DKIM_SIG_VERSION_PRE_02 0 | | #define DKIM_SIG_VERSION_PRE_02 0 | |
| #define DKIM_SIG_VERSION_02_PLUS 1 | | #define DKIM_SIG_VERSION_02_PLUS 1 | |
| | | | |
| class SelectorInfo | | class SelectorInfo | |
| | | | |
| skipping to change at line 118 | | skipping to change at line 118 | |
| virtual int ProcessBody( char* szBuffer, int nBufLength, bool bEOF )
; | | virtual int ProcessBody( char* szBuffer, int nBufLength, bool bEOF )
; | |
| | | | |
| const char* GetPractices() { return Practices.c_str(); } | | const char* GetPractices() { return Practices.c_str(); } | |
| | | | |
| protected: | | protected: | |
| | | | |
| int ParseDKIMSignature( const string& sHeader, SignatureInfo &sig ); | | int ParseDKIMSignature( const string& sHeader, SignatureInfo &sig ); | |
| | | | |
| SelectorInfo& GetSelector( const string &sSelector, const string &sD
omain ); | | SelectorInfo& GetSelector( const string &sSelector, const string &sD
omain ); | |
| | | | |
|
| int GetSSP( const string &sDomain, int &iSSP, bool &bTesting ); | | int GetADSP( const string &sDomain, int &iADSP ); | |
| | | | |
| list<SignatureInfo> Signatures; | | list<SignatureInfo> Signatures; | |
| list<SelectorInfo> Selectors; | | list<SelectorInfo> Selectors; | |
| | | | |
| DKIMDNSCALLBACK m_pfnSelectorCallback; // selector record c
allback | | DKIMDNSCALLBACK m_pfnSelectorCallback; // selector record c
allback | |
|
| DKIMDNSCALLBACK m_pfnPracticesCallback; // SSP record callba
ck | | DKIMDNSCALLBACK m_pfnPracticesCallback; // ADSP record callb
ack | |
| | | | |
| bool m_HonorBodyLengthTag; | | bool m_HonorBodyLengthTag; | |
| bool m_CheckPractices; | | bool m_CheckPractices; | |
| bool m_SubjectIsRequired; | | bool m_SubjectIsRequired; | |
| bool m_SaveCanonicalizedData; | | bool m_SaveCanonicalizedData; | |
|
| | | bool m_AllowUnsignedFromHeaders; | |
| | | | |
| vector<DKIMVerifyDetails> Details; | | vector<DKIMVerifyDetails> Details; | |
| string Practices; | | string Practices; | |
| }; | | }; | |
| | | | |
| #endif //DKIMVERIFY_H | | #endif //DKIMVERIFY_H | |
| | | | |
End of changes. 4 change blocks. |
| 5 lines changed or deleted | | 6 lines changed or added | |
|