ECC 私钥比 public 密钥长

ECC private key is longer than public key

我已经使用 secp192r1 曲线生成了 ECC public 和私钥。 public 得到 75,私有编码密钥数组长度得到 125。为什么私钥比 public 密钥长?为什么私钥不比public长两倍?为什么私钥不是 192 位 = 24 字节因为 secp192r1?

Security.addProvider(new org.bouncycastle.jce.provider.BouncyCastleProvider());

ECNamedCurveParameterSpec ecSpec = ECNamedCurveTable.getParameterSpec("secp192r1");

KeyPairGenerator g = KeyPairGenerator.getInstance("ECDSA", "BC");
g.initialize(ecSpec, new SecureRandom());
KeyPair pair = g.generateKeyPair();

System.out.println(pair.getPublic().getEncoded().length);
System.out.println(pair.getPrivate().getEncoded().length);

下面的代码片段输出 24 字节私钥:

Security.addProvider(new org.bouncycastle.jce.provider.BouncyCastleProvider());

ECNamedCurveParameterSpec spec = ECNamedCurveTable.getParameterSpec("secp192r1");

KeyPairGenerator g = KeyPairGenerator.getInstance("ECDSA", "BC");
g.initialize(spec, new SecureRandom());
KeyPair pair = g.generateKeyPair();
ECPrivateKey ecPrivateKey = (ECPrivateKey)pair.getPrivate();

System.out.println(ecPrivateKey.getS().toByteArray().length);