Record Class DkimConfig
java.lang.Object
java.lang.Record
cloud.opencode.base.email.security.DkimConfig
public record DkimConfig(String domain, String selector, PrivateKey privateKey, Set<String> headersToSign)
extends Record
DKIM Signing Configuration
DKIM签名配置
Configuration for DKIM (DomainKeys Identified Mail) signing.
DKIM(域名密钥识别邮件)签名的配置。
Features | 主要功能:
- RSA private key support - RSA私钥支持
- Configurable headers to sign - 可配置签名邮件头
- Domain and selector configuration - 域名和选择器配置
Usage Examples | 使用示例:
DkimConfig dkim = DkimConfig.load("example.com", "mail", Path.of("dkim-private.pem"));
EmailConfig config = EmailConfig.builder()
.host("smtp.example.com")
.dkim(dkim)
.build();
Security | 安全性:
- Thread-safe: Yes (immutable) - 线程安全: 是(不可变)
- Since:
- JDK 25, opencode-base-email V1.0.0
- Author:
- Leon Soo www.LeonSoo.com
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionDkimConfig(String domain, String selector, PrivateKey privateKey, Set<String> headersToSign) Creates an instance of aDkimConfigrecord class. -
Method Summary
Modifier and TypeMethodDescriptiondomain()Returns the value of thedomainrecord component.final booleanIndicates whether some other object is "equal to" this one.Get default headers to sign 获取默认签名邮件头final inthashCode()Returns a hash code value for this object.Returns the value of theheadersToSignrecord component.static DkimConfigLoad DKIM configuration from key file 从密钥文件加载DKIM配置static DkimConfigLoad DKIM configuration with custom headers 使用自定义邮件头加载DKIM配置static DkimConfigof(String domain, String selector, PrivateKey privateKey) Create DKIM configuration with private key 使用私钥创建DKIM配置static DkimConfigCreate DKIM configuration with all parameters 使用所有参数创建DKIM配置Returns the value of theprivateKeyrecord component.selector()Returns the value of theselectorrecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
DkimConfig
Creates an instance of aDkimConfigrecord class.- Parameters:
domain- the value for thedomainrecord componentselector- the value for theselectorrecord componentprivateKey- the value for theprivateKeyrecord componentheadersToSign- the value for theheadersToSignrecord component
-
-
Method Details
-
load
Load DKIM configuration from key file 从密钥文件加载DKIM配置- Parameters:
domain- the domain name | 域名selector- the DKIM selector | DKIM选择器keyPath- the path to private key file (PEM format) | 私钥文件路径(PEM格式)- Returns:
- the DKIM configuration | DKIM配置
-
load
public static DkimConfig load(String domain, String selector, Path keyPath, Set<String> headersToSign) Load DKIM configuration with custom headers 使用自定义邮件头加载DKIM配置- Parameters:
domain- the domain name | 域名selector- the DKIM selector | DKIM选择器keyPath- the path to private key file | 私钥文件路径headersToSign- the headers to sign | 要签名的邮件头- Returns:
- the DKIM configuration | DKIM配置
-
of
Create DKIM configuration with private key 使用私钥创建DKIM配置- Parameters:
domain- the domain name | 域名selector- the DKIM selector | DKIM选择器privateKey- the private key | 私钥- Returns:
- the DKIM configuration | DKIM配置
-
of
public static DkimConfig of(String domain, String selector, PrivateKey privateKey, Set<String> headersToSign) Create DKIM configuration with all parameters 使用所有参数创建DKIM配置- Parameters:
domain- the domain name | 域名selector- the DKIM selector | DKIM选择器privateKey- the private key | 私钥headersToSign- the headers to sign | 要签名的邮件头- Returns:
- the DKIM configuration | DKIM配置
-
getDefaultHeadersToSign
-
toString
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
domain
Returns the value of thedomainrecord component.- Returns:
- the value of the
domainrecord component
-
selector
Returns the value of theselectorrecord component.- Returns:
- the value of the
selectorrecord component
-
privateKey
Returns the value of theprivateKeyrecord component.- Returns:
- the value of the
privateKeyrecord component
-
headersToSign
-