我们可以有多个 public 密钥和一个 OpenSSL ECC 私钥吗?
Can we have multiple public keys with a single private key for OpenSSL ECC?
我在我的项目中使用 php OpenSSL。如何使用单个私钥创建多个 public 密钥?
在 RSA 中我们不能做这样的事情。但是 ECC 呢?
根据定义,对于一般椭圆曲线密码系统中的每个私有标量(私钥),曲线上有一个点(public 密钥)由 [k]G
生成,其中 G
是曲线生成点,k
是私有标量。
仅供参考,在双有理等效曲线的一个有点不寻常的怪癖中,您实际上可以将蒙哥马利曲线 X25519 public 键映射到两个扭曲的爱德华兹曲线 Ed25519 public 键,就像蒙哥马利曲线点一样不带有 v 坐标,但是,这对您的用例没有帮助。
通常,如果我们想从单个种子(源)定义多个密钥对(不仅仅是 public 个密钥),可以使用从主密钥派生的密钥来实现。
但是,您必须保管好多个私钥。
您似乎暗示私钥将保存在服务器上,所以我认为您实际上不需要多个 public 密钥。我建议您使用单个密钥对和 EdDSA 或 ECDSA 来签署多个密钥对以供客户端设备使用。签名可用于 link 其来源为单一身份。
请提供更多背景信息,我会进一步提供帮助。
在ECC中有一种方法叫做diversified key。它存在于 Apples 的 CommonCrypto 下面来自 CommonECCryptor.h
@function CCECCryptorTwinDiversifyKey
@abstract Diversifies a given EC key by deriving two scalars u,v from the
given entropy.
@discussion entropyLen must be a multiple of two, greater or equal to two
times the bitsize of the order of the chosen curve plus eight
bytes, e.g. 2 * (32 + 8) = 80 bytes for NIST P-256.
Use CCECCryptorTwinDiversifyEntropySize() to determine the
minimum entropy length that needs to be generated and passed.
entropy must be chosen from a uniform distribution, e.g.
random bytes, the output of a DRBG, or the output of a KDF.
u,v are computed by splitting the entropy into two parts of
equal size. For each part t (interpreted as a big-endian number),
a scalar s on the chosen curve will be computed via
s = (t mod (q-1)) + 1, where q is the order of curve's
generator G.
For a public key, this will compute u.P + v.G,
with G being the generator of the chosen curve.
For a private key, this will compute d' = (d * u + v) and
P = d' * G; G being the generator of the chosen curve.
与您的情况一样,加密货币也可能需要它。通过多样化,可以实现某种程度的匿名。如果一个人总是使用同一个 public 键,那么它们就会一直与这个 public 键链接。如果可以用 private/public 密钥使 public 密钥多样化,那么他们就可以使用多样化的新身份。多元化的身份,不容易和原来的身份联系起来。
在上述方案中,用u
和v
多样化的新public密钥将是[u]P + [v]G
,多样化的私钥将是[=18] =]
d' = (d \cdot u + v)
并验证多样化的 public 密钥
P' = [d']G = [d \cdot u + v]G = [d \cdot u]G + [v]G = [u]P + [v]G
总之,你有了新的身份,但幕后依然是你
我在我的项目中使用 php OpenSSL。如何使用单个私钥创建多个 public 密钥?
在 RSA 中我们不能做这样的事情。但是 ECC 呢?
根据定义,对于一般椭圆曲线密码系统中的每个私有标量(私钥),曲线上有一个点(public 密钥)由 [k]G
生成,其中 G
是曲线生成点,k
是私有标量。
仅供参考,在双有理等效曲线的一个有点不寻常的怪癖中,您实际上可以将蒙哥马利曲线 X25519 public 键映射到两个扭曲的爱德华兹曲线 Ed25519 public 键,就像蒙哥马利曲线点一样不带有 v 坐标,但是,这对您的用例没有帮助。
通常,如果我们想从单个种子(源)定义多个密钥对(不仅仅是 public 个密钥),可以使用从主密钥派生的密钥来实现。
但是,您必须保管好多个私钥。
您似乎暗示私钥将保存在服务器上,所以我认为您实际上不需要多个 public 密钥。我建议您使用单个密钥对和 EdDSA 或 ECDSA 来签署多个密钥对以供客户端设备使用。签名可用于 link 其来源为单一身份。
请提供更多背景信息,我会进一步提供帮助。
在ECC中有一种方法叫做diversified key。它存在于 Apples 的 CommonCrypto 下面来自 CommonECCryptor.h
@function CCECCryptorTwinDiversifyKey @abstract Diversifies a given EC key by deriving two scalars u,v from the given entropy. @discussion entropyLen must be a multiple of two, greater or equal to two times the bitsize of the order of the chosen curve plus eight bytes, e.g. 2 * (32 + 8) = 80 bytes for NIST P-256. Use CCECCryptorTwinDiversifyEntropySize() to determine the minimum entropy length that needs to be generated and passed. entropy must be chosen from a uniform distribution, e.g. random bytes, the output of a DRBG, or the output of a KDF. u,v are computed by splitting the entropy into two parts of equal size. For each part t (interpreted as a big-endian number), a scalar s on the chosen curve will be computed via s = (t mod (q-1)) + 1, where q is the order of curve's generator G. For a public key, this will compute u.P + v.G, with G being the generator of the chosen curve. For a private key, this will compute d' = (d * u + v) and P = d' * G; G being the generator of the chosen curve.
与您的情况一样,加密货币也可能需要它。通过多样化,可以实现某种程度的匿名。如果一个人总是使用同一个 public 键,那么它们就会一直与这个 public 键链接。如果可以用 private/public 密钥使 public 密钥多样化,那么他们就可以使用多样化的新身份。多元化的身份,不容易和原来的身份联系起来。
在上述方案中,用u
和v
多样化的新public密钥将是[u]P + [v]G
,多样化的私钥将是[=18] =]
d' = (d \cdot u + v)
并验证多样化的 public 密钥
P' = [d']G = [d \cdot u + v]G = [d \cdot u]G + [v]G = [u]P + [v]G
总之,你有了新的身份,但幕后依然是你