Class DKIMSignOptions


  • public class DKIMSignOptions
    extends Object
    This represents the options used to perform DKIM Signature signing action. See: https://tools.ietf.org/html/rfc6376
    Author:
    Lin Gao
    • Constructor Detail

      • DKIMSignOptions

        public DKIMSignOptions()
        Default Constructor.
      • DKIMSignOptions

        public DKIMSignOptions​(JsonObject config)
        Constructor from a JsonObject.
        Parameters:
        config - the JsonObject configuration
    • Method Detail

      • toJson

        public JsonObject toJson()
        Converts to JsonObject
        Returns:
        the JsonObject which represents current configuration.
      • getSignAlgo

        public DKIMSignAlgorithm getSignAlgo()
        Gets the signing algorithm.
        Returns:
        the signing algorithm
      • getPrivateKey

        public String getPrivateKey()
        Gets the PKCS#8 format private key used to sign the email.
        Returns:
        the private key
      • setPrivateKey

        public DKIMSignOptions setPrivateKey​(String privateKey)
        Sets the PKCS#8 format private key used to sign the email.
        Parameters:
        privateKey - the base64 encdoing private key content.
        Returns:
        a reference to this, so the API can be used fluently
      • getPrivateKeyPath

        public String getPrivateKeyPath()
        Gets the PKCS#8 format private key file path.
        Returns:
        the PKCS#8 format private key file path.
      • setPrivateKeyPath

        public DKIMSignOptions setPrivateKeyPath​(String privateKeyPath)
        Sets the PKCS#8 format private key file path.
        Parameters:
        privateKeyPath - The PKCS#8 format private key file path.
        Returns:
        a reference to this, so the API can be used fluently
      • setSignAlgo

        public DKIMSignOptions setSignAlgo​(DKIMSignAlgorithm signAlgo)
        Sets the signing algorithm.
        Parameters:
        signAlgo - the signing algorithm
        Returns:
        a reference to this, so the API can be used fluently
      • getSignedHeaders

        public List<String> getSignedHeaders()
        Gets the email signedHeaders used to sign. The order in the list matters.
        Returns:
        the email signedHeaders used to sign
      • setSignedHeaders

        public DKIMSignOptions setSignedHeaders​(List<String> signedHeaders)
        Sets the email signedHeaders used to sign.
        Parameters:
        signedHeaders - the email signedHeaders
        Returns:
        a reference to this, so the API can be used fluently
      • addSignedHeader

        public DKIMSignOptions addSignedHeader​(String header)
        Adds the signed header
        Parameters:
        header - the header name
        Returns:
        a reference to this, so the API can be used fluently
      • getSdid

        public String getSdid()
        Gets the Singing Domain Identifier(SDID).
        Returns:
        the signing domain identifier
      • setSdid

        public DKIMSignOptions setSdid​(String sdid)
        Sets the Singing Domain Identifier(SDID).
        Parameters:
        sdid - the signing domain identifier
        Returns:
        a reference to this, so the API can be used fluently
      • getSelector

        public String getSelector()
        Gets the selector used to query public key.
        Returns:
        the selector
      • setSelector

        public DKIMSignOptions setSelector​(String selector)
        Sets the selector used to query the public key.
        Parameters:
        selector - the selector
        Returns:
        a reference to this, so the API can be used fluently
      • getHeaderCanonAlgo

        public CanonicalizationAlgorithm getHeaderCanonAlgo()
        Gets the canonicalization algorithm for signed headers.
        Returns:
        the canonicalization algorithm for signed headers
      • setHeaderCanonAlgo

        public DKIMSignOptions setHeaderCanonAlgo​(CanonicalizationAlgorithm headerCanonAlgo)
        Sets the canonicalization algorithm for signed headers.
        Parameters:
        headerCanonAlgo - the canonicalization algorithm for signed headers
        Returns:
        a reference to this, so the API can be used fluently
      • getBodyCanonAlgo

        public CanonicalizationAlgorithm getBodyCanonAlgo()
        Gets the canonicalization algorithm for mail body.
        Returns:
        the canonicalization algorithm for mail body
      • setBodyCanonAlgo

        public DKIMSignOptions setBodyCanonAlgo​(CanonicalizationAlgorithm bodyCanonAlgo)
        Sets the canonicalization algorithm for mail body.
        Parameters:
        bodyCanonAlgo - the canonicalization algorithm for mail body
        Returns:
        a reference to this, so the API can be used fluently
      • getAuid

        public String getAuid()
        Gets the Agent or User Identifier(AUID)
        Returns:
        the auid
      • setAuid

        public DKIMSignOptions setAuid​(String auid)
        Sets the Agent or User Identifier(AUID)
        Parameters:
        auid - the AUID
        Returns:
        a reference to this, so the API can be used fluently
      • getBodyLimit

        public int getBodyLimit()
        Gets the body limit to sign.
        Returns:
        the body limit
      • setBodyLimit

        public DKIMSignOptions setBodyLimit​(int bodyLimit)
        Sets the body limit to sign.
        Parameters:
        bodyLimit - the body limit
        Returns:
        a reference to this, so the API can be used fluently
      • isSignatureTimestamp

        public boolean isSignatureTimestamp()
        Adds signature sign timestamp or not.
        Returns:
        true if yes, false otherwise
      • setSignatureTimestamp

        public DKIMSignOptions setSignatureTimestamp​(boolean signatureTimestamp)
        Sets to enable or disable signature sign timestmap. Default is disabled.
        Parameters:
        signatureTimestamp - if enable signature sign timestamp or not
        Returns:
        a reference to this, so the API can be used fluently
      • getExpireTime

        public long getExpireTime()
        Gets the expire time in seconds when the signature sign will be expired.
        Returns:
        expire time of signature. Positive value means the signature sign timestamp is enabled.
      • setExpireTime

        public DKIMSignOptions setExpireTime​(long expireTime)
        Sets the expire time in seconds when the signature sign will be expired. Success call of this method indicates that the signature sign timestamp is enabled.
        Parameters:
        expireTime - the expire time in seconds
        Returns:
        a reference to this, so the API can be used fluently
      • getCopiedHeaders

        public List<String> getCopiedHeaders()
        Gets the copied headers used in DKIM.
        Returns:
        the copied headers
      • setCopiedHeaders

        public DKIMSignOptions setCopiedHeaders​(List<String> copiedHeaders)
        Sets the copied headers used in DKIM.
        Parameters:
        copiedHeaders - the copied headers
        Returns:
        a reference to this, so the API can be used fluently
      • addCopiedHeader

        public DKIMSignOptions addCopiedHeader​(String header)
        Adds a copied header.
        Parameters:
        header - an email header
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object