Search in sources :

Example 6 with UserAPIServicePortTypeProxy

use of com.liumapp.digitalsign.test.ca.tianwei.proxy.UserAPIServicePortTypeProxy in project spring-cloud-digital-sign by SpringForAll.

the class RaService method synchroTemplate.

/**
 * 获取证书模板
 *
 * @Title: synchroTemplate
 * @Description: TODO(获取证书模板)
 * @return JSONObject
 * @throws JSONException
 */
public JSONObject synchroTemplate() throws JSONException {
    JSONObject ret = new JSONObject();
    try {
        UserAPIServicePortTypeProxy proxy = axisUtil.getProxyNow();
        AccountConfigResult result = proxy.synchroTemplate(ACCOUNT_HASH);
        ret.put("code", "0");
        ret.put("msg", "");
        ret.put("result", result);
    } catch (Exception e) {
        ret.put("code", "20010101");
        ret.put("msg", errorCode.getErrorCode().get(20010101) + ":" + e.getMessage());
        return ret;
    }
    return ret;
}
Also used : JSONObject(org.json.JSONObject) UserAPIServicePortTypeProxy(com.liumapp.digitalsign.test.ca.tianwei.proxy.UserAPIServicePortTypeProxy) AccountConfigResult(com.liumapp.digitalsign.test.ca.tianwei.user.AccountConfigResult) JSONException(org.json.JSONException)

Example 7 with UserAPIServicePortTypeProxy

use of com.liumapp.digitalsign.test.ca.tianwei.proxy.UserAPIServicePortTypeProxy in project spring-cloud-digital-sign by SpringForAll.

the class RaService method downloadCA.

/**
 * 下载CA证书链
 *
 * @Title: downloadCA
 * @Description: TODO(下载CA证书链)
 * @return JSONObject
 * @throws JSONException
 */
public JSONObject downloadCA() throws JSONException {
    JSONObject ret = new JSONObject();
    try {
        UserAPIServicePortTypeProxy proxy = axisUtil.getProxyNow();
        String ca = proxy.downloadCA(ACCOUNT_HASH);
        ret.put("code", "0");
        ret.put("msg", "");
        ret.put("result", ca);
    } catch (Exception e) {
        ret.put("code", "20010101");
        ret.put("msg", errorCode.getErrorCode().get(20010101) + ":" + e.getMessage());
        return ret;
    }
    return ret;
}
Also used : JSONObject(org.json.JSONObject) UserAPIServicePortTypeProxy(com.liumapp.digitalsign.test.ca.tianwei.proxy.UserAPIServicePortTypeProxy) JSONException(org.json.JSONException)

Example 8 with UserAPIServicePortTypeProxy

use of com.liumapp.digitalsign.test.ca.tianwei.proxy.UserAPIServicePortTypeProxy in project spring-cloud-digital-sign by SpringForAll.

the class RaService method downloadCACrl.

/**
 * 下载CRL
 *
 * @Title: downloadCACrl
 * @Description: TODO(下载CRL)
 * @return JSONObject
 * @throws JSONException
 */
public JSONObject downloadCACrl() throws JSONException {
    JSONObject ret = new JSONObject();
    try {
        UserAPIServicePortTypeProxy proxy = axisUtil.getProxyNow();
        String caCrl = proxy.downloadCRL(ACCOUNT_HASH);
        ret.put("code", "0");
        ret.put("msg", "");
        ret.put("result", caCrl);
    } catch (Exception e) {
        ret.put("code", "20010101");
        ret.put("msg", errorCode.getErrorCode().get(20010101) + ":" + e.getMessage());
        return ret;
    }
    return ret;
}
Also used : JSONObject(org.json.JSONObject) UserAPIServicePortTypeProxy(com.liumapp.digitalsign.test.ca.tianwei.proxy.UserAPIServicePortTypeProxy) JSONException(org.json.JSONException)

Example 9 with UserAPIServicePortTypeProxy

use of com.liumapp.digitalsign.test.ca.tianwei.proxy.UserAPIServicePortTypeProxy in project spring-cloud-digital-sign by SpringForAll.

the class AxisUtil method getProxyNow.

/**
 * plz use this function
 * @return proxy
 */
public UserAPIServicePortTypeProxy getProxyNow() {
    UserAPIServicePortTypeProxy proxy = new UserAPIServicePortTypeProxy();
    proxy.setEndpoint(url);
    return proxy;
}
Also used : UserAPIServicePortTypeProxy(com.liumapp.digitalsign.test.ca.tianwei.proxy.UserAPIServicePortTypeProxy)

Example 10 with UserAPIServicePortTypeProxy

use of com.liumapp.digitalsign.test.ca.tianwei.proxy.UserAPIServicePortTypeProxy in project spring-cloud-digital-sign by SpringForAll.

the class RaService method revokeCert.

/**
 * 吊销个人用户证书
 *
 * @Title: revokeCert
 * @Description: TODO(吊销个人用户证书)
 * @param serialNumber
 *            需要吊销的个人用户证书的序列号
 * @param certReqChallenge
 *            证书申请时的保护口令,若AA模式申请的证书则可传入传入空值
 * @param revokeReason
 *            吊销证书原因:可选值为:1:密钥遭受损害 2:停止使用,3:证书被替代,4:证书暂停使用,5:从属关系变动,0:未知、其他
 * @return JSONObject 返回结果信息
 * @throws JSONException
 */
public JSONObject revokeCert(String serialNumber, String certReqChallenge, String revokeReason) throws JSONException {
    JSONObject ret = new JSONObject();
    try {
        String json = "";
        String certRevokeReasonStr = null;
        UserAPIServicePortTypeProxy proxy = axisUtil.getProxyNow();
        if ("1".equals(revokeReason)) {
            certRevokeReasonStr = "Key compromise[密钥遭受损害]";
        } else if ("2".equals(revokeReason)) {
            certRevokeReasonStr = "Cessation of operatio[停止使用]";
        } else if ("3".equals(revokeReason)) {
            certRevokeReasonStr = "Superseded[证书被替代]";
        } else if ("4".equals(revokeReason)) {
            certRevokeReasonStr = "Certificate hold[证书暂停使用]";
        } else if ("5".equals(revokeReason)) {
            certRevokeReasonStr = "Affiliation changed[从属关系变动]";
        } else if ("0".equals(revokeReason)) {
            certRevokeReasonStr = "Unspecified[其他]";
        }
        if (null == certReqChallenge || certReqChallenge.equals("")) {
            proxy.revokeCert(serialNumber, CERT_REQ_CHALLENGE, certRevokeReasonStr, ACCOUNT_HASH, json);
        } else {
            proxy.revokeCert(serialNumber, certReqChallenge, certRevokeReasonStr, ACCOUNT_HASH, json);
        }
        ret.put("code", "0");
        ret.put("msg", "您的证书已成功吊销......");
    } catch (Exception e) {
        ret.put("code", "20010101");
        ret.put("msg", errorCode.getErrorCode().get(20010101) + ":" + e.getMessage());
    }
    return ret;
}
Also used : JSONObject(org.json.JSONObject) UserAPIServicePortTypeProxy(com.liumapp.digitalsign.test.ca.tianwei.proxy.UserAPIServicePortTypeProxy) JSONException(org.json.JSONException)

Aggregations

UserAPIServicePortTypeProxy (com.liumapp.digitalsign.test.ca.tianwei.proxy.UserAPIServicePortTypeProxy)16 JSONException (org.json.JSONException)15 JSONObject (org.json.JSONObject)14 CertInfo (com.liumapp.digitalsign.test.ca.tianwei.cert.CertInfo)3 QueryCertResult (com.liumapp.digitalsign.test.ca.tianwei.query.QueryCertResult)3 AccountConfigResult (com.liumapp.digitalsign.test.ca.tianwei.user.AccountConfigResult)1