huangwenjie 7 роки тому
батько
коміт
a2054c4faf

+ 2 - 0
patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/common/SystemConfig.java

@ -70,6 +70,8 @@ public class SystemConfig {
    }
    public String getPublicKey() { return  getSystemProperties().getProperty("gateway_public_key"); }
    
    public String getImmPublicKey() { return  getSystemProperties().getProperty("ImmPublicTest.key"); }
    public String getJwHospital()
    {

+ 21 - 1
patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/service/ZysoftApi.java

@ -23,6 +23,26 @@ public class ZysoftApi extends AbstractApiExecuter {
    private static byte[]  publicKey;
    private static byte[]  zkzlPublicKey;
    private static byte[]  zkzlPrivateKey;
    private static byte[]  immPublicKey;
    
    /**
     * 获取计免预约加密公钥
     */
    private static byte[] getImmPublicKey() throws Exception {
        if(immPublicKey == null)
        {
            immPublicKey =  sehrCrypto.sehrCrypto.ReadFileBytes(ZysoftApi.class.getClassLoader().getResource(SystemConfig.getInstance().getImmPublicKey()).toURI().getPath());
        }
        return immPublicKey;
    }
    
    
    public String getConditionRSA(String source) throws Exception
    {
        CryptoKey key = buildCryptoKey(getImmPublicKey());
        String restult = cryptoParameter(key,source);
        return restult;
    }
    
    /**
@ -166,7 +186,7 @@ public class ZysoftApi extends AbstractApiExecuter {
        return  apiCryptoParameter;
    }
    
    public String getCryptoCredential() throws Exception
    {
        return buildApiCryptoParameter().getTarget();

+ 1 - 6
patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/service/guahao/GuahaoService.java

@ -1299,12 +1299,7 @@ public class GuahaoService {
    
        ZysoftApi api = ZysoftApi.getSingleton();
    
        Cipher cipher = Cipher.getInstance("RSA");
        RSAPublicKey pubKey = (RSAPublicKey) this.immPublicKeyget("/ImmPublicTest.key");
    
        cipher.init(Cipher.ENCRYPT_MODE, pubKey);
        byte[] cipherText = cipher.doFinal(condition.getBytes());
        condition = new String(cipherText);
        condition = api.getConditionRSA(condition);
        
        //加密后的东西
        System.out.println("Condition: " + condition);