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

com.anysoft.util.code.coder.PrivateRSA 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 PrivateRSA implements Coder { @Override public String encode(String data,String key) { return RSAUtil.encryptWithPrivateKey(data, key); } @Override public String decode(String data,String key) { return RSAUtil.decryptWithPrivateKey(data, key); } public String sign(String data,String key){ return RSAUtil.sign(data, key); } @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.encryptWithPrivateKey(data, key); } @Override public String decode(String data, String key, boolean hex, boolean urlSafe) { return RSAUtil.decryptWithPrivateKey(data, key); } @Override public String createKey(String init, boolean hex, boolean urlSafe) { return KeyGen.getKey(8); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy