001package top.cenze.utils.crypt.sm.sm2; 002 003import org.bouncycastle.math.ec.ECPoint; 004import top.cenze.utils.ConvertUtil; 005 006import java.math.BigInteger; 007 008public class SM2KeyVO { 009 BigInteger privateKey ; 010 ECPoint publicKey ; 011 012 public BigInteger getPrivateKey() { 013 return privateKey; 014 } 015 016 public void setPrivateKey(BigInteger privateKey) { 017 this.privateKey = privateKey; 018 } 019 020 public ECPoint getPublicKey() { 021 return publicKey; 022 } 023 024 public void setPublicKey(ECPoint publicKey) { 025 this.publicKey = publicKey; 026 } 027 028 029 //HardPubKey:3059301306072A8648CE3D020106082A811CCF5501822D03420004+X+Y 030 //SoftPubKey:04+X+Y 031 public String getPubHexInSoft(){ 032 return ConvertUtil.byteToHex(publicKey.getEncoded()); 033 //System.out.println("公钥: " + ); 034 } 035 036// public String getPubHexInHard(){ 037// return SecurityTestAll.SM2PubHardKeyHead +Util.byteToHex(publicKey.getEncoded()); 038// } 039 040 public String getPriHexInSoft(){ 041 return ConvertUtil.byteToHex(privateKey.toByteArray()); 042 } 043}