WebOfTrustInfo / ld-signatures-java

Java implementation of Linked Data Signatures
Apache License 2.0
16 stars 15 forks source link

Determining algorithm value when using `PublicKeyVerifierFactory.publicKeyVerifierForJWK()` #20

Open kenneth-leong-gt opened 1 year ago

kenneth-leong-gt commented 1 year ago

Hi currently i am creating my verifier like below.


val jsonLdObject =  getJsonLDObjectFromString(jsonLdString)
val ldProof = LdProof.getFromJsonLDObject(jsonLdObject)

val verifier =
            try {
                LdVerifierRegistry.getLdVerifierBySignatureSuiteTerm(ldProof.type)
            } catch (ex: Exception) {
                Log.d("webOfTrustVerifyJsonLd", "Unable to get verifier: ${ex::class.java.simpleName} - ${ex.message}")
                null
            } 

After creating the verifier i understand that the publicKeyVerifier needs to be created. I have the publicKey JWK. My questions is, what is the way to determine the algorithm String when creating the PublicKeyVerifier below? My JWK alg is null.

val parsedJwk = JWK.fromJson(publicJwkJsonObject.toString().replace("\\", ""))
val byteVerifier = PublicKeyVerifierFactory.publicKeyVerifierForJWK(parsedJwk, "some Algorithm")  <----- here