cn.zcltd.btg.sutil.encrypt.rsa.EncryptionKeyRSA Maven / Gradle / Ivy
package cn.zcltd.btg.sutil.encrypt.rsa;
import cn.zcltd.btg.sutil.encrypt.Encryption;
import java.math.BigInteger;
/**
* RSA key 信息
*/
public class EncryptionKeyRSA {
private BigInteger modulus;
private String modulusHex;
private BigInteger publicExponent;
private String publicExponentHex;
private BigInteger privateExponent;
private String privateExponentHex;
private byte[] publicKey;
private String publicKeyHex;
private String publicKeyBase64;
private byte[] privateKey;
private String privateKeyHex;
private String privateKeyBase64;
public EncryptionKeyRSA(BigInteger modulus, BigInteger publicExponent, BigInteger privateExponent) {
this.modulus = modulus;
this.modulusHex = modulus.toString(16).toUpperCase();
this.publicExponent = publicExponent;
this.publicExponentHex = publicExponent.toString(16).toUpperCase();
this.privateExponent = privateExponent;
this.privateExponentHex = privateExponent.toString(16).toUpperCase();
}
public BigInteger getModulus() {
return modulus;
}
public String getModulusHex() {
return modulusHex;
}
public BigInteger getPublicExponent() {
return publicExponent;
}
public String getPublicExponentHex() {
return publicExponentHex;
}
public BigInteger getPrivateExponent() {
return privateExponent;
}
public String getPrivateExponentHex() {
return privateExponentHex;
}
public byte[] getPublicKey() {
return publicKey;
}
public void setPublicKey(byte[] publicKey) {
this.publicKey = publicKey;
this.publicKeyHex = Encryption.bytesToHex(publicKey);
this.publicKeyBase64 = Encryption.encryptBASE64(publicKey);
}
public String getPublicKeyHex() {
return publicKeyHex;
}
public String getPublicKeyBase64() {
return publicKeyBase64;
}
public byte[] getPrivateKey() {
return privateKey;
}
public void setPrivateKey(byte[] privateKey) {
this.privateKey = privateKey;
this.privateKeyHex = Encryption.bytesToHex(privateKey);
this.privateKeyBase64 = Encryption.encryptBASE64(privateKey);
}
public String getPrivateKeyHex() {
return privateKeyHex;
}
public String getPrivateKeyBase64() {
return privateKeyBase64;
}
}