Package net.markenwerk.utils.mail.dkim
Class DomainKey
- java.lang.Object
-
- net.markenwerk.utils.mail.dkim.DomainKey
-
public final class DomainKey extends Object
ADomainKey
holds 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 void
check(String identity, PrivateKey privateKey)
Checks, whether thisDomainKey
fits to the given identity andRSAPrivateKey
.Pattern
getGranularity()
Returns aPattern
that matches the granularity of thisDomainKey
, as described in the 'g' tag.PublicKey
getPublicKey()
Returns the public key of thisDomainKey
, as provided by the 'p' tag.KeyPairType
getPublicKeyType()
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 theunmodifiable
map of tags, thisDomainKey
was constructed from.long
getTimestamp()
Returns the construction time of thisDomainKey
as a timestamp.String
toString()
-
-
-
Constructor Detail
-
DomainKey
public DomainKey(Map<Character,String> tags) throws DkimException
Creates a newDomainKey
from 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 thisDomainKey
as a timestamp.- Returns:
- The construction time of this
DomainKey
as a timestamp.
-
getGranularity
public Pattern getGranularity()
Returns aPattern
that matches the granularity of thisDomainKey
, as described in the 'g' tag.- Returns:
- A
Pattern
that 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 theunmodifiable
map of tags, thisDomainKey
was constructed from.- Returns:
- The map of tags, this
DomainKey
was constructed from.
-
check
public void check(String identity, PrivateKey privateKey) throws DkimSigningException
Checks, whether thisDomainKey
fits to the given identity andRSAPrivateKey
.- Parameters:
identity
- The identity.privateKey
- TheRSAPrivateKey
.- Throws:
DkimSigningException
- If either thegranularity
of thisDomainKey
doesn't match the given identity or thepublic key
of thisDomainKey
doesn't belong to the givenRSAPrivateKey
.
-
-