Class DkimSigner

java.lang.Object
cloud.opencode.base.email.security.DkimSigner

public final class DkimSigner extends Object
DKIM Message Signer DKIM消息签名器

Signs email messages with DKIM (DomainKeys Identified Mail).

使用DKIM签名邮件消息。

Features | 主要功能:

  • RSA-SHA256 signing - RSA-SHA256签名
  • Relaxed/relaxed canonicalization - 宽松/宽松规范化
  • Configurable headers to sign - 可配置签名邮件头

Security | 安全性:

  • Thread-safe: Yes - 线程安全: 是

Usage Examples | 使用示例:

DkimConfig dkim = DkimConfig.load("example.com", "mail", keyPath);
String signedMessage = DkimSigner.sign(rawMessage, dkim);
Since:
JDK 25, opencode-base-email V1.0.0
Author:
Leon Soo www.LeonSoo.com
See Also:
  • Method Details

    • sign

      public static String sign(String rawMessage, DkimConfig config)
      Sign a raw MIME message with DKIM 使用DKIM签名原始MIME消息
      Parameters:
      rawMessage - the raw MIME message string | 原始MIME消息字符串
      config - the DKIM configuration | DKIM配置
      Returns:
      the signed message with DKIM-Signature header prepended | 带有DKIM-Signature头的签名消息
      Throws:
      EmailSecurityException - if signing fails | 签名失败时抛出