Class TrustAllManager

java.lang.Object
cloud.opencode.base.crypto.ssl.TrustAllManager
All Implemented Interfaces:
TrustManager, X509TrustManager

public final class TrustAllManager extends Object implements X509TrustManager
Trust All Manager - X509TrustManager that Trusts All Certificates 信任所有管理器 - 信任所有证书的 X509TrustManager

WARNING: This trust manager accepts ALL certificates without validation. Use ONLY for development and testing purposes.

警告:此信任管理器接受所有证书而不进行验证。 仅用于开发和测试目的。

Example | 示例:

// Test code: explicit opt-in via createUnsafe(true) — bypasses the property gating below.
SSLContext sslContext = SSLContext.getInstance("TLS");
sslContext.init(null, new TrustManager[]{TrustAllManager.createUnsafe(true)}, null);

// Production-style emergency override via INSTANCE: requires the system property
//   -Dopencode.ssl.trustAll.enabled=true
// Without the property, every TLS handshake throws CertificateException.

Features | 主要功能:

  • Trusts all certificates without validation - 不验证地信任所有证书
  • Development and testing only - 仅用于开发和测试

Usage Examples | 使用示例:

// Development / test only — explicit opt-in via createUnsafe(true)
SSLContext ctx = SSLContext.getInstance("TLS");
ctx.init(null, new TrustManager[]{TrustAllManager.createUnsafe(true)}, null);

Security | 安全性:

  • Thread-safe: Yes - 线程安全: 是
  • Null-safe: Partial - 空值安全: 部分
Since:
JDK 25, opencode-base-crypto V1.0.0
Author:
Leon Soo www.LeonSoo.com
See Also: