Package net.markenwerk.utils.mail.dkim
Class DomainKey
- java.lang.Object
-
- net.markenwerk.utils.mail.dkim.DomainKey
-
public final class DomainKey extends Object
ADomainKeyholds the information about a domain key.- Since:
- 1.0.0
- Author:
- Torsten Krause (tk at markenwerk dot net)
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcheck(String identity, PrivateKey privateKey)Checks, whether thisDomainKeyfits to the given identity andRSAPrivateKey.PatterngetGranularity()Returns aPatternthat matches the granularity of thisDomainKey, as described in the 'g' tag.PublicKeygetPublicKey()Returns the public key of thisDomainKey, as provided by the 'p' tag.KeyPairTypegetPublicKeyType()Returns the type of public key of thisDomainKey, as provided by the 'p' tag.Set<String>getServiceTypes()Returns the set of service types supported by thisDomainKey, as described in the 's' tag.Map<Character,String>getTags()Returns theunmodifiablemap of tags, thisDomainKeywas constructed from.longgetTimestamp()Returns the construction time of thisDomainKeyas a timestamp.StringtoString()
-
-
-
Constructor Detail
-
DomainKey
public DomainKey(Map<Character,String> tags) throws DkimException
Creates a newDomainKeyfrom the given tags.- Parameters:
tags- The tags to be used.- Throws:
DkimException- If either the version, key type or service type given in the tags is incompatible to this library ('DKIM1', 'RSA' or 'Ed25519' and 'email' respectively).
-
-
Method Detail
-
getTimestamp
public long getTimestamp()
Returns the construction time of thisDomainKeyas a timestamp.- Returns:
- The construction time of this
DomainKeyas a timestamp.
-
getGranularity
public Pattern getGranularity()
Returns aPatternthat matches the granularity of thisDomainKey, as described in the 'g' tag.- Returns:
- A
Patternthat matches the granularity of thisDomainKey.
-
getServiceTypes
public Set<String> getServiceTypes()
Returns the set of service types supported by thisDomainKey, as described in the 's' tag.- Returns:
- The set of service types supported by this
DomainKey.
-
getPublicKeyType
public KeyPairType getPublicKeyType()
Returns the type of public key of thisDomainKey, as provided by the 'p' tag.- Returns:
- The type of public key of this
DomainKey.
-
getPublicKey
public PublicKey getPublicKey()
Returns the public key of thisDomainKey, as provided by the 'p' tag.- Returns:
- The public key of this
DomainKey.
-
getTags
public Map<Character,String> getTags()
Returns theunmodifiablemap of tags, thisDomainKeywas constructed from.- Returns:
- The map of tags, this
DomainKeywas constructed from.
-
check
public void check(String identity, PrivateKey privateKey) throws DkimSigningException
Checks, whether thisDomainKeyfits to the given identity andRSAPrivateKey.- Parameters:
identity- The identity.privateKey- TheRSAPrivateKey.- Throws:
DkimSigningException- If either thegranularityof thisDomainKeydoesn't match the given identity or thepublic keyof thisDomainKeydoesn't belong to the givenRSAPrivateKey.
-
-