【问题标题】:Bouncy castle - how to rebuild Public key from EdDSA充气城堡 - 如何从 EdDSA 重建公钥
【发布时间】:2021-10-05 07:25:06
【问题描述】:

我有 Edward 曲线关键参数 - x、d 和曲线。如何使用充气城堡重建公钥/私钥?

【问题讨论】:

    标签: eddsa


    【解决方案1】:

    如果x是你的公钥,d是你的私钥,曲线是Curve25519或Curve448,那么你可以简单地执行以下操作:

    final BigInteger x = ...;  // here is your public key as an integer
    final BigInteger d = ...;  // here is your private key as an integer
    
    final Ed25519PrivateKeyParameters reconstructedPrivateKey = new Ed25519PrivateKeyParameters(d.toByteArray(), 0);
    final Ed25519PublicKeyParameters reconstructedPublicKey = new Ed25519PublicKeyParameters(x.toByteArray(), 0);
    

    这是获取 Ed25519 公钥/私钥的示例,对于 X25519、Ed448 或 X448,您只需使用它们各自的类即可。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-05-25
      • 2011-06-11
      • 2015-03-30
      • 2013-04-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-10-30
      相关资源
      最近更新 更多