私鑰:用來解鎖對應(錢包)地址的一串字符
/**
* Generates an entirely new keypair with the given {@link SecureRandom} object. Point compression is used so the
* resulting public key will be 33 bytes (32 for the co-ordinate and 1 byte to represent the y bit).
* 通過提供的隨機數(shù)生成器稚字,生成完整的密鑰對廊敌。
* 生成的公鑰包含33個字節(jié)廊散,其中x坐標占用32額字節(jié),y坐標占用1個字節(jié)(因為y值可以通過x只計算出來夫否,因此這個字節(jié)用于標識正負)
*/
public ECKey(SecureRandom secureRandom) {
//實例化密鑰對生成器
ECKeyPairGenerator generator = new ECKeyPairGenerator();
//設置密鑰對生成器的相關參數(shù),包括曲線類型和隨機數(shù)生成器
ECKeyGenerationParameters keygenParams = new ECKeyGenerationParameters(CURVE, secureRandom);
//初始化密鑰生成器相關參數(shù)
generator.init(keygenParams);
//生成密鑰對
AsymmetricCipherKeyPair keypair = generator.generateKeyPair();
//獲取公鑰和私鑰參數(shù)對象
ECPrivateKeyParameters privParams = (ECPrivateKeyParameters) keypair.getPrivate();
ECPublicKeyParameters pubParams = (ECPublicKeyParameters) keypair.getPublic();
//獲取私鑰和公鑰值
priv = privParams.getD();
pub = new LazyECPoint(CURVE.getCurve(), pubParams.getQ().getEncoded(true));
//設置密鑰對生成時間
creationTimeSeconds = Utils.currentTimeSeconds();
}