package com.demo.mongodb;

import com.demo.common.SpecialSecret;

import com.demo.entity.vo.DeviceIdVo;
import com.demo.util.ResultObject;
import com.reyun.Algorithm;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;

@RestController
@RequestMapping("/index")
public class IndexController {

    @RequestMapping(value = "/testSo", method = RequestMethod.GET)
    @ResponseBody
    public ResultObject testSo(DeviceIdVo deviceIdVo, HttpServletRequest request) throws Exception{


        //        deviceIdVo = new DeviceIdVo();
//        deviceIdVo.setData("ajT2aaaaGClM8q2TCEQVu192GxAjba==");

//        Algorithm algorithm = new Algorithm();
//        System.out.println("----------------3");
//
//        //解密data
//        String data = algorithm.aes256Decode(deviceIdVo.getData(), "53c3870eaeddbffda14267877b0ebdce");
//        System.out.println("----------------4");
        String key = "53c3870eaeddbffda14267877b0ebdce";
//        String privateKey = "MIICdwIBADANBgkqhkiG9w0BAQEFAASCAmEwggJdAgEAAoGBALoHyZIIH7CW3R9+DYxC56yEHUr+c5TBuuXc+sTQfDDUXPJHnIh3lGNDYRL92wiSupQLprXApKIsobZYmnVuTozS5lW3n0ZqTzAySUOlskco/ccdCd0DwNJp7bRePs7E1OiIHG7dUjb/i833AR79WrGWspaJRSfdfxhuQiZPZuqbAgMBAAECgYEAlPkbgGglCIMnvMpzCvmhEVQTKTUvVdb2VpFp+CaE7Y2CiTqzrc0k9YDFwjGsL+dgpqHV9QK6VGyta5r0xkl5eIpu2a22MH85DHWWPnshZbv9HHvVQrX1PJKJyDupSr+N0xZxi555Md6KOGbj1f8+4lOvy2a4ZAFJiZbkOobZFcECQQDm8YIuCaujE9U1y/4Csf8ip+uQQYwY7Fho/A9Bs/a4DZljWrl5cb6yXbGD2Q9tU28d0Pz254QrmqvPCNXir0qxAkEAzjbQQbvvD5KhtlKeoapHyKpSBNPztwSAXZKj05Jkk7eKcATd3dbFZHxx7JC5w/aq0RAKpdlWp86dsPDwc81FCwJAIzXfKzW+PXbgovsfFzocNCR1/eCAg6xFLnx/tvzBOP6ZzFQgwytcb8VpMzj86SY3YsxiRSK3PA6w8zfdpFolgQJAFnqTKRc7cA8j4aQP9r+BI7atSilwn7q1431grmd+3ztas+tT5CLNUa7fHFKKbXouFKwS/RE8CP7U4bzh+T2fEQJBANFOhqryYmyp/XrXMhpGV53kzGhEtaYzzPuj/PFe0fVF2riRJX1khbtt3pmz9q0oqT/6P6KE2F9VCQQO13VV80Q=";
//
//        String data = SpecialSecret.getSecretAesStr(key, privateKey);
         String data = "{\"result\":123}";
         data = SpecialSecret.aesData(data,key);

        return new ResultObject(data);
    }

}
