|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectbadpenguin.dkim.DkimSignature
public class DkimSignature
This class represents a DKIM or DomainKey signature. It has methods to manipulate all of the Tags associated with signature and generate the signature string from the tag settings.
Constructor Summary | |
---|---|
DkimSignature(java.lang.String sig,
boolean leniency)
Create a DkimSignature object from an existing Dkim-Signature. |
|
DkimSignature(java.lang.String selector,
java.lang.String domain)
Construct a DkimSignature with the provided selector and domain tags. |
|
DkimSignature(java.lang.String selector,
java.lang.String domain,
java.lang.String headers)
Construct a DkimSignature with the provided selector, domain and header tags. |
Method Summary | |
---|---|
void |
addHeader(java.lang.String header)
Add the specified header to the H tag. You should specify just the header name without the colon separator. |
void |
checkValidity()
|
DkimSignature |
clone()
Allow this DkimSignature object to be cloned |
java.lang.String |
genDkimSig()
Generate the signature from the current tags and return the DKIM signature string. |
java.lang.String |
getAlgorithm()
Get the (A)lgorithm tag. |
java.lang.String |
getAtag()
Get the current value of the (A)lgorithm tag |
java.lang.String |
getBHtag()
Get the current value of the (B)ody (H)ash tag |
java.lang.String |
getBodyHash()
Get the body hash data. |
CanonicalMethod |
getBodyMethod()
Get the canonicalisation that should be used for processing the body. |
java.lang.String |
getBtag()
Get the current value of the (B)ase64 Signature Data |
java.lang.String |
getCtag()
Get the current value of the (C)anonicalisation tag |
java.lang.String |
getDkimSig()
Get the currently stored signature string. |
java.lang.String |
getDnsRecord()
Get the DNS record. |
java.lang.String |
getDtag()
Get the current value of the (D)omain tag. |
CanonicalMethod |
getHeaderMethod()
Get the canonicalisation that should be used for processing the headers. |
java.lang.String |
getHtag()
Get the current value of the (H)eaders tag. |
java.lang.String |
getItag()
Get the current value of the (I)dentity tag |
java.lang.String |
getJavaAlg()
Get the JAVA version of the (A)lgorithm tag (eg rsa-sha1 == SHA1withRSA) |
long |
getLtag()
Get the current value of the (L)ength tag |
java.lang.String |
getMessageSignature()
Get the message signature data. |
java.lang.String |
getStag()
Get the current value of the (S)elector tag. |
java.lang.String |
getTtag()
Get the current value of the (T)imestamp tag. |
java.lang.String |
getVtag()
Get the current value of the (V)ersion tag |
java.lang.String |
getXtag()
Get the current value of the e(X)pires tag. |
boolean |
isDKIM()
Return true if this signature is DKIM, false if it is DomainKey |
void |
resetDefaultTags()
Reset the DKIM signature tags to their defaults (include mandatory tags where recommendations/defaults are made in the RFC). |
void |
resetTags()
Reset the DKIM Signature tags to their defaults. |
void |
setAtag(java.lang.String arg)
Set the (A)lgorithm tag to the specified value (must be either "rsa-sha1" or "rsa-sha256") |
void |
setBHtag(byte[] data)
Encode and set the (B)ody (H)ash tag to the specified byte[] value |
void |
setBHtag(java.lang.String base64)
Set the (B)ody (H)ash tag to the specified base64 value |
void |
setBodyMethod(CanonicalMethod method)
Set the canonicalisation method which should be used for processing the body. Throw a DkimError if we are a DomainKey signature, because you can't specify defferent encodings for header and body when using DomainKey |
void |
setBtag(byte[] data)
Encode and set the signature data to the specified byte[] value. |
void |
setBtag(java.lang.String base64)
Set the (B)ase64 encoded signature data to the specified value. |
void |
setDtag(java.lang.String domain)
Set the (D)omain tag to the specified value. The domain specifes here should have a subdomain of _domainkey, which holds the selectors in use. |
void |
setHeaderMethod(CanonicalMethod method)
Set the canonicalisation method which should be used for processing the headers. Throw a DkimError if we are a DomainKey signature, because you can't specify defferent encodings for header and body when using DomainKey |
void |
setHtag(java.lang.String headers)
Set the (H)eaders tag to the specified value. The headers, should be lowercase, and they should be colon separated. |
void |
setItag(java.lang.String arg0)
Set the (I)dentity tag to the specified value. |
void |
setLtag(long length)
Set the body (L)ength Tag. |
void |
setMethod(CanonicalMethod method)
Set both the body and header canonicalisation method to the specified value |
void |
setStag(java.lang.String selector)
Set the (S)elector tag to the specified value. |
void |
setTtag(java.lang.String sigTtag)
Set the (T)imestamp tag to the specified value. |
void |
setVtag(java.lang.String version)
Set the (V)ersion tag to the specified version. WARNING: Currently this can only be "1", you don't need to use this (yet)! |
void |
setXtag(java.lang.String sigXtag)
Set the e(X)pires tag to the specified value. |
void |
updateSigfromTags()
Update the internal DKIM-Signature string to match the values currently set in the Tags. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DkimSignature(java.lang.String sig, boolean leniency) throws DkimException
sig
- - The DKIM-Signatureleniency
- - Use defaults for missing mandatory tags?
DkimException
public DkimSignature(java.lang.String selector, java.lang.String domain, java.lang.String headers) throws DkimException
DkimException
public DkimSignature(java.lang.String selector, java.lang.String domain) throws DkimException
selector
- domain
-
DkimException
Method Detail |
---|
public DkimSignature clone() throws java.lang.CloneNotSupportedException
clone
in class java.lang.Object
java.lang.CloneNotSupportedException
public void updateSigfromTags()
public void checkValidity() throws DkimException
DkimException
public java.lang.String getAtag()
public void setAtag(java.lang.String arg) throws DkimException
arg
- - The Algorithm to use
DkimException
- - If an invalid algorithm is specified.public java.lang.String getBtag()
public void setBtag(java.lang.String base64)
base64
- - Base64 encoded signature data.public void setBtag(byte[] data)
data
- - byte array to be encoded to Base64.public java.lang.String getBHtag()
public void setBHtag(java.lang.String base64)
base64
- - base64 encoded Body Hashpublic void setBHtag(byte[] data)
data
- - byte array to be encoded to Base64.public java.lang.String getVtag()
public void setVtag(java.lang.String version)
version
- public java.lang.String getCtag()
public long getLtag()
public void setLtag(long length)
length
- - The bytes of body data to sign.public java.lang.String getHtag()
public void setHtag(java.lang.String headers) throws DkimException
headers
- - The colon separate list of headers to set.
DkimException
public java.lang.String getItag()
public void setItag(java.lang.String arg0)
arg0
- - The I tagpublic java.lang.String getDtag()
public void setDtag(java.lang.String domain)
domain
- - The domain for this messagepublic java.lang.String getStag()
public void setStag(java.lang.String selector)
selector
- - The Selectorpublic java.lang.String getTtag()
public void setTtag(java.lang.String sigTtag)
sigTtag
- - The timestamp tagpublic java.lang.String getXtag()
public void setXtag(java.lang.String sigXtag)
sigXtag
- - The eXpires Tagpublic void addHeader(java.lang.String header)
header
- - The header to add.public java.lang.String getDnsRecord() throws DkimException
DkimException
If
- the Q tag doesn't specify DNS.
DkimException
public java.lang.String getJavaAlg()
public java.lang.String getAlgorithm()
public java.lang.String getBodyHash()
public java.lang.String getMessageSignature()
public boolean isDKIM()
public CanonicalMethod getHeaderMethod()
public CanonicalMethod getBodyMethod()
public void setHeaderMethod(CanonicalMethod method) throws DkimException
method
- - The Canonicalisation method
DkimException
public void setBodyMethod(CanonicalMethod method) throws DkimException
method
- - The Canonicalisation method
DkimException
public void setMethod(CanonicalMethod method) throws DkimException
method
- (simple|nofws|relaxed)
DkimException
public java.lang.String genDkimSig()
public java.lang.String getDkimSig()
public void resetTags()
public void resetDefaultTags()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |