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


Java EdDSAParameterSpec类代码示例

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


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

示例1: testSign

import net.i2p.crypto.eddsa.spec.EdDSAParameterSpec; //导入依赖的package包/类
@Test
public void testSign() throws Exception {
    //Signature sgr = Signature.getInstance("EdDSA", "I2P");
    Signature sgr = new EdDSAEngine(MessageDigest.getInstance("SHA-512"));
    EdDSAParameterSpec spec = EdDSANamedCurveTable.getByName("ed25519-sha-512");

    for (Ed25519TestVectors.TestTuple testCase : Ed25519TestVectors.testCases) {
        EdDSAPrivateKeySpec privKey = new EdDSAPrivateKeySpec(testCase.seed, spec);
        PrivateKey sKey = new EdDSAPrivateKey(privKey);
        sgr.initSign(sKey);

        sgr.update(testCase.message);

        assertThat("Test case " + testCase.caseNum + " failed",
                sgr.sign(), is(equalTo(testCase.sig)));
    }
}
 
开发者ID:NoYouShutup,项目名称:CryptMeme,代码行数:18,代码来源:EdDSAEngineTest.java

示例2: testVerify

import net.i2p.crypto.eddsa.spec.EdDSAParameterSpec; //导入依赖的package包/类
@Test
public void testVerify() throws Exception {
    //Signature sgr = Signature.getInstance("EdDSA", "I2P");
    Signature sgr = new EdDSAEngine(MessageDigest.getInstance("SHA-512"));
    EdDSAParameterSpec spec = EdDSANamedCurveTable.getByName("ed25519-sha-512");

    for (Ed25519TestVectors.TestTuple testCase : Ed25519TestVectors.testCases) {
        EdDSAPublicKeySpec pubKey = new EdDSAPublicKeySpec(testCase.pk, spec);
        PublicKey vKey = new EdDSAPublicKey(pubKey);
        sgr.initVerify(vKey);

        sgr.update(testCase.message);

        assertThat("Test case " + testCase.caseNum + " failed",
                sgr.verify(testCase.sig), is(true));
    }
}
 
开发者ID:NoYouShutup,项目名称:CryptMeme,代码行数:18,代码来源:EdDSAEngineTest.java

示例3: EdsaSigner

import net.i2p.crypto.eddsa.spec.EdDSAParameterSpec; //导入依赖的package包/类
public EdsaSigner(byte[] privateKeyBytes) {
	EdDSAParameterSpec spec = EdDSANamedCurveTable.getByName("ed25519-sha-512");
	EdDSAPrivateKeySpec privateKeySpec = new EdDSAPrivateKeySpec(privateKeyBytes, spec);
	EdDSAPublicKeySpec pubKeySpec = new EdDSAPublicKeySpec(privateKeySpec.getA(), spec);
	publicKey = new EdDSAPublicKey(pubKeySpec);
	privateKey = new EdDSAPrivateKey(privateKeySpec);
}
 
开发者ID:beowulfe,项目名称:HAP-Java,代码行数:8,代码来源:EdsaSigner.java

示例4: initialize

import net.i2p.crypto.eddsa.spec.EdDSAParameterSpec; //导入依赖的package包/类
@Override
public void initialize(AlgorithmParameterSpec params, SecureRandom random) throws InvalidAlgorithmParameterException {
    if (params instanceof EdDSAParameterSpec) {
        edParams = (EdDSAParameterSpec) params;
    } else if (params instanceof EdDSAGenParameterSpec) {
        edParams = createNamedCurveSpec(((EdDSAGenParameterSpec) params).getName());
    } else
        throw new InvalidAlgorithmParameterException("parameter object not a EdDSAParameterSpec");

    this.random = random;
    initialized = true;
}
 
开发者ID:cping,项目名称:RipplePower,代码行数:13,代码来源:KeyPairGenerator.java

示例5: cvtToJavaEdDSAKey

import net.i2p.crypto.eddsa.spec.EdDSAParameterSpec; //导入依赖的package包/类
/**
 *  @since 0.9.15
 */
private static EdDSAPublicKey cvtToJavaEdDSAKey(SigningPublicKey pk)
                          throws GeneralSecurityException {
    try {
        return new EdDSAPublicKey(new EdDSAPublicKeySpec(
            pk.getData(), (EdDSAParameterSpec) pk.getType().getParams()));
    } catch (IllegalArgumentException iae) {
        throw new InvalidKeyException(iae);
    }
}
 
开发者ID:NoYouShutup,项目名称:CryptMeme,代码行数:13,代码来源:SigUtil.java

示例6: getSpecs

import net.i2p.crypto.eddsa.spec.EdDSAParameterSpec; //导入依赖的package包/类
public EdDSAParameterSpec getSpecs() {
    return keySpecs;
}
 
开发者ID:kamax-io,项目名称:matrix-java-sdk,代码行数:4,代码来源:KeyManager.java

示例7: getParams

import net.i2p.crypto.eddsa.spec.EdDSAParameterSpec; //导入依赖的package包/类
public EdDSAParameterSpec getParams() {
    return edDsaSpec;
}
 
开发者ID:ubirch,项目名称:ubirch-scala-utils,代码行数:4,代码来源:EdDSAPrivateKey.java

示例8: generateKey

import net.i2p.crypto.eddsa.spec.EdDSAParameterSpec; //导入依赖的package包/类
public static byte[] generateKey() throws InvalidAlgorithmParameterException {
	EdDSAParameterSpec spec = EdDSANamedCurveTable.getByName("ed25519-sha-512");
	byte[] seed = new byte[spec.getCurve().getField().getb()/8];
	getSecureRandom().nextBytes(seed);
	return seed;
}
 
开发者ID:beowulfe,项目名称:HAP-Java,代码行数:7,代码来源:HomekitUtils.java

示例9: EdsaVerifier

import net.i2p.crypto.eddsa.spec.EdDSAParameterSpec; //导入依赖的package包/类
public EdsaVerifier(byte[] publicKey) {
	EdDSAParameterSpec spec = EdDSANamedCurveTable.getByName("ed25519-sha-512");
	EdDSAPublicKeySpec pubKey = new EdDSAPublicKeySpec(publicKey, spec);
	this.publicKey = new EdDSAPublicKey(pubKey);
}
 
开发者ID:beowulfe,项目名称:HAP-Java,代码行数:6,代码来源:EdsaVerifier.java

示例10: getParams

import net.i2p.crypto.eddsa.spec.EdDSAParameterSpec; //导入依赖的package包/类
@Override
public EdDSAParameterSpec getParams() {
    return edDsaSpec;
}
 
开发者ID:cping,项目名称:RipplePower,代码行数:5,代码来源:EdDSAPrivateKey.java

示例11: getParams

import net.i2p.crypto.eddsa.spec.EdDSAParameterSpec; //导入依赖的package包/类
/**
 * return a parameter specification representing the EdDSA domain
 * parameters for the key.
 */
public EdDSAParameterSpec getParams();
 
开发者ID:ubirch,项目名称:ubirch-scala-utils,代码行数:6,代码来源:EdDSAKey.java

示例12: getParams

import net.i2p.crypto.eddsa.spec.EdDSAParameterSpec; //导入依赖的package包/类
/**
 * @return a parameter specification representing the EdDSA domain
 *         parameters for the key.
 */
EdDSAParameterSpec getParams();
 
开发者ID:cping,项目名称:RipplePower,代码行数:6,代码来源:EdDSAKey.java


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