class CertificateConfig {

        @Schema(description = "PEM:私钥内容")
        private String key;

        @Schema(description = "PEM:证书内容")
        private String cert;

        @Schema(description = "PEM:信任证书,用于客户端模式")
        private String trust;

        //JKS 或者 PFX 才有效
        @Schema(description = "证书库内容(base64)", hidden = true)
        private String keystoreBase64;

        //JKS 或者 PFX 才有效
        @Schema(description = "信任库内容(base64)", hidden = true)
        private String trustKeyStoreBase64;

        //JKS 或者 PFX 才有效
        @Schema(description = "证书密码", hidden = true)
        private String keystorePwd;

        //JKS 或者 PFX 才有效
        @Schema(description = "信任库密码", hidden = true)
        private String trustKeyStorePwd;
    }

    @Override
    public void tryValidate(Class<?>... groups) {
        super.tryValidate(groups);
        //新增时校验证书
        if (groups.length == 0 || groups[0] == CreateGroup.class) {
            validate();
        }
    }

    public void validate() {<FILL_FUNCTION_BODY>

        Assert.notNull(configs, "error.cert_configs_can_not_be_null");
        if (format == CertificateFormat.PEM) {
            if (mode == CertificateMode.server) {
                Assert.hasText(configs.getKey(), "error.pem_key_can_not_be_empty");
                Assert.hasText(configs.getCert(), "error.pem_cert_can_not_be_empty");
            } else if (mode == CertificateMode.client) {
                Assert.hasText(configs.getTrust(), "error.pem_trust_can_not_be_empty");
            }
        }
        format.init(new DefaultCertificate(getId(), getName()), configs);
    
<no_super_class>