|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.jboss.resteasy.security.doseta.DKIMSignature
public class DKIMSignature
One single signature within a DKIM-Signature header
Field Summary | |
---|---|
static String |
ALGORITHM
|
protected Map<String,String> |
attributes
|
static String |
BODY_HASH
|
static String |
CANONICALIZATION
|
static String |
DEFAULT_ALGORITHM
This is settable |
static String |
DEFAULT_SIGNER
This is settable |
static String |
DKIM_SIGNATURE
|
static String |
DOMAIN
|
static String |
EXPIRATION
|
protected List<String> |
headers
|
static String |
HEADERS
|
protected String |
headerValue
|
static String |
IDENTITY
|
static String |
LENGTH
|
protected PrivateKey |
privateKey
|
static String |
QUERY
|
static String |
SELECTOR
|
static String |
SHA256WITH_RSA
|
protected byte[] |
signature
|
static String |
SIGNATURE
|
static String |
TIMESTAMP
|
static String |
VERSION
|
Constructor Summary | |
---|---|
DKIMSignature()
|
|
DKIMSignature(Map<String,String> attrs)
|
|
DKIMSignature(String headerValue)
|
Method Summary | |
---|---|
void |
addHeader(String headerName)
Add a reference to a header within the signature calculation |
protected void |
extractAttributes()
|
String |
getAlgorithm()
|
Map<String,String> |
getAttributes()
|
String |
getBased64Signature()
|
String |
getDomain()
|
List<String> |
getHeaderList()
|
String |
getId()
|
PrivateKey |
getPrivateKey()
Private key to use to sign the message. |
String |
getQuery()
|
String |
getSelector()
|
byte[] |
getSignature()
|
boolean |
isExpired()
Return false if true current time. |
boolean |
isStale(int seconds,
int minutes,
int hours,
int days,
int months,
int years)
Returns false if timestamp does not exist or if the current time is greater than timestamp + variables |
void |
setAlgorithm(String value)
Default value is SHA256withRSA, see Javadoc on java.security.Signature for other supported values. |
void |
setAttribute(String name,
String value)
|
void |
setBase64Signature(String signature)
|
void |
setDomain(String domain)
|
void |
setExpiration(Date expire)
|
void |
setExpiration(int seconds,
int minutes,
int hours,
int days,
int months,
int years)
Calculates an expiration date based on the current time plus the additional time units specified in the method parameters. |
void |
setId(String id)
|
void |
setPrivateKey(PrivateKey privateKey)
|
void |
setQuery(String query)
|
void |
setSelector(String selector)
|
void |
setSignature(byte[] signature)
|
void |
setTimestamp()
|
void |
setTimestamp(String value)
|
void |
sign(Map headers,
byte[] body,
PrivateKey defaultKey)
Headers can be a Map |
String |
toString()
Generates the Content-Signature value. |
MultivaluedMap<String,String> |
verify(Map headers,
byte[] body,
PublicKey key)
Headers can be a Map |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final String DKIM_SIGNATURE
public static final String TIMESTAMP
public static final String DOMAIN
public static final String EXPIRATION
public static final String ALGORITHM
public static final String SIGNATURE
public static final String HEADERS
public static final String IDENTITY
public static final String VERSION
public static final String BODY_HASH
public static final String CANONICALIZATION
public static final String QUERY
public static final String SELECTOR
public static final String LENGTH
public static String DEFAULT_SIGNER
public static final String SHA256WITH_RSA
public static String DEFAULT_ALGORITHM
protected PrivateKey privateKey
protected Map<String,String> attributes
protected List<String> headers
protected byte[] signature
protected String headerValue
Constructor Detail |
---|
public DKIMSignature()
public DKIMSignature(Map<String,String> attrs)
public DKIMSignature(String headerValue)
Method Detail |
---|
protected void extractAttributes()
public List<String> getHeaderList()
public String toString()
toString
in class Object
public void addHeader(String headerName)
headerName
- public void setAttribute(String name, String value)
name
- value
- if null, remove attributeincludeSignature
- true if you want attribute to be included within the signature calculationdisplay
- true if you want attribute shown in the Content-Signaturepublic void setAlgorithm(String value)
value
- includeSignature
- true if you want attribute to be included within the signature calculationdisplay
- true if you want attribute shown in the Content-Signaturepublic void setTimestamp(String value)
public void setTimestamp()
public void setSelector(String selector)
public String getSelector()
public String getQuery()
public void setQuery(String query)
public void setDomain(String domain)
public String getDomain()
public void setId(String id)
value
- public void setExpiration(Date expire)
public void setExpiration(int seconds, int minutes, int hours, int days, int months, int years)
seconds
- minutes
- hours
- days
- months
- years
- public boolean isExpired()
public boolean isStale(int seconds, int minutes, int hours, int days, int months, int years)
public String getId()
public String getAlgorithm()
public Map<String,String> getAttributes()
public String getBased64Signature()
public void setBase64Signature(String signature)
public byte[] getSignature()
public void setSignature(byte[] signature)
public PrivateKey getPrivateKey()
public void setPrivateKey(PrivateKey privateKey)
public void sign(Map headers, byte[] body, PrivateKey defaultKey) throws SignatureException
headers
- body
- if null, bh field will not be set or provideddefaultKey
- will be used if privateKey is null
GeneralSecurityException
SignatureException
public MultivaluedMap<String,String> verify(Map headers, byte[] body, PublicKey key) throws SignatureException
headers
- body
- key
- verification
-
SignatureException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |