All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.shoulder.crypto.negotiation.support.endpoint.NegotiationEndPoint Maven / Gradle / Ivy

Go to download

Shoulder 提供的 协商加密模块,用于非信任网络环境下的安全通信。基于 DH + ECC 实现先进的加密算法协商算法,比传统的 DH + DES 协商算法性能显著更高,更安全。

There is a newer version: 1.0.0-M2.2
Show newest version
package org.shoulder.crypto.negotiation.support.endpoint;

import org.shoulder.core.dto.response.BaseResult;
import org.shoulder.crypto.negotiation.constant.NegotiationConstants;
import org.shoulder.crypto.negotiation.exception.NegotiationException;
import org.shoulder.crypto.negotiation.support.dto.NegotiationRequest;
import org.shoulder.crypto.negotiation.support.dto.NegotiationResponse;
import org.shoulder.crypto.negotiation.support.service.TransportNegotiationService;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

/**
 * 密钥协商默认 endPoint
 *
 * @author lym
 */
@RestController
public class NegotiationEndPoint {

    private final TransportNegotiationService negotiationService;

    public NegotiationEndPoint(TransportNegotiationService negotiationService) {
        this.negotiationService = negotiationService;
    }

    /**
     * 密钥交换请求 默认处理地址
     *
     * @param negotiationRequest 密钥交换请求参数
     * @return 密钥协商结论
     * @throws NegotiationException 密钥交换失败
     */
    @RequestMapping(value = "${shoulder.crypto.negotiation.endpoint.path:" + NegotiationConstants.DEFAULT_NEGOTIATION_URL + "}", method = {RequestMethod.GET, RequestMethod.POST})
    public BaseResult handleNegotiate(@RequestBody NegotiationRequest negotiationRequest) throws NegotiationException {
        return BaseResult.success(negotiationService.handleNegotiate(negotiationRequest));
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy