Class EncryptedConfigProcessor
java.lang.Object
cloud.opencode.base.config.advanced.EncryptedConfigProcessor
Encrypted Configuration Processor
加密配置处理器
Provides transparent decryption of encrypted configuration values. Values prefixed with "ENC(" and suffixed with ")" are automatically decrypted.
提供加密配置值的透明解密。以"ENC("开头和")"结尾的值会自动解密。
Encrypted Format | 加密格式:
database.password=ENC(base64EncodedEncryptedValue)
Usage Examples | 使用示例:
SecretKey key = loadSecretKey();
Config config = EncryptedConfigProcessor.createEncryptedConfig(
OpenConfig.getGlobal(), key);
String password = config.getString("database.password"); // Auto-decrypted
Features | 主要功能:
- Core EncryptedConfigProcessor functionality - EncryptedConfigProcessor核心功能
Security | 安全性:
- Thread-safe: Yes - 线程安全: 是
- Null-safe: Partial (validates inputs) - 空值安全: 部分(验证输入)
Performance | 性能特性:
- Time complexity: O(n) per encrypt/decrypt where n is plaintext length - 时间复杂度: 每次加密/解密 O(n),n 为明文长度
- Space complexity: O(n) for cipher buffers - 空间复杂度: O(n) 密文缓冲区
- Since:
- JDK 25, opencode-base-config V1.0.0
- Author:
- Leon Soo www.LeonSoo.com
- See Also:
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
EncryptedConfigProcessor
public EncryptedConfigProcessor()
-
-
Method Details
-
createEncryptedConfig
-
encrypt
Encrypts a plaintext value using AES/GCM with a random IV. 使用带随机 IV 的 AES/GCM 加密明文值。The IV is prepended to the ciphertext before Base64 encoding.
IV 在 Base64 编码之前被添加到密文前面。
- Parameters:
plaintext- the plaintext to encrypt | 要加密的明文key- the secret key | 密钥- Returns:
- the encrypted value wrapped in ENC() format | 以 ENC() 格式包装的加密值
-