package com.usky.fire.service.impl;


import com.usky.fire.service.AtlasService;
import com.usky.fire.service.util.SM2;
import org.springframework.stereotype.Service;

import java.io.IOException;

/**
 * @author yq
 * @date 2021/7/13 14:03
 */
@Service
public class AtlasServiceImpl implements AtlasService {
    private final static String APP_ID = "jhw3X8jw";
    private final static String APP_SECRET = "529afa0a19244eacbe44e88a545f5d22";

    @Override
    public String encrypt() {
        //  加密规则：appId#appSercet#时间戳
        String text = APP_ID+"#"+APP_SECRET+"#" + System.currentTimeMillis();
        byte[] sourceData = text.getBytes();
        String cipherText = null;
        try {
            cipherText = SM2.encrypt(sourceData);
        } catch (IOException e) {
            e.printStackTrace();
        }
        return cipherText;
    }
}
