package cd.casic.module.terminal.utils;

import cd.casic.module.terminal.common.RsaDecryptor;
import cn.orionsec.kit.lang.utils.Exceptions;

/**
 * rsa 参数解密工具类
 *
 * @author Jiahang Li
 * @version 1.0.0
 * @since 2025/1/5 21:13
 */
public class RsaParamDecryptUtils {

    private static RsaDecryptor delegate;

    private RsaParamDecryptUtils() {
    }

    /**
     * 解密
     *
     * @param value value
     * @return value
     */
    public static String decrypt(String value) {
        return delegate.decrypt(value);
    }

    public static void setDelegate(RsaDecryptor delegate) {
        if (RsaParamDecryptUtils.delegate != null) {
            // unmodified
            throw Exceptions.state();
        }
        RsaParamDecryptUtils.delegate = delegate;
    }

}
