Skip to content
This repository has been archived by the owner on Dec 5, 2024. It is now read-only.

ECDSA sign error #1303

Open
superzoeyian opened this issue Mar 2, 2022 · 1 comment
Open

ECDSA sign error #1303

superzoeyian opened this issue Mar 2, 2022 · 1 comment

Comments

@superzoeyian
Copy link

my test code is like this :
@test
public void loadTest() {
String privString = "c85ef7d79691fe79573b1a7064c19c1a9819ebdbd1faaab1a8ec92344438aaf4";
BigInteger privateKey = new BigInteger(privString, 16);
String exampleMessage = "This is an example of a signed message.";
ECKey key = ECKey.fromPrivate(privateKey);
byte[] messageHash = HashUtil.sha3(exampleMessage.getBytes());
ECDSASignature signature = key.sign(messageHash);
String output = signature.toHex();
System.out.println("Signature\t: " + output + " (Hex, length: " + output.length() + ")");
}

and i got tests failed msg below:

java.lang.NoClassDefFoundError: org/spongycastle/asn1/rosstandart/RosstandartObjectIdentifiers

at org.spongycastle.jcajce.provider.digest.GOST3411$Mappings.configure(GOST3411.java:170)
at org.spongycastle.jce.provider.BouncyCastleProvider.loadAlgorithms(BouncyCastleProvider.java:225)
at org.spongycastle.jce.provider.BouncyCastleProvider.setup(BouncyCastleProvider.java:154)
at org.spongycastle.jce.provider.BouncyCastleProvider.access$000(BouncyCastleProvider.java:54)
at org.spongycastle.jce.provider.BouncyCastleProvider$1.run(BouncyCastleProvider.java:146)
at java.security.AccessController.doPrivileged(Native Method)
at org.spongycastle.jce.provider.BouncyCastleProvider.<init>(BouncyCastleProvider.java:142)
at org.ethereum.crypto.jce.SpongyCastleProvider$Holder.<clinit>(SpongyCastleProvider.java:33)
at org.ethereum.crypto.jce.SpongyCastleProvider.getInstance(SpongyCastleProvider.java:41)
at org.ethereum.crypto.ECKey.<init>(ECKey.java:276)
at org.ethereum.crypto.ECKey.fromPrivate(ECKey.java:317)
at org.ethereum.crypto.ECKey.<clinit>(ECKey.java:141)
at IIDUtilTest.loadTest(IIDUtilTest.java:175)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)

could someone help me out with this error,

@erockoms
Copy link

erockoms commented Mar 2, 2022 via email

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants