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

com.anysoft.util.code.coder.PublicRSA Maven / Gradle / Ivy

There is a newer version: 1.6.17
Show newest version
package com.anysoft.util.code.coder;
import com.anysoft.util.KeyGen;
import com.anysoft.util.code.Coder;
import com.anysoft.util.code.util.RSAUtil;

/**
 * 基于RSA采用公钥加密/解密
 * 
 * @author duanyy
 * @version 1.6.12.7 [20181108 duanyy] 
* - 改造coder框架
*/ public class PublicRSA implements Coder { @Override public String encode(String data,String key) { return RSAUtil.encryptWithPublicKey(data, key); } @Override public String decode(String data,String key) { return RSAUtil.decryptWithPublicKey(data, key); } public boolean verify(String data,String key,String signData){ return RSAUtil.verify(data, key, signData); } @Override public String createKey(){ return KeyGen.getKey(8); } @Override public String createKey(String init){ return init; } @Override public String encode(String data, String key, boolean hex, boolean urlSafe) { return RSAUtil.encryptWithPublicKey(data, key); } @Override public String decode(String data, String key, boolean hex, boolean urlSafe) { return RSAUtil.decryptWithPublicKey(data, key); } @Override public String createKey(String init, boolean hex, boolean urlSafe) { return KeyGen.getKey(8); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy