Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

java.lang.NoClassDefFoundError: Could not initialize class com.danubetech.keyformats.crypto.provider.impl.NaClSodiumEd25519Provider #13 #11

Closed
Muthurajj opened this issue Sep 6, 2022 · 5 comments

Comments

@Muthurajj
Copy link

Muthurajj commented Sep 6, 2022

Hi , I am getting this exception while generating the sign could you pls guide me on this.

for the below sample, i am getting this exception (Bold line)

Map<String, Object> claims = new LinkedHashMap<>();
Map<String, Object> degree = new LinkedHashMap<>();
degree.put("name", "Bachelor of Science and Arts");
degree.put("type", "BachelorDegree");
claims.put("college", "Test University");
claims.put("degree", degree);

CredentialSubject credentialSubject = CredentialSubject.builder()
.id(URI.create("did:example:ebfeb1f712ebc6f1c276e12ec21"))
.claims(claims)
.build();

VerifiableCredential verifiableCredential = VerifiableCredential.builder()
.context(VerifiableCredentialContexts.JSONLD_CONTEXT_W3C_2018_CREDENTIALS_EXAMPLES_V1)
.type("UniversityDegreeCredential")
.id(URI.create("http://example.edu/credentials/3732"))
.issuer(URI.create("did:example:76e12ec712ebc6f1c221ebfeb1f"))
.issuanceDate(JsonLDUtils.stringToDate("2019-06-16T18:56:59Z"))
.expirationDate(JsonLDUtils.stringToDate("2019-06-17T18:56:59Z"))
.credentialSubject(credentialSubject)
.build();

byte[] testEd25519PrivateKey = Hex.decodeHex("984b589e121040156838303f107e13150be4a80fc5088ccba0b0bdc9b1d89090de8777a28f8da1a74e7a13090ed974d879bf692d001cddee16e4cc9f84b60580".toCharArray());

Ed25519Signature2018LdSigner signer = new Ed25519Signature2018LdSigner(testEd25519PrivateKey);
signer.setCreated(new Date());
signer.setProofPurpose(LDSecurityKeywords.JSONLD_TERM_ASSERTIONMETHOD);
signer.setVerificationMethod(URI.create("did:example:76e12ec712ebc6f1c221ebfeb1f#keys-1"));
LdProof ldProof = signer.sign(verifiableCredential);

System.out.println(verifiableCredential.toJson(true));

@peacekeeper
Copy link
Member

Hello, thanks for raising the issue, and sorry to hear about the problems you have here. Please install libsodium on your machine, or alternatively try to use TinkEd25519Provider instead of NaClSodiumEd25519Provider.

See this other issue for more information on how to do that: #8

Please let me know if this helps or you still have problems.

@Muthurajj
Copy link
Author

Hello, thanks for raising the issue, and sorry to hear about the problems you have here. Please install libsodium on your machine, or alternatively try to use TinkEd25519Provider instead of NaClSodiumEd25519Provider.

See this other issue for more information on how to do that: #8

Please let me know if this helps or you still have problems.

Sorry for troubling you, can you please tell me how to use TinkEd25519Provider , I cannot understand the steps

@peacekeeper
Copy link
Member

Hello, in your project you should include a file with the following path and name:
/src/main/resources/META-INF/services/com.danubetech.keyformats.crypto.provider.Ed25519Provider

This file should contain the following content:

com.danubetech.keyformats.crypto.provider.impl.TinkEd25519Provider

@Muthurajj
Copy link
Author

Yes, but its a jar file i couldn't modify it

@peacekeeper
Copy link
Member

But you can create this file inside your own project, which will "override" the one in the .jar file.

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

No branches or pull requests

2 participants