当前位置: 首页>>代码示例>>Java>>正文


Java EdDSANamedCurveSpec类代码示例

本文整理汇总了Java中net.i2p.crypto.eddsa.spec.EdDSANamedCurveSpec的典型用法代码示例。如果您正苦于以下问题:Java EdDSANamedCurveSpec类的具体用法?Java EdDSANamedCurveSpec怎么用?Java EdDSANamedCurveSpec使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


EdDSANamedCurveSpec类属于net.i2p.crypto.eddsa.spec包,在下文中一共展示了EdDSANamedCurveSpec类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: constructEd25519KeyPair

import net.i2p.crypto.eddsa.spec.EdDSANamedCurveSpec; //导入依赖的package包/类
/**
 * Helper method to construct an instance of {@link KeyPair} containing keys for testing purposes.
 *
 * @return An instance of {@link KeyPair}.
 */
protected KeyPair constructEd25519KeyPair() throws InvalidKeySpecException {
  final EdDSANamedCurveSpec edParams = EdDSANamedCurveTable
      .getByName(CryptoConditionReader.ED_25519);
  assert (edParams != null);

  final EdDSAPublicKeySpec pubKeySpec = new EdDSAPublicKeySpec(TEST_PUBKEY, edParams);
  final PublicKey pubKey = new EdDSAPublicKey(pubKeySpec);

  final EdDSAPrivateKeySpec privateKeySpec = new EdDSAPrivateKeySpec(TEST_PRIVKEY, edParams);
  final PrivateKey privKey = new EdDSAPrivateKey(privateKeySpec);

  return new KeyPair(pubKey, privKey);
}
 
开发者ID:hyperledger,项目名称:quilt,代码行数:19,代码来源:Ed25519Sha256ConditionTest.java

示例2: createNamedCurveSpec

import net.i2p.crypto.eddsa.spec.EdDSANamedCurveSpec; //导入依赖的package包/类
/**
 * Create an EdDSANamedCurveSpec from the provided curve name. The current
 * implementation fetches the pre-created curve spec from a table.
 * @param curveName the EdDSA named curve.
 * @return the specification for the named curve.
 * @throws InvalidAlgorithmParameterException if the named curve is unknown.
 */
protected EdDSANamedCurveSpec createNamedCurveSpec(String curveName) throws InvalidAlgorithmParameterException {
    EdDSANamedCurveSpec spec = EdDSANamedCurveTable.getByName(curveName);
    if (spec == null) {
        throw new InvalidAlgorithmParameterException("unknown curve name: " + curveName);
    }
    return spec;
}
 
开发者ID:cping,项目名称:RipplePower,代码行数:15,代码来源:KeyPairGenerator.java

示例3: isValidSignature

import net.i2p.crypto.eddsa.spec.EdDSANamedCurveSpec; //导入依赖的package包/类
public boolean isValidSignature(byte[] message, byte[] signature, byte[] publicKey) {
    try {
        EdDSANamedCurveSpec spec = EdDSANamedCurveTable.getByName("ed25519-sha-512");

        EdDSAPublicKeySpec edDSAPublicKeySpec = new EdDSAPublicKeySpec(publicKey, spec);
        EdDSAPublicKey edDSAPublicKey = new EdDSAPublicKey(edDSAPublicKeySpec);

        mEdDSAEngine.initVerify(edDSAPublicKey);
        mEdDSAEngine.update(message);

        return mEdDSAEngine.verify(signature);
    } catch (Exception e) {
        throw new IllegalArgumentException(e);
    }
}
 
开发者ID:vRallev,项目名称:ECC-25519,代码行数:16,代码来源:Ecc25519Helper.java


注:本文中的net.i2p.crypto.eddsa.spec.EdDSANamedCurveSpec类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。