Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,17 @@ import io.mosip.vercred.vcverifier.keyResolver.types.http.HttpsPublicKeyResolver

- **VC Validation**: The library validates the structure, signatures, and expiration of Verifiable Credentials to ensure they conform to the W3C VC standards.
- **Cryptographic Signature Verification**: Supports the verification of cryptographic signatures using public keys, including EdDSA, RSA, and other supported algorithms, ensuring the integrity of the credential.
- **Status Check**: It includes mechanisms to check the current status of credentials, allowing applications to determine if a credential is still valid or has been invalidated.
- **Compatibility with Various Data Models**: It supports multiple VC data models (e.g., VC 1.1, VC 2.0), ensuring compatibility across various decentralized identity systems.

#### Supported VC Formats and Their Signature Mechanisms

| VC format | Issuer Signature Mechanism | Verification Algorithms | Signature Suites / Proof Types |
|-------------|------------------------------------------------------------------------|-------------------------------|--------------------------------------------------------------|
| `ldp_vc` | Linked Data Proof | PS256, RS256, EdDSA (Ed25519) | RsaSignature2018, Ed25519Signature2018, Ed25519Signature2020 |
| `mso_mdoc` | COSE (CBOR Object Signing and Encryption) | ES256 | Uses COSE_Sign1 |
| `vc+sd-jwt` | X.509 Certificate (Currently, JWT VC Issuer Metadata is not supported) | PS256, RS256,ES256, EdDSA (Ed25519) | check JWT signatures using X.509 certificate |
| `dc+sd-jwt` | X.509 Certificate (Currently, JWT VC Issuer Metadata is not supported) | PS256, RS256,ES256, EdDSA (Ed25519) | check JWT signatures using X.509 certificate |
| VC format | Issuer Signature Mechanism | Verification Algorithms | Signature Suites / Proof Types |
|-------------|------------------------------------------------------------------------|-------------------------------------|-------------------------------------------------------------------------------------------|
| `ldp_vc` | Linked Data Proof | PS256, RS256, EdDSA (Ed25519) | RsaSignature2018, Ed25519Signature2018, Ed25519Signature2020, EcdsaSecp256k1Signature2019 |
| `mso_mdoc` | COSE (CBOR Object Signing and Encryption) | ES256 | Uses COSE_Sign1 |
| `vc+sd-jwt` | X.509 Certificate (Currently, JWT VC Issuer Metadata is not supported) | PS256, RS256,ES256, EdDSA (Ed25519) | - |
| `dc+sd-jwt` | X.509 Certificate (Currently, JWT VC Issuer Metadata is not supported) | PS256, RS256,ES256, EdDSA (Ed25519) | - |

#### Project Structure

Expand All @@ -57,6 +58,7 @@ import io.mosip.vercred.vcverifier.keyResolver.types.http.HttpsPublicKeyResolver
- `types`
- `validator`
- `verifier`
- `statusChecker`
- **data**
- **exception**
- **keyResolver**
Expand Down
931 changes: 791 additions & 140 deletions vc-verifier/kotlin/README.md

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions vc-verifier/kotlin/example/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ android {
resources {
excludes += "META-INF/*"
excludes += "/META-INF/{AL2.0,LGPL2.1}"
excludes += "META-INF/versions/9/OSGI-INF/MANIFEST.MF"
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,4 +192,8 @@ val mosipVc = """
"MOSIPVerifiableCredential"
]
}
""".trimIndent()

val cwtHex = """
d2844fa2044a746573742d6b65792d310126a05824a2041a695c6e3a01781a68747470733a2f2f6973737565722e6578616d706c652e636f6d58400d29639303b33b73e71fc3a5294a0cb001c8faa1a4863e89a99086e990004c36c59dbc6573045e4ae93f49ce57dc67b6935c0c7a0a8a330ac1998ec3b80b1ba4
""".trimIndent()
6 changes: 4 additions & 2 deletions vc-verifier/kotlin/gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,14 @@ activityCompose = "1.9.2"
composeBom = "2024.04.01"
orgJson = "20240303"
sonarqube = "5.1.0.4872"
jacksonAnnotations = "2.14.0"
jacksonModuleKotlin = "2.14.0"
jacksonAnnotations = "2.17.2"
jacksonModuleKotlin = "2.17.2"
Comment on lines +23 to +24
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🌐 Web query:

Jackson 2.14.0 CVE vulnerabilities security issues

💡 Result:

Short answer: Jackson (jackson-databind) 2.14.0 mainly contains fixes for many prior "unsafe deserialization" CVEs, but the jackson-databind family has a long history of deserialization and resource‑exhaustion vulnerabilities. Distributors/security trackers mark several high‑severity deserialization CVEs as fixed by the 2.14.x fixes; additional denial‑of‑service / resource exhaustion issues have also been addressed in later 2.11–2.14 series releases. Upgrade to a patched release (or the latest 2.15+/maintenance release) and avoid enabling DefaultTyping / untrusted polymorphic deserialization. Sources: Snyk vulnerability list, Debian security tracker, CVE summary. [1][2][3]

References

  • Snyk jackson-databind vulnerability summary. [1]
  • Debian security tracker entries showing fixes in 2.14.0 packaging. [2]
  • CVE/CVEdetails summary for 2.14.x. [3]

If you want, I can run a live check of the very latest jackson-databind release and list specific CVE numbers and which are fixed in 2.14.0 vs later releases.


🌐 Web query:

Jackson breaking changes 2.14.0 to 2.17.2 upgrade guide

💡 Result:

Below is a concise upgrade checklist noting the important breaking/behavior changes and recommended actions when moving from Jackson 2.14.0 → 2.17.2.

High-impact changes to review and adapt for

  • Java / platform: Jackson 2.14 raised baseline to Java 8 for most components. Confirm your runtime/CI use Java 8+ (and Android SDK minimum changes noted). [1]
  • JsonNode API/behavior:
    • JsonNode.with(...) and withArray(...) treat arguments starting with "/" as JsonPointer expressions since 2.14; use withObjectProperty/withArrayProperty (added later) if you relied on literal names containing slashes. [1][3]
  • Annotation/visibility/ignore semantics:
    • Handling of conflicting @JsonIgnore vs @JsonProperty changed (2.14): @JsonIgnore now generally wins in ambiguous cases — audit any code relying on previous precedence. [1]
  • Stream / parsing constraints and defaults:
    • Starting in 2.15+ Jackson introduced StreamReadConstraints (limits on textual length, nesting, numeric sizes) and defaults that may cause deserialization failures for very large payloads; either raise/override constraints or explicitly configure JsonFactory/StreamReadConstraints if you process large inputs. [2][4]
  • Number parsing/formatting:
    • New faster float/double parsing/writing options (Schubfach) and changes to numeric handling (multi-release JAR optimizations) exist since 2.14–2.15; these are opt-in features but numeric behavior and rounding/parsing of corner cases (e.g., "3.") have been tightened/fixed across 2.15–2.17 — run numeric tests. [1][2][4]
  • Enums / mix-ins / naming:
    • 2.15–2.16 added better enum annotation support, new EnumNaming/EnumFeature options, and mix-in fixes for enums; if you used enum mix-ins or custom naming, re-test and consider the new annotation options. [3][2]
  • Polymorphic typing / type id handling:
    • 2.16 introduced per-type strict type-id options (OptBoolean in @JsonTypeInfo, JsonTypeInfo.Value) and new Id.SIMPLE_NAME — review polymorphic type handling and any custom type-id code. [5]
  • Kotlin/other language modules:
    • 2.15+ changed Kotlin support (no longer Kotlin 1.4 supported) — check module compatibility for kotlin/scala modules you use. [2]
  • Transitive dependency changes:
    • SnakeYAML bumped for YAML module, and other module dependency versions changed (check your BOM/custom dependency constraints). [2]
  • Bugfixes you may benefit from:
    • 2.17.x patch releases (2.17.2) contain many fixes for Reactor interaction, BigDecimal parsing edge-cases and other regressions — if you hit those issues upgrade to latest 2.17.x. [4]

Recommended upgrade steps

  1. Update BOM / dependencies to Jackson 2.17.2 (or latest 2.17.x) in your build (Maven/Gradle). [4]
  2. Run full test suite (unit + integration) — focus on:
    • JSON parsing of large strings, deep nesting and large numbers (StreamReadConstraints).
    • Enum serialization/deserialization, enum mix-ins, and any custom EnumNaming usage.
    • Polymorphic type handling and @JsonTypeInfo-annotated types.
    • Any code relying on JsonNode.with(...) semantics or on @JsonIgnore/@JsonProperty precedence.
  3. If you encounter "limit" errors (too long string, depth, numeric size), configure StreamReadConstraints or JsonFactory.overrideDefaultStreamReadConstraints(...) to the values your application needs. [2][4]
  4. If you use Kotlin/Scala modules, ensure module versions match supported language versions (2.15+ Kotlin change). [2]
  5. Check transitive deps (SnakeYAML, Guava baseline, Woodstox etc.) and adjust BOM pins or exclusions if your ecosystem requires older versions. [2]
  6. Smoke-test performance-sensitive code paths that parse/serialize floating point numbers if you opt-in to new fast parsers/writers. [1][2]
  7. Review changelogs of intermediate releases (2.15, 2.16, 2.17.2) for any additional fixes affecting your code and for patch-level bugfixes to apply. [2][3][4]

Primary sources / release notes (read before upgrading)

  • Jackson 2.14 release notes (behavior/API changes). [1]
  • Jackson 2.15 release notes (StreamReadConstraints, multi-release jar, module changes, enum features). [2]
  • Jackson 2.16 overview / 2.16.x notes (enum improvements, JsonNode additions, JsonTypeInfo per-type config). [3][5]
  • Jackson 2.17.2 release notes (patch fixes, Reactor/BigDecimal/edge-case fixes). [4]

If you want, I can:

  • produce a diff-style checklist for your codebase (search for usages of JsonNode.with, @JsonIgnore/@JsonProperty, @JsonTypeInfo, enum mix-ins), or
  • generate concrete JsonFactory/StreamReadConstraints sample code to override defaults. Which would you prefer?

References
[1] Jackson Release 2.14 — FasterXML (release notes).
[2] Jackson Release 2.15 — FasterXML (release notes).
[3] Jackson 2.16 overview (cowtowncoder blog / rc notes).
[4] Jackson Release 2.17.2 — FasterXML (release notes).
[5] Jackson 2.16.1 / 2.16.x summary (package/announcements).


Test Jackson upgrade to 2.17.2 for breaking changes before merging.

The upgrade spans multiple minor versions with several breaking changes requiring verification:

  • StreamReadConstraints (2.15+): May reject deserialization of large strings, deep nesting, or large numbers; verify your payload sizes don't exceed new defaults or configure StreamReadConstraints if needed.
  • JsonNode.with() (2.14+): Arguments starting with "/" are now treated as JsonPointer expressions; audit code relying on literal "/" in names.
  • @JsonIgnore/@JsonProperty (2.14+): Precedence rules changed; @JsonIgnore now generally wins in conflicts.
  • Enum handling (2.15+): New enum annotation support and naming options; re-test any enum serialization/deserialization.
  • Polymorphic types (2.16+): Per-type strict type-id options added; review @JsonTypeInfo-annotated types.
  • Kotlin module compatibility (2.15+): Module no longer supports Kotlin 1.4; confirm your Kotlin version matches.
  • Transitive dependencies: SnakeYAML, Guava, Woodstox versions changed; verify no conflicts in your dependency tree.

Additionally, 2.17.2 includes security patches and BigDecimal/Reactor fixes beyond what 2.14.0 had. Run full test suite, especially for JSON parsing of large/nested data, enum handling, and polymorphic deserialization.

🤖 Prompt for AI Agents
In @vc-verifier/kotlin/gradle/libs.versions.toml around lines 23-24, You
upgraded jacksonAnnotations and jacksonModuleKotlin to 2.17.2; before merging,
run the full test suite and explicitly verify breaking-change areas: confirm
StreamReadConstraints limits won't reject large strings/deep nesting or set
custom StreamReadConstraints in Jackson configuration; audit any uses of
JsonNode.with() for keys starting with "/" and update callers expecting literal
"/" behavior; re-test places using @JsonIgnore/@JsonProperty to ensure
precedence changes don't break mappings; exercise all enum
(serialize/deserialize) paths and @JsonTypeInfo polymorphic deserialization to
catch behavioral changes; verify Kotlin compatibility (module requires Kotlin
>=1.5), and check the dependency tree for transitive changes
(SnakeYAML/Guava/Woodstox) that could cause conflicts. Ensure CI includes JSON
parsing tests for large/nested payloads, enum cases, and polymorphic types
before approving the version bump of jacksonAnnotations and jacksonModuleKotlin.

mockWebServer = "4.12.0"
annotationJvm = "1.9.1"
cbor = "0.9"
identity = "20231002"
authleteSdJwt = "1.5"
coseLibrary = "2.0.0"

[libraries]
junitJupiter = { group = "org.junit.jupiter", name = "junit-jupiter", version.ref = "junit" }
Expand Down Expand Up @@ -62,6 +63,7 @@ mockWebServer = { group = "com.squareup.okhttp3", name = "mockwebserver", versio
annotation-jvm = { group = "androidx.annotation", name = "annotation-jvm", version.ref = "annotationJvm" }
cbor = { group = "co.nstant.in", name = "cbor", version.ref = "cbor" }
identity = { group = "com.android.identity", name = "identity-credential", version.ref = "identity" }
cose-lib = { group = "se.digg.cose", name = "cose-lib", version.ref = "coseLibrary" }

[plugins]
androidApplication = { id = "com.android.application", version.ref = "agp" }
Expand Down
10 changes: 10 additions & 0 deletions vc-verifier/kotlin/vcverifier/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,23 @@ dependencies {
implementation(libs.annotation.jvm)
implementation(libs.authelete.sd.jwt)
implementation(libs.threetenbp)
implementation(libs.cose.lib)

testImplementation(libs.mockk)
testImplementation(libs.junitJupiter)
testImplementation(libs.mockWebServer)

}

configurations.all {
exclude(group = "org.bouncycastle", module = "bcprov-jdk15on")
exclude(group = "org.bouncycastle", module = "bcpkix-jdk15on")
exclude(group = "org.bouncycastle", module = "bcutil-jdk15on")
exclude(group = "org.bouncycastle", module = "bcprov-jdk15to18")
}



tasks.withType<Test> {
useJUnitPlatform()
jacoco {
Expand Down
4 changes: 2 additions & 2 deletions vc-verifier/kotlin/vcverifier/publish-artifact.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ publishing {
}
groupId = "io.mosip"
artifactId = "vcverifier-aar"
version = "1.6.0-SNAPSHOT"
version = "1.7.0-SNAPSHOT"
if (project.gradle.startParameter.taskNames.any { it.contains('assembleRelease') }) {
artifacts {
aar {
Expand All @@ -110,7 +110,7 @@ publishing {
artifact(tasks.named("jarRelease").get())
groupId = "io.mosip"
artifactId = "vcverifier-jar"
version = "1.6.0-SNAPSHOT"
version = "1.7.0-SNAPSHOT"
artifact(tasks.named("javadocJar").get())
artifact(tasks.named("sourcesJar").get())
pom {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,16 @@ import io.mosip.vercred.vcverifier.constants.CredentialValidatorConstants.ERROR_
import io.mosip.vercred.vcverifier.constants.CredentialVerifierConstants.ERROR_CODE_VERIFICATION_FAILED
import io.mosip.vercred.vcverifier.constants.CredentialVerifierConstants.ERROR_MESSAGE_VERIFICATION_FAILED
import io.mosip.vercred.vcverifier.constants.CredentialVerifierConstants.EXCEPTION_DURING_VERIFICATION
import io.mosip.vercred.vcverifier.constants.CredentialVerifierConstants.ERROR_VC_REVOKED
import io.mosip.vercred.vcverifier.constants.CredentialVerifierConstants.ERROR_CODE_VC_REVOKED
import io.mosip.vercred.vcverifier.credentialverifier.CredentialVerifierFactory
import io.mosip.vercred.vcverifier.data.CredentialStatusResult
import io.mosip.vercred.vcverifier.data.CredentialVerificationSummary
import io.mosip.vercred.vcverifier.data.VerificationResult
import java.util.logging.Logger


class CredentialsVerifier {
private val logger = Logger.getLogger(CredentialsVerifier::class.java.name)
private val credentialVerifierFactory = CredentialVerifierFactory()

/**
* @deprecated This method has been deprecated because it is not extensible for future use cases of supporting different VC format's verification
Expand All @@ -23,48 +24,82 @@ class CredentialsVerifier {
*/
@Deprecated("This method has been deprecated because it is not extensible for future use cases of supporting different VC format's verification")
fun verifyCredentials(credentials: String?): Boolean {
if(credentials==null){
if (credentials == null) {
logger.severe("Error - Input credential is null")
throw RuntimeException("Input credential is null")
}
val credentialVerifier = CredentialVerifierFactory().get(LDP_VC)
val credentialVerifier = credentialVerifierFactory.get(LDP_VC)
val isVerified = credentialVerifier.verify(credentials)

if (!isVerified) {
logger.warning("Credential verification failed")
return false
}

val isRevoked = credentialVerifier.isRevoked(credentials)

if (isRevoked) {
logger.warning("Credential has been revoked")
return false
}

return true
}

fun verify(credential: String, credentialFormat: CredentialFormat): VerificationResult {
val credentialVerifier = CredentialVerifierFactory().get(credentialFormat)
val credentialVerifier = credentialVerifierFactory.get(credentialFormat)
val validationStatus = credentialVerifier.validate(credential)
if (validationStatus.validationMessage.isNotEmpty() && !validationStatus.validationErrorCode.contentEquals(ERROR_CODE_VC_EXPIRED)) {
return VerificationResult(false, validationStatus.validationMessage, validationStatus.validationErrorCode)
if (validationStatus.validationMessage.isNotEmpty() && !validationStatus.validationErrorCode.contentEquals(
ERROR_CODE_VC_EXPIRED
)
) {
return VerificationResult(
false,
validationStatus.validationMessage,
validationStatus.validationErrorCode
)
}
return try {
val verifySignatureStatus = credentialVerifier.verify(credential)
if (!verifySignatureStatus) {
return VerificationResult(false, ERROR_MESSAGE_VERIFICATION_FAILED, ERROR_CODE_VERIFICATION_FAILED)
if (verifySignatureStatus) {
return VerificationResult(
true,
validationStatus.validationMessage,
validationStatus.validationErrorCode
)
}
return VerificationResult(
false,
ERROR_MESSAGE_VERIFICATION_FAILED,
ERROR_CODE_VERIFICATION_FAILED
)

val isRevoked = credentialVerifier.isRevoked(credential)
if (isRevoked){
return VerificationResult(true, ERROR_VC_REVOKED, ERROR_CODE_VC_REVOKED)
}
VerificationResult(true, validationStatus.validationMessage, validationStatus.validationErrorCode)
} catch (e: Exception) {
val errorCode = validationStatus.validationErrorCode.takeIf { !it.isNullOrEmpty() } ?: ERROR_CODE_VERIFICATION_FAILED
val errorCode = validationStatus.validationErrorCode.takeIf { !it.isNullOrEmpty() }
?: ERROR_CODE_VERIFICATION_FAILED
VerificationResult(false, "$EXCEPTION_DURING_VERIFICATION${e.message}", errorCode)
}
}

fun getCredentialStatus(
credential: String,
credentialFormat: CredentialFormat,
statusPurposeList: List<String> = emptyList()
): Map<String, CredentialStatusResult> {
try {
return credentialVerifierFactory.get(credentialFormat)
.checkStatus(credential, statusPurposeList)
} catch (unsupportedException: UnsupportedOperationException) {
logger.warning("Error occurred while checking credential status of format ${credentialFormat}: ${unsupportedException.message}. Returning empty status list.")
return emptyMap()
} catch (e: Exception) {
logger.severe("Error occurred while checking credential status: ${e.message}")
throw e
}
}

fun verifyAndGetCredentialStatus(
credential: String,
credentialFormat: CredentialFormat,
statusPurposeList: List<String> = emptyList()
): CredentialVerificationSummary {
val verificationResult = verify(credential, credentialFormat)
if (verificationResult.verificationStatus) {
val statusResults = getCredentialStatus(credential, credentialFormat, statusPurposeList)
return CredentialVerificationSummary(verificationResult, statusResults)
}
return CredentialVerificationSummary(verificationResult, emptyMap())
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ import io.mosip.vercred.vcverifier.constants.CredentialVerifierConstants.ED25519
import io.mosip.vercred.vcverifier.constants.CredentialVerifierConstants.JSON_WEB_PROOF_TYPE_2020
import io.mosip.vercred.vcverifier.constants.Shared
import io.mosip.vercred.vcverifier.data.PresentationVerificationResult
import io.mosip.vercred.vcverifier.data.PresentationResultWithCredentialStatus
import io.mosip.vercred.vcverifier.data.VCResult
import io.mosip.vercred.vcverifier.data.VCResultWithCredentialStatus
import io.mosip.vercred.vcverifier.data.VPVerificationStatus
import io.mosip.vercred.vcverifier.data.VerificationResult
import io.mosip.vercred.vcverifier.data.VerificationStatus
Expand All @@ -40,6 +42,15 @@ class PresentationVerifier {

fun verify(presentation: String): PresentationVerificationResult {

val presentationVerificationStatus: VPVerificationStatus = getPresentationVerificationStatus(presentation)

val verifiableCredentials = JSONObject(presentation).getJSONArray(Shared.KEY_VERIFIABLE_CREDENTIAL)
val vcVerificationResults: List<VCResult> = getVCVerificationResults(verifiableCredentials)

return PresentationVerificationResult(presentationVerificationStatus, vcVerificationResults)
}

private fun getPresentationVerificationStatus(presentation: String): VPVerificationStatus {
logger.info("Received Presentation For Verification - Start")
val proofVerificationStatus: VPVerificationStatus
val vcJsonLdObject: JsonLDObject
Expand Down Expand Up @@ -124,11 +135,7 @@ class PresentationVerifier {
}
}
}

val vcVerificationResults: List<VCResult> =
getVCVerificationResults(JSONObject(presentation).getJSONArray(Shared.KEY_VERIFIABLE_CREDENTIAL))

return PresentationVerificationResult(proofVerificationStatus, vcVerificationResults)
return proofVerificationStatus
}

private fun getVCVerificationResults(verifiableCredentials: JSONArray): List<VCResult> {
Expand All @@ -152,5 +159,27 @@ class PresentationVerifier {
}
}

private fun getVCVerificationResultsWithCredentialStatus(verifiableCredentials: JSONArray, statusPurposeList: List<String>): List<VCResultWithCredentialStatus> {
return verifiableCredentials.asIterable().map { item ->
val credentialVerificationSummary = credentialsVerifier.verifyAndGetCredentialStatus((item as JSONObject).toString(), CredentialFormat.LDP_VC, statusPurposeList)
val verificationResult: VerificationResult = credentialVerificationSummary.verificationResult
val singleVCVerification: VerificationStatus = Util.getVerificationStatus(verificationResult)
val credentialStatus = credentialVerificationSummary.credentialStatus

VCResultWithCredentialStatus(item.toString(), singleVCVerification, credentialStatus)
}
}

fun verifyAndGetCredentialStatus(
presentation: String,
statusPurposeList: List<String> = emptyList()
): PresentationResultWithCredentialStatus {
val presentationVerificationStatus = getPresentationVerificationStatus(presentation)

val verifiableCredentials = JSONObject(presentation).getJSONArray(Shared.KEY_VERIFIABLE_CREDENTIAL)
val vcVerificationResults: List<VCResultWithCredentialStatus> = getVCVerificationResultsWithCredentialStatus(verifiableCredentials, statusPurposeList)

return PresentationResultWithCredentialStatus(presentationVerificationStatus, vcVerificationResults)
}
}

Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package io.mosip.vercred.vcverifier.constants

enum class CredentialFormat(val value: String) {
CWT_VC("cwt_vc"),
LDP_VC("ldp_vc"),
VC_SD_JWT("vc+sd-jwt"),
DC_SD_JWT("dc+sd-jwt"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ object CredentialValidatorConstants {
const val ERROR_VALID_FROM_INVALID = "${VALIDATION_ERROR}validFrom is not valid."
const val ERROR_VALID_UNTIL_INVALID = "${VALIDATION_ERROR}validUntil is not valid."

const val ERROR_MESSAGE_EMPTY_VC_CWT="${VALIDATION_ERROR}Input VC CWT string is null or empty."

const val ERROR_MESSAGE_INVALID_HEX_VC_CWT="${VALIDATION_ERROR}Invalid hexadecimal format"


const val ERROR_CODE_VC_EXPIRED = "ERR_VC_EXPIRED"
const val ERROR_MESSAGE_VC_EXPIRED = "VC is expired"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,6 @@ object CredentialVerifierConstants {
const val ERROR_MESSAGE_VERIFICATION_FAILED = "Verification Failed"
const val ERROR_CODE_VERIFICATION_FAILED = "ERR_SIGNATURE_VERIFICATION_FAILED"

const val ERROR_VC_REVOKED = "Credential is revoked"
const val ERROR_CODE_VC_REVOKED = "REVOKED"

// This is used to turn public key bytes into a buffer in DER format
const val DER_PUBLIC_KEY_PREFIX = "302a300506032b6570032100"

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package io.mosip.vercred.vcverifier.constants


object StatusCheckerConstants {
const val STATUS_LIST_CREDENTIAL = "statusListCredential"
const val BITSTRING_STATUS_LIST_ENTRY = "BitstringStatusListEntry"
const val BITSTRING_STATUS_LIST = "BitstringStatusList"
const val STATUS_PURPOSE = "statusPurpose"
const val ENCODED_LIST = "encodedList"
const val STATUS_SIZE = "statusSize"
const val STATUS_MESSAGE = "statusMessage"
const val STATUS_LIST_INDEX = "statusListIndex"
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package io.mosip.vercred.vcverifier.credentialverifier

import io.mosip.vercred.vcverifier.constants.CredentialFormat
import io.mosip.vercred.vcverifier.credentialverifier.types.CwtVerifiableCredential
import io.mosip.vercred.vcverifier.credentialverifier.types.LdpVerifiableCredential
import io.mosip.vercred.vcverifier.credentialverifier.types.SdJwtVerifiableCredential
import io.mosip.vercred.vcverifier.credentialverifier.types.msomdoc.MsoMdocVerifiableCredential
Expand All @@ -12,6 +13,7 @@ class CredentialVerifierFactory {
CredentialFormat.MSO_MDOC -> MsoMdocVerifiableCredential()
CredentialFormat.VC_SD_JWT -> SdJwtVerifiableCredential()
CredentialFormat.DC_SD_JWT -> SdJwtVerifiableCredential()
CredentialFormat.CWT_VC -> CwtVerifiableCredential()
}
}
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
package io.mosip.vercred.vcverifier.credentialverifier

import io.mosip.vercred.vcverifier.data.CredentialStatusResult
import io.mosip.vercred.vcverifier.data.ValidationStatus

interface VerifiableCredential {
fun validate(credential: String): ValidationStatus
fun verify(credential: String): Boolean
fun isRevoked(credential: String): Boolean
fun checkStatus(credential: String, statusPurposes: List<String>?): Map<String, CredentialStatusResult> {
throw UnsupportedOperationException("Credential status checking not supported for this credential format")
}
}
Loading